Most relevant OpenCV tool to find a square in a frame

asked 2020-06-08 05:28:18 -0500

andrei186 gravatar image

updated 2020-06-09 06:41:03 -0500

To find a square and calculate its center  on a frame taken by a webcam, what  openCV tools could be recommended?

So many of them, diffucult to select the most suiatble for the purpose. I am not asking for code, I am asking an advice which particular OpenCV tools to study in details.

The details:

The real square to find on the picture is about 80mm by 80mm, white color surrounded with 10mm black frame. Inside the white square, in its center  could be some small black pattern like circle, rectangle, triangle etc.

Picture is taken with a 640x480, 30 fps webcam from 2 meters through a red filter.  

On the picture the square is roughly 25 by 25 pixels, it looks light gray with black frame (see picture). image:! C:\origin.jpg

The square migh appear anywhere within the webcam viewing field ( it is about 55 degrees).  It does not move but may appear slightly turned. I.e. its upper and bottom edges may by not exactly horisontal. The backgoung might be noisy. Important is reliabibilty (no square should be missed  and no false square should be found) and precision (the coordinates of the square center) The speed of the code is not important. PS. How shal I make the picture to appear in my post?image description

edit retag flag offensive close merge delete



we can't see the picture

sturkmen gravatar imagesturkmen ( 2020-06-08 05:56:20 -0500 )edit

In edit...go to click image icon...then select choose ok.....after that you will see text between square bracket...then enter description.

supra56 gravatar imagesupra56 ( 2020-06-08 05:57:35 -0500 )edit

thank you. Do you see the image now? Please note that this is just a 70x70 pixels cut out of 640x480px frame. The rest of the frame is the same background. On this picture the worst case scnario is shown: noisy background with some faint square patterns and the lighting is not strong. Yet edge detection still shows the background pattern

andrei186 gravatar imageandrei186 ( 2020-06-08 08:51:54 -0500 )edit

Yes, I can see it.

supra56 gravatar imagesupra56 ( 2020-06-08 09:05:53 -0500 )edit