Drawing a rectangle and masking the outside area
I wrote some code that uses background subtraction to measure movement. The above image shows the first frame (1), Original video (2), and movement via background subtraction (3).
I was able to draw a rectangle during the video and I know that the value (-1) fills the rectangle. Is there a way to have everything outside of the rectangle be masked instead? That way I can reset the first frame and then only measure the inside of the rectangle.
Send me this code that is used to draw the rectangle and masking the outside area of the rectangle