【issue-halcon例程学习】lines_gauss.hdev

例程功能

代码如下

复制代码
dev_close_window ()
read_image (Angio, 'angio-part')
get_image_size (Angio, Width, Height)
dev_open_window (0, 0, 3 * Width / 2, 3 * Height / 2, 'black', WindowID)
dev_display (Angio)
dev_set_color ('blue')
MaxLineWidth := 8
Contrast := 12
calculate_lines_gauss_parameters (MaxLineWidth, [Contrast,0], Sigma, Low, High)
lines_gauss (Angio, Lines, Sigma, Low, High, 'dark', 'true', 'parabolic', 'true')
count_obj (Lines, Number)
dev_update_pc ('off')
dev_update_var ('off')
for I := 1 to Number by 1
    select_obj (Lines, Line, I)
    get_contour_xld (Line, Row, Col)
    get_contour_attrib_xld (Line, 'angle', Angle)
    get_contour_attrib_xld (Line, 'width_left', WidthL)
    get_contour_attrib_xld (Line, 'width_right', WidthR)
    * To display the lines, the point at which the gray value drops to
    * 25% of the contrast between the line and the background will be
    * displayed.  This point is given by sqrt(3/4) for the parabolic
    * line model.
    RowR := Row + cos(Angle) * WidthR * sqrt(0.75)
    ColR := Col + sin(Angle) * WidthR * sqrt(0.75)
    RowL := Row - cos(Angle) * WidthL * sqrt(0.75)
    ColL := Col - sin(Angle) * WidthL * sqrt(0.75)
    dev_set_color ('red')
    dev_display (Line)
    dev_set_color ('green')
    disp_polygon (WindowID, RowL, ColL)
    disp_polygon (WindowID, RowR, ColR)
endfor

要求

  1. calculate_lines_gauss_parameters ------ 计算lines_gauss所需的参数SigmaLowHigh
    MaxLineWidth :入参,提取线的对比度。可传一个值,也可以用含两个值的数组作为参数传入,这样做第二个值决定了最小对比度,因此值必须比第一个值小;
    Sigma :出参,作为lines_gauss算子的入参;
    Low :出参,作为lines_gauss算子的入参;
    High :出参,作为lines_gauss算子的入参;
  2. lines_gauss ------ 检测线及其宽度;
    Image :入参,待检测图片;
    Lines :出参,作为lines_gauss算子的入参;
    Sigma :入参,高斯平滑参数;
    Low :入参,滞后阈值操作的下阈值;
    High :入参,滞后阈值操作的上阈值;
    LightDark :入参,决定提取亮线还是暗线('light'/'dark');
    ExtractWidth :入参,决定线宽是否被提取('true'/'false');
    LineModel :入参,优化线位置和宽度的模型;
    CompleteJunctions :入参,决定连接处是否补齐(猜的);
相关推荐
YJlio18 小时前
ZoomIt 学习笔记(11.11):休息计时器与演讲节奏控制——倒计时、番茄钟与现场掌控力
数据库·笔记·学习
山土成旧客18 小时前
【Python学习打卡-Day23】从重复到重用:用Pipeline和ColumnTransformer重构你的机器学习工作流
python·学习·重构
TL滕18 小时前
从0开始学算法——第十九天(并查集)
笔记·学习·算法
Cuby!19 小时前
IEEE Wireless Communications 2025年论文整理2(中英文摘要)
论文阅读·学习·信息与通信
白帽子黑客杰哥19 小时前
零基础学习网络安全,如何安排每天的学习计划?需要重点攻克哪些核心技能点?
学习·安全·web安全·渗透测试·人才培养·网络安全培训
YJlio19 小时前
ZoomIt 学习笔记(11.10):键入模式——在桌面上直接打字讲解的最佳实践
服务器·笔记·学习
小智RE0-走在路上19 小时前
Python学习笔记(5)--函数
笔记·python·学习
d111111111d19 小时前
C语言中union(共同体)的特电是什么?STM32中常用于处理什么数据?
c语言·arm开发·笔记·stm32·单片机·嵌入式硬件·学习
阿蒙Amon19 小时前
JavaScript学习笔记:18.继承与原型链
javascript·笔记·学习
●VON19 小时前
小V健身助手开发手记(基于界面设计的深度复盘)
学习·openharmony·开源鸿蒙·von