如何区分蓝色(圆形)和其他(任意定向的矩形/多边形)轮廓

时间:2020-06-30 09:35:14

标签: python opencv image-processing computer-vision halcon

this image 中有三个轮廓。我想过滤掉看起来像椭圆形的蓝色轮廓,而其他轮廓看起来像是任意对齐的多边形,其边缘也可能不完全光滑。我们如何区分蓝色(圆形)和其他(任意方向的矩形/多边形)轮廓?如何在OpenCV或Halcon中为此设计功能?

1 个答案:

答案 0 :(得分:1)

在Halcon中,您可以使用功能来区分区域/ xld的不同形状。查看有关区域/功能的帮助。 HDevelop中甚至提供了“功能直方图”工具来帮助您解决此问题并浏览所有不同功能,请检查菜单/可视化/工具/功能直方图。

在代码中: 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)