# Finding a defective Corner[circled] from contours  Hi all, I want to find the corners of a object & detect if there is a cut in the corner. The Real Image is so Big & it consist of lot of noise inside the Contour Area. So far I've tried... 1)find the contours 2)approximate the contour to find the approximate corners points 3)crop each corner image & compare it with cvMatchShapes() Rotated @ Corners.

But the results was not accurate & i need some guidance.Here is the sample canny output image for which i wanna detect the Cut which is CIRCLED. Also in real Image I'm getting lot of noise in the canny output so Pls suggest me how to detect this shape defect. Regards, Balaji.R  edit retag close merge delete

Sort by » oldest newest most voted 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.

more

Official site

GitHub

Wiki

Documentation