gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 16:24:09 25 4
gpt4 key购买 nike

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

最佳答案

在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)

关于python - 如何区分蓝色(圆形)和其他(任意定向的矩形/多边形)轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62654451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com