Ask Your Question
0

Finding a defective Corner[circled] from contours

asked 2013-12-20 06:44:49 -0600

updated 2015-08-21 07:33:02 -0600

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

image description image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-12-25 02:25:55 -0600

Haris gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-12-20 06:44:49 -0600

Seen: 2,325 times

Last updated: Dec 25 '13