1

In this image there are three contours. I want to filter out the blue contour which looks like a rounded elliptical shape, while others look like arbitrarily aligned polygons and its edges can also be not completely smooth. How can we differentiate between blue (circular like) and other (arbitrary oriented rectangular/polygon) type contours? How to design feature for this in OpenCV or Halcon?

Javad Bahoosh
  • 400
  • 1
  • 3
  • 16
Adnan
  • 13
  • 2
  • 4
    look for "circularity" [here](https://www.learnopencv.com/blob-detection-using-opencv-python-c/) – Miki Jun 30 '20 at 09:39

1 Answers1

1

In Halcon you can use features to distinguish between different shapes of regions/xld's. Check the help for Regions / Features. There even is a 'Feature Histogram' tool in HDevelop to help you with this and explore all the different features, check menu/Visualisation/Tools/Feature Histogram.

In code: read_image(Image, 'M0tcu.jpg') decompose3(Image, Image1, Image2, Image3) rgb3_to_gray(Image1, Image2, Image3, ImageGray) threshold (ImageGray, Regions, 131, 255) connection(Regions, ConnectedRegions) select_shape (ConnectedRegions, SelectedRegions, 'circularity', 'and', 0.4615, 1)

Matthijs
  • 51
  • 3