Ask Your Question

champloo11's profile - activity

2015-07-09 23:49:46 -0600 answered a question Detecting dent in pipelines

Method

Extending LBerger's comment, you will definitely be looking to us a contour of some kind. OpenCV has a function that calculates the "convexity defects" of a contour and its context hull, and it gives you a struct with all the pertinent information. You can find more documentation here:

http://docs.opencv.org/modules/imgpro...

Convexity Defect Struct

struct CvConvexityDefect
{
   CvPoint* start; // point of the contour where the defect begins
   CvPoint* end; // point of the contour where the defect ends
   CvPoint* depth_point; // the farthest from the convex hull point within the defect
   float depth; // distance between the farthest point and the convex hull
};

Locating a Dent With the Struct

You can compare the "depth" variable against a threshold. If it's greater than this threshold, you'll consider that defect a "dent". Example Code:

if(defect.depth > threshold):
 // You've found a dent here.
else:
 // This wasn't a dent

Marking It

Using the "start" and "end" point, you can draw rectangle/circle/ellipse that fits these two points.

2015-07-09 18:03:46 -0600 received badge  Supporter (source)