少有人走的路

勇哥的工业自动化技术网站

halcon查找纹理区域(树木与灌树丛)texture.hdev

texture.hdev这个例子是主要讲解了histo_2dim 、class_2dim_sup 搭配使用灰度直方图进行图像分割。


image.png

image.png

image.png

* Find textured areas (trees and bushes)
* 
dev_close_window ()
Interactive := 0
dev_close_window ()
read_image (MreutHill, 'mreut_y')
get_image_size (MreutHill, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
* Filter an image using a Laws texture filter
texture_laws (MreutHill, SS, 'ss', 0, 5)
texture_laws (MreutHill, EE, 'ee', 2, 5)
* Separated median filtering with rectangular masks
median_separate (SS, SSMed, 25, 25, 'mirrored')
median_separate (EE, EEMed, 25, 25, 'mirrored')
dev_display (MreutHill)
if (Interactive)
    draw_region (TestReg, WindowHandle)
else
    gen_rectangle1 (TestReg, 376, 221, 466, 246)
endif
* Calculate the histogram of two-channel gray value images
histo_2dim (TestReg, SSMed, EEMed, Histo2Dim)
threshold (Histo2Dim, RegionFeat, 3, 1000000)
fill_up (RegionFeat, RegionFillUpFeat)
opening_circle (RegionFillUpFeat, FeatOpen, 1.5)
dilation_circle (FeatOpen, FeatureSpace, 1.5)
* Segment an image
class_2dim_sup (SSMed, EEMed, FeatureSpace, RegionClass)
opening_circle (RegionClass, ResultClass2, 3.5)
dev_set_color ('red')
dev_set_draw ('margin')
dev_display (MreutHill)
dev_display (ResultClass2)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* Continue to view textured areas
threshold (SSMed, RegionThre, 35, 255)
connection (RegionThre, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 150.000000, 99999.000000)
closing_circle (SelectedRegions, ResultClass1, 3.5)
dev_display (MreutHill)
dev_display (ResultClass1)


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接

Powered By Z-BlogPHP 1.7.3

Copyright www.skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864