Identify small defects in objects contour

115 views Asked by At

I want to match symmetry of object contours. I tried using matchShape(), computeDistance(), Humoments() from opencv 3.0 library. But none of them is close to what I want.

Following are the images on which I am working.

Good Shape-1

Defected

I expect to get highest value of dis-symmetry for image-2(named Defected)

1

There are 1 answers

6
Photon On

You can do it yourself, by using several simple tools:

  1. Find the centroid
  2. Use PCA (http://docs.opencv.org/master/d1/dee/tutorial_introduction_to_pca.html#gsc.tab=0) to find the main axis
  3. Rotate the shape so that the main axis points up
  4. In each row, count the number of pixels on either side of the center and compare (There should be a single center coordinate, probably using the median value of all rows centers)

You can tune your own thresholds to fit the problem.