Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So, assuming some +/- is acceptable, you can do quite well with connectedComponentsWithStats. Given the thresholded image, it will find all areas that are touching, along with width/height, location, ect.

You can use your condition 1 to throw out the very small, noisy things, and keep the very large separate for additional processing.

For post-processing, I guess erode each individual shape until it separates into two appropriately sized shapes, or goes bad. For example, the ruler should probably be thrown out right from the start. After that it's a lot of judgement calls.