So I have the following goal, I want to do a addWeighted to the same np_array as one of the inputs. So without returning the adjusted frame.
def function(frame):
polygon_overlay = np.zeros(frame.shape, dtype=np.uint8)
cv2.fillPoly(polygon_overlay, polygon, color, 8, 0)
frame = cv2.addWeighted(frame, .5, polygon_overlay, .5, 0)
frame = cv2.imread('someImg.ext')
function(frame)
cv2.imshow('result', frame)
So in this example the frame shown should have the polygon showing. I know this should be possible since this code does work.
def function(frame):
cv2.fillPoly(frame, polygon, color, 8, 0)
frame = cv2.imread('someImg.ext')
function(frame)
cv2.imshow('result', frame)
I suspect this should be possible with some kind of numpy replacement method but I have no clue how.
question from:
https://stackoverflow.com/questions/66061706/opencv-addweighted-to-same-matrix 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…