I am currently doing a project of spotting fractured or bad products from a stream of product line. I am trying to use Opencv to extract the edges by Canny. Below are the edges attained from a bad product and a sample product respectively.
BAD
GOOD
The Edges are quite clear but there are many small regions of meaningless spots (noises) so it seems impossible to directly compare these two photos pixel by pixel. I was thinking if I can keep rotating and shifting the bad product and find the best comparison score such as square difference between pixels. However, with these noises, this method seems to be impossible.
Therefore, I am thinking if there is a way to extract the largest connected regions or split those connected regions into a few pictures? Or, if there exists a better comparison method even under these circumstances?
Thanks a lot!!!