Ask Your Question

Revision history [back]

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/imgproc/doc/structural_analysis_and_shape_descriptors.html#convexitydefects

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.