Source: https://docs.opencv.org/4.x/d1/dc5/tutorial_background_subtraction.html
In that tutorial the lines of code:
cv.rectangle(frame, (10, 2), (100,20), (255,255,255), -1)
cv.putText(frame, str(capture.get(cv.CAP_PROP_POS_FRAMES)), (15, 15),
cv.FONT_HERSHEY_SIMPLEX, 0.5 , (0,0,0))
are used. However, as far as I understand it, one would need to save their return value onto the frame, to have any change at all since they are not "in place":
frame = cv.rectangle(frame, (10, 2), (100,20), (255,255,255), -1)
frame = cv.putText(frame, str(capture.get(cv.CAP_PROP_POS_FRAMES)), (15, 15),
cv.FONT_HERSHEY_SIMPLEX, 0.5 , (0,0,0))
But even then I can't really see a difference in the result.
Am I missing something?
CodePudding user response:
Yes, you misunderstood.
Those calls work on the array object you passed into them. They modify the image array.
There is absolutely no reason to catch the return value because it is the same array object you passed in. Not just equal, but the same, identical. A reference to one and the same object. Do not catch the return value.
If you don't see something, there's a reason for it, but this is not the reason. You did not provide enough code to reproduce any issue you might have.