1 | initial version |
You have 2 peaces of information:
1) shape
If you want to detect a shape all at once with the principle of Hough transform without relying on multiple lines you can perform a Generalized Hough Transform search.
On this website there is a base for your own implementation of GHT as well as a nice tutorial.
Or you can also try a chamfer matching. But I don’t like the code provided with OpenCv.
The code in the link I provided is not so beautiful but it’s effective and easy to understand, the one with OpenCv just the reverse. Try and see if there is a different implementation of it.
Both methods tolerate a small amount of rotation and warping.
2) colour
You have to implement a Bayesian method which provides the probability of every pixel (or better group of pixels to smooth noise) to be inside the white rectangle: P(rectangle|colour).
At the end you should find a way to put together information 1 and 2