Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Suppose you have the image as shown above.

Now you can find defective corner using the following algorithm.

  • Find contour in the edge image.
  • Find Convexhullon the contour found.

Now you have set of point which represent sides of your contour and you can draw lines using consecutive points.

So the result of convexhull give you set of lines and you need to filter the line which represent the defective edge. For this just do the following

-> Find angle of each line using the equation

double Angle = atan2(y2 - y1, x2 - x1) * 180.0 / CV_PI;

-> Avoid the line which has angle 0 or 90 (vertical and horizontal line).

-> From the remaining lines select the line which has maximum length.

This will algorithm will works only when your source image is like above. If it is rotated then you may need to change the algorithm.