【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 :入参,决定连接处是否补齐(猜的);
相关推荐
red_redemption1 小时前
自由学习记录(87)
学习
咸甜适中2 小时前
rust语言 (1.88) egui (0.32.1) 学习笔记(逐行注释)(十五)网格布局
笔记·学习·rust·egui
Duo1J5 小时前
【OpenGL】LearnOpenGL学习笔记15 - 面剔除
笔记·学习·图形渲染
C语言不精7 小时前
合宙780E开发学习-Lua语法学习
学习·junit·lua
壹Y.13 小时前
非线性规划学习笔记
学习·数学建模
项目題供诗14 小时前
React学习(十二)
javascript·学习·react.js
艾莉丝努力练剑14 小时前
【C语言16天强化训练】从基础入门到进阶:Day 7
java·c语言·学习·算法
自强的小白15 小时前
学习Java24天
java·学习
SalvoGao17 小时前
空转学习 | cell-level 与 spot-level的区别
人工智能·深度学习·学习
Magnetic_h19 小时前
【iOS】SDWebImage第三方库源码学习笔记
笔记·学习·ios·objective-c·cocoa