Edge Extraction (subpixel Precise)

摘要:
标准操作基于一阶导数,输入图像并输出XLD轮廓。当我们使用二阶导数时,我们有一个拉普拉斯运算。此外,HALCON提供了最先进的颜色边缘提取。提取边缘轮廓最常见的操作是edges_Pix,您可以通过过滤器参数选择不同的过滤操作;常用值“canny”、“lanesr2”和“lanser2”的优点当使用大平滑时,处理时间不会增加得更快。一个参数是“sobel”_“Fast”,这张图片没有噪音。
Basic Concept
 
Edge Extraction (subpixel Precise)第1张
 
Extended Concept
Edge Extraction (subpixel Precise)第2张
 
 
Extract Edges or Lines
 
HALCON offers various operators for the subpixel-accurate extraction of contours. The standard oper-
ator is based on the first derivative. It takes the image as input and returns the XLD contours. When
using the second derivatives, first a Laplace operator must be executed before the contours along the
zero crossings can be extracted. Besides the gray-value-based methods, HALCON provides the latest
technology for the extraction of color edges.

Besides the extraction of edges, HALCON provides operators for the extraction of lines. In other systems
lines are also called ridges. In contrast to edges, a line consists of two gray value transitions. Thus, a line
can be considered as two parallel edges
 
HALCON 为亚像素轮廓提取提供了多种运算。
标准的运算是基于一阶导数,输入一幅图像输出一个XLD 轮廓。
当用二阶导数是,拉普拉斯运算。
除此之外,HALCON提供最先进的 提取颜色边缘。
 
最常用的提取边缘轮廓的操作是 edges_sub_pix ,  你可以通过 filter 参数选择不同的滤波操作;
常用的值 'canny'(基于高斯卷积)    ' lanesr2'
‘lanser2’的优点 当用大的平滑的时候,处理时间上没有增加
更快的一个参数是 ‘sobel_fast’,这个图片无噪声用。
 
zero_crossing_sub_pix 可以结合 像 derivate_gauss 参数为 ’laplace’. 使用 laplace 主要用在医学领域
 
最普遍的 线条提取运算是 lines_gauss.和lines_facet 相比更robust更灵活
提取线条的宽度 通过sigma 参数指定 对于很宽的线条我们可以通过 zoom_image_factor 减少运算时间
像提取边缘一样,halcon同样支持 lines_color
 
 
Determine Contour Attributes

The edge and line extraction operators not only provide the XLD contours but also so-called attributes.
Attributes are numerical values; they are associated either with each control point of the contour
(called contour attribute) or with each contour as a whole (global contour attribute). The operators
get_contour_attrib_xld and get_contour_global_attrib_xld enable you to access these val-
ues by specifying the attribute name.
The attribute values are returned as tuples of numbers. Typical attributes for edges are, e.g., the edge am-
plitude and direction. For lines a typical attribute is the line width. The available attributes can be queried
for a given contour with query_contour_attribs_xld and query_contour_global_attribs_xld.
 
 
例子 检测汽车轮子的钻孔Example: solution_guide/basics/rim_simple.hdev
Edge Extraction (subpixel Precise)第3张
图1
Edge Extraction (subpixel Precise)第4张
***************************************************
* 1. 二值化 得到包含钻孔的区域(该区域不只含钻孔还有很多其他)
* 2. 用特征直方图 根据 area circularity  得到只含钻孔的区域
* 3.对该区域做boundary 操作 消除内部 只留边缘
* 4.对边缘做膨化
* 5.获取边缘区域的图像 做边缘检测得到边缘轮廓
* 6.fit_ellipse_contour_xld 对轮廓做椭圆适配操作,得到 钻孔的属性特征(因为得到的钻孔轮廓可能不圆,当然也可以用 圆适配替代椭圆适配)
* 7.gen_ellipse_contour_xld生成钻孔边缘
* 关于XLD的知识点后面章节介绍
**************************************************
dev_update_window('off')
dev_update_pc('off')
dev_update_var('off')

read_image(Image,'rim')
get_image_size(Image,Width,Height)

dev_close_window()
dev_open_window(0,0,Width,Height,'black',WindowHandle)

threshold (Image, Dark, 3, 128)

connection(Dark,DarkRegions)

select_shape (DarkRegions, Circles, ['area','circularity'], 'and', [50,0.85], [9999,1])

* 作用如图1所示
boundary(Circles,RegionBorder,'inner')

dilation_circle(RegionBorder,RegionDiation,6.5)

union1(RegionDiation,ROIEdges)

reduce_domain(Image,ROIEdges,ImageROI)

edges_sub_pix(ImageROI,Edges,'lanser2',0.3,10,30)

fit_ellipse_contour_xld (Edges, 'fhuber', -1, 0, 0, 200, 3, 2, Row, Column, Phi, Ra, Rb, StartPhi, EndPhi, PointOrder)

NumHoles :=|Ra|

*gen_tuple_const(NumHoles,'positive') 生成一个const 数组
gen_ellipse_contour_xld (ContEllipse, Row, Column, Phi, Ra, Rb, StartPhi, \
                         EndPhi,gen_tuple_const(NumHoles,'positive'), 1.5)
for i := 0 to NumHoles-1 by 1
    sinPhi := sin(Phi[i])
    cosPhi := cos(Phi[i])
    disp_arrow (WindowHandle, Row[i], Column[i], Row[i] - sinPhi*Ra[i], Column[i] + cosPhi*Ra[i], 1)
    disp_arrow (WindowHandle, Row[i], Column[i], Row[i] - cosPhi*Rb[i], Column[i] - sinPhi*Rb[i], 1)
    disp_arrow (WindowHandle, Row[i], Column[i], Row[i] + sinPhi*Ra[i], Column[i] - cosPhi*Ra[i], 1)
    disp_arrow (WindowHandle, Row[i], Column[i], Row[i] + cosPhi*Rb[i], Column[i] + sinPhi*Rb[i], 1)
    set_tposition (WindowHandle, Row[i] - Rb[i] - 50, Column[i] - 85)
    write_string (WindowHandle, 'D1=' + 2*Ra[i])
    set_tposition (WindowHandle, Row[i] - Rb[i] - 30, Column[i] - 85)
    write_string (WindowHandle, 'D2=' + 2*Rb[i])
endfor
 
 
 
例子 提取心脏血管 -- X光图像
Example: hdevelop/Filters/Lines/lines_gauss.hdev
Edge Extraction (subpixel Precise)第5张
 
图1
Edge Extraction (subpixel Precise)第6张
 
图2
Edge Extraction (subpixel Precise)第7张
 
*********************************************************
*    lines_gauss(Image : Lines : Sigma, Low, High,
*                LightDark,  *提取的是 dark 还是light
*                 ExtractWidth,  *是否提取线宽
*                 LineModel,  *'none', 'bar-shaped', 'parabolic', 'gaussian'  本例中用到'parabolic'(抛物线)
*                CompleteJunctions : )  * 是否提取交叉点 如图2的交叉点
*
*
*     sigma -- 如果太小 则血管提取的将会比较窄
*    Low, High, 用于消除一些无关紧要的线条 如图1
*
*  思路:用lines_gauss 提取血管中心线条,get_contour_xld(Line,Row,Col) 得到线条的点坐标
*  get_contour_attrib_xld 获取线条属性
*  disp_polygon 显示血管轮廓
*
*  threshold_sub_pix 在对比明显的情况下使用
*********************************************************
 
dev_close_window()
read_image (Angio, 'angio-part')
get_image_size(Angio,Width,Height)
dev_open_window (0, 0, Width,Height, 'black', WindowID)
dev_display(Angio)
lines_gauss (Angio, Lines, 2, 0, 1, 'dark', 'true', 'parabolic', 'true')

count_obj(Lines,Number)

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)
    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
 
 
Alternatives to Edge Extraction (Subpixel-Precise)

Subpixel Thresholding
Besides the subpixel-accurate edge and line extractors, HALCON provides a subpixel-accurate thresh-
old operator called threshold_sub_pix. If the illumination conditions are stable, this can be a fast
alternative.
Subpixel Point Extraction
In addition to the contour-based subpixel-accurate data, HALCON offers subpixel-accurate point opera-
tors for various applications. In the reference manual, these operators can be found in the chapter “Filters
. Points”
 
 
 
 



通过 Wiz 发布



免责声明:文章转载自《Edge Extraction (subpixel Precise)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C# 中使用JSON解决ubuntu中JDK的Picked up JAVA_TOOL_OPTIONS提示问题。下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Ubuntu下qemu环境搭建vexpress开发平台

在查找资料过程中,发现自己搭建虚拟的arm环境的话,有一个比较好的软件就是qemu了,当然还有其他的,大家各投所好就好。 接下来说一下qemu环境搭建过程。 其实搭建很简单,作为小白,我还是捣鼓了两三天才真正的安装成功,正在尝试着怎么使用。 上篇已经讲了安装Ubuntu系统后root密码的设置,这里就要用到root密码进行软件安装了。 可以在命令行模式下先...

Linux音频编程

虽然目前Linux的优势主要体现在网络服务方面,但事实上同样也有着非常丰富的媒体功能,本文就是以多媒体应用中最基本的声音为对象,介绍如何在Linux平台下开发实际的音频应用程序,同时还给出了一些常用的音频编程框架。 一、数字音频 音频信号是一种连续变化的模拟信号,但计算机只能处理和记录二进制的数字信号,由自然音源得到的音频信号必须经过一定的变换,成为数字音...

偏执的iOS逆向研究员:收集全版本的macOS iOS+越狱+内核调试

Intro 虽然“只有偏执狂才能够生存”这句话已经被假药停给毁了,但是作为一只有逼格的高大上的iOS逆向分析研究员,难道如果有现成的macOS/iOS全版本镜像可以下载并且无限“漫游”,难道你就不想来一套么? 在本文中,你将能够获得的是: macOS:10.12、10.11、10.10、10.9、10.8、10.7:六个版本的虚拟机一键安装; 使用苹果的...

小白自制Linux开发板 七. USB驱动配置

本文章基于https://whycan.com/t_3087.htmlhttps://whycan.com/t_6021.html整理 F1c100s芯片支持USB的OTG模式,也就是可以通过更改UsbId拉低或拉高方式定义当前的开发板可以作为host还是device。 usbid 拉高时,开发板作为外设方式。 usbid 拉低时,开发板作为主机方式。...

mount(挂载)

拷贝文件到优盘 sdcm@sdcm:/mnt$sudo fdisk -l Disk /dev/sdc: 15.5 GB, 15529279488 bytes255 heads, 63 sectors/track, 1887 cylinders, total 30330624 sectorsUnits = sectors of 1 * 512 = 512 b...

linux nand flash常用命令

使用命令前用cat /proc/mtd 查看一下mtdchar字符设备;或者用ls -l /dev/mtd*#cat /proc/mtddev: size erasesize namemtd0: 00c00000 00020000 “ROOTFS”mtd1: 00200000 00020000 “BOOTLOADER”mtd2: 00200000 0002...