Halcon提取中心线

Halcon中roads.hdev的学习标注及与之相关的提取中心线

* This example demonstrates how to extract roads from an aerial
* image.
* For the road extraction it is assumed that a road consists of
* two parallel edges with homogeneous gray values and a line
* segment in between.
* First the road centers in an aerial image are extracted. Then
* a second image showing a zoomed part of the first aerial image
* is read and successively the contours of the road edges,
* parallel road edges and the road centers in the second image are
* determined. At the end these road hypotheses are combined and
* the road sides in the image are extracted.
* 
* 
*定义程序执行打开和关闭期间,图像对象是否在图形窗口中显示
*将dev_update_pc,dev_update_var和dev_update窗口切换到“关闭”。
*一般dev_update_off放在开始,dev_update_on放在程序结束
dev_update_off ()
dev_close_window ()
dev_close_window ()
* 
* Read an aerial image
read_image (Image, 'mreut4_3')
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle1)
set_display_font (WindowHandle1, 16, 'mono', 'true', 'false')
dev_display (Image)
disp_message (WindowHandle1, 'Extract the roads from an aerial image', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle1, 'black', 'true')
stop ()
* 
* Segment the image and reduce the domain
*reduce_domain ( Image, Region : ImageReduced : : ) 
*其中,Image是输入的图像;Region是输入的区域;ImageReduced是输出的图像,是Image中Region的那部分图像。
*通过reduce_domain确实能获得特定区域Region位置的图像,但是,reduce_domain是缩小一个图像的定义域,并不缩小图像的实际尺寸,
*即新图像ImageReduced尺寸大小并未发生变化。如果使用get_image_size来计算ImageReduced图像的尺寸,其尺寸和 原图Image一样。
threshold (Image, Region, 160, 255)
reduce_domain (Image, Region, ImageReduced)
* 
* Detect the lines that represent the road centers
*MaxLineWidth (input_control) : lines_gauss要提取线条的最大宽度
*对于参数Contrast 需要说明的是,如果只选择一个值时,最小对比度将会默认为最大对比度的1/3,
*最小对比度越小,线条将会延伸到对比度较低的区域,即线条越长。反之,值越高,线条越短,但越突出。
*lines_gauss 主要功能是提取图像上的线条,提取的结果属于亚像素精度的XLD轮廓
*深入了解改算子请自行百度halcon lines_gauss算子详解:https://blog.csdn.net/qq_18620653/article/details/105446922
MaxLineWidth := 5
Contrast := 70
calculate_lines_gauss_parameters (MaxLineWidth, Contrast, Sigma, Low, High)
lines_gauss (ImageRe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值