OpenCV has really lots of useful classes and features. The square detection for my virtual reality class work is being made with it. Unfortunately, on my tests, I was detecting squares which I didn't want the software to detect. Like on the image below: It would be much better if I could do the image analysis only inside the laptop screen. "Googling" on "OpenCV image crop" I had reached the nashruddin.com ( OpenCV Region of Interest - ROI ). This blog has a good explanation on how to crop (extract the region of interest) from a image. With those informations I got the following result for the same frame: Now I have to check the area of the detected squares. At the web archives of the c omputer geometry class mailing list , from the Illinois University, google had shown me one algorithm to calculate the area of a closed polygon, as follows: Let 'vertices' be an array of N pairs (x,y), indexed from 0 Let 'area' = 0.0 for i = 0 to N-1, do Let j = (