halcon-Edge Extraction边缘提取.docx_第1页
halcon-Edge Extraction边缘提取.docx_第2页
halcon-Edge Extraction边缘提取.docx_第3页
halcon-Edge Extraction边缘提取.docx_第4页
halcon-Edge Extraction边缘提取.docx_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Edge Extraction - 边缘提取楼主#更多发布于:2013-11-06 12:09以下内容来自 826工作室 小马老师提供!1. 一般过程* sobel_amp(Image:EdgeAmplitude:FilterType,Size: )* 不能完全排除虚假边缘,检测出的结果容易出现多像素边缘* sobel算子由两个卷积核组成* a =1 2 10 0 0-1 -2 -1b =1 0 -12 0 -21 0 -1EdgeAmplitudeoutput - 边缘强度图像FilterType sum_sqrt sqrt(a2 + b2) / 4sum_abs (|a| + |b|) / 4thin_sum_abs (thin(|a|) + thin(|b|) / 4thin_max_abs max(thin(|a|),thin(|b|) / 4x b / 4y a / 4*一个简单的例子dev_close_window()read_image(Image,fuse)get_image_size(Image,Width,Height)dev_open_window(0,0,Width,Height,black,WindowHandle)*sobel 算子sobel_amp(Image,EdgeAmplitude,thin_sum_abs,3)*二值threshold(EdgeAmplitude,Region,30,255)*骨骼化 - 去掉多像素边缘skeleton(Region,Skeleton)Filter ImageHALCON offers a wide range of edge lters. One of the most popular lters is the Sobel lter. Thisis the best of the old-fashioned lters. It combines speed with a reasonable quality. The correspondingoperators are called sobel_amp and sobel_dir.In contrast, edges_image provides the state of the art of edge lters. This operator is actually morethan just a lter. It includes a thinning of the edges using a non-maximum suppression and a hysteresisthreshold for the selection of signicant edge points. It also returns the edge direction and the edgeamplitude very accurately, which is not the case with the Sobel lter. This operator is recommended ifhigher quality is more important than a longer execution time. If the images are not noisy or blurred,you can even combine accuracy and speed by using the mode sobel_fast inside edges_image. Thecorresponding operator to nd edges in multi-channel images, e.g., a color image, is edges_color.HALCON 提供广泛的边缘滤波器,最著名的是sobel滤波器,它是老式滤波器中最好的,对应的运算符为sobel_amp sobel_dir.edges_image更强大,它不仅仅是滤波器,包括了 thin边缘 二值化选择有效边缘点。返回 the edge direction and the edgeamplitude ,如果图像不是很多噪声且要追求追求高质量推荐使用此运算符。sobel_fast 结合精度和速度edges_color 多通道Extract Edges 提取边缘The easiest way to extract the edges from the edge amplitude image is to apply threshold to selectpixels with a high edge amplitude. The result of this step is a region that contains all edge points. Withskeleton, these edges can be thinned to a width of one pixel. As an advanced version for threshold,hysteresis_threshold can be used to eliminate insignicant edges. A further advanced option is tocall the operator nonmax_suppression_dir before skeleton, which in difcult cases may result inmore accurate edges. Note that in order to use this operator you must have computed the edge directionimage.In contrast, the advanced lter edges_image already includes the non-maximum suppression and thehysteresis threshold. Therefore, in this case a simple threshold sufces to extract edges that are onepixel wide.If only the edge points as a region are needed, the operator inspect_shape_model can be used. Here,all steps including edge ltering, non-maximum suppression, and hysteresis thresholding are performedin one step with high efciency.最简单的方法是 对 edge amplitude 图像 应用 二值化 算则高边缘梯度的点。结果是一个包含所有边缘点的区域,用 skeleton 骨骼化边缘 成1 像素宽度。更先进的二值化方法hysteresis_threshold 可以去除无关紧要的边缘。更进一步的操作是在用 skeleton之前 先用一下nonmax_suppression_dir (它也有细化的效果,使用它的前题是 需要 Edge Dirction 图像)相对来说edges_image 包含了上述的操作,因为提取出的边缘是1像素宽度如果边缘点 仅仅是作为 region的话 ,可以用inspect_shape_model ,这个运算符包括all steps including edge ltering, non-maximum suppression, and hysteresis thresholding are performedin one step with high efciency.Process EdgeIf you want to extract the coordinates of edge segments, split_skeleton_lines is the right choice.This operator must be called for each connected component (result of connection) and returns all thecontrol points of the line segments. As an alternative, a Hough transform can be used to obtain theline segments. Here, the operators hough_lines_dir and hough_lines are available. You can alsoconvert the edge region into XLD contours by using, e.g., the operator gen_contours_skeleton_xld.The advantage of this approach is the extended set of operators offered for XLD contour processing onpage 81, e.g., for contour segmentation, feature extraction, or approximation.You can extract the regions enclosed by the edges easily using background_seg. If regions mergebecause of gaps in the edges, the operators close_edges or close_edges_length can be used inadvance to close the gaps before regions are extracted. As an alternative, morphological operators likeopening_circle can be applied to the output regions of background_seg. In general, all operatorsdescribed for the method Process Regions on page 33 can be applied here as well.一个例子 Example: solution_guide/basics/edge_segments.hdev* edges_image(Image:ImaAmp,ImaDir:Filter,* Alpha, * 平滑用的* NMS, * nonmax_suppression_dir(.,NMS,.)* Low,High: ) *hysteresis_threshold(.,Low,High,999,.)* * 低于Low的灰度值舍去 高于High的灰度值保留,中间的看情况* *read_image(Image,mreut)get_image_size(Image,Width,Height)dev_close_window()dev_open_window(0,0,Width,Height,black,WindowHandle)edges_image (Image, ImaAmp, ImaDir, canny, 1, nms, 20, 40)threshold (ImaDir, Regions,1, 255)connection(Regions,ConnectionRegions)count_obj(ConnectionRegions,Number)gen_empty_obj(XLDContours)dev_clear_window()for i :=1 to Number by 1 select_obj(ConnectionRegions,SingleEdgeObject,i) split_skeleton_lines(SingleEdgeObject,2,BeginRow,BeginCol,EndRow,EndCol) for k :=0 to |BeginRow|-1 by 1 gen_contour_polygon_xld(Contour,BeginRowk,EndRowk,BeginColk, EndColk) concat_obj(XLDContours,Contour,XLDContours) endforendfordev_display(XLDContours)一个例子 segmenting a color image* edges_color(Image:ImaAmp,ImaDir:Filter,Alpha,NMS,Low,High: )* 根据颜色来提取边缘 与 edges_image 不同的地方 如图 b c 所示,足球场 红色和绿色分开了*dev_update_window(off)dev_update_pc(off)dev_update_var(off)read_image(Imag

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论