Detecting a photograph (i.e. rectangle) on screen using find contours?


I'm trying to detect a photograph in front of the screen with OpenCV (using a webcam). I am using the following code, which uses findContours() to detect rectangles (which for my purpose would count as a photograph.

This works well, but findContours expects a white background against black, so the image needs to be inverted. I tried changing the threshold, but i still can't get it to detect a photograph.

Am i going about this the right way or would there be a better approach to this.

Thank you for your time!

Show source
| find   | c++   | opencv   2016-12-25 22:12 0 Answers

Answers ( 0 )

◀ Go back