Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

I am working on an application to recognize line-like features inside circle/elliptical shapes. The shapes look like the following (two shown here):


  • The shapes themselves can vary slightly between circle and oval.

  • There are at most 5 lines inside the shapes and they are found in roughly the same area on every shape.

  • These lines can vary slightly in length, thickness, rotation, and curvature.

  • The lines can sometimes touch/intersect slightly.

  • Usually, there are exactly 5, but occasionally a line could be missing entirely.

  • I don't care about color, black and white thresholding is fine.

Each object (of 100+) will be captured individually by video; the capture is a manual/physical process (i.e. I am holding the camera each time). I have full control over the camera so I can position it consistently for each capture.

Right now I'm trying to use OpenCV to do the recognition. I was able to modify the sample 'face recognition' app to use another Haar identifier XML file, but this seems to only handle detection of the outside circle/ovals.

I am interested in generating an object per sample, to describe the 5 interior lines for further processing:


    1: { length: 20, avg_thick: 2.3 },

    2: { length: 4, avg_thick: 2.0 },

    3: { length: 9.1, avg_thick: 2.1 },

    4: { length: 2, avg_thick: 1.9 },

    5: { length: 17, avg_thick: 2.1 }


This is my first project involving image recognition. What algorithms or procedures should I use/research to achieve this? Thanks!


Since the images will be photographed by hand, they are not pure black/white. Trying to apply thresholding makes the (feint) lines inside the shapes sometimes disappear. How could I improve the thresholding results?

1 Answer

0 votes
by (108k points)

You can use the Hough transform if the lines are approximately straight, to find all lines, and the circle version of the Hough transform to find all circles/ellipses.

If the lines are not straight, according to you: "narrow elongated regions" not lines, right? You'd have to skeletonize the threshold first. You can refer to the following link:

Browse Categories