Region与XLD相互转换

一、预备知识:类型介绍    5

1、    Image类型:    5

2、    Region类型:    5

3、    XLD分为两种:边缘轮廓(xld contour)和多边形(xld polygon)    5

1)    、XLD Contour    5

2)    、XLD Polygon    5

二、转换规律:    5

三、转换算子    5

1、gen_region_contour_xld(Contour : Region : Mode : )    5

2、gen_region_polygon_xld(Polygon : Region : Mode : )    5

3、gen_contour_region_xld(Regions : Contours : Mode : )    5

4、gen_polygons_xld(Contours : Polygons : TypeAlpha : )    5

5、gen_contours_skeleton_xld(Skeleton : Contours : LengthMode : )    5

 

一、预备知识:类型介绍

Halcon中的图形变量主要有Image类型、Region类型、XLD类型。

  1. Image类型:

    read_image (Image, 'fabrik')

  2. Region类型:

    draw_region (Region, 3600)

  3. XLD分为两种:边缘轮廓(xld contour)和多边形(xld polygon)
    1. 、XLD Contour

    draw_xld (ContOut, 3600, 'true', 'true', 'true', 'true')

    1. 、XLD Polygon

      *绘制XLD

      draw_xld (ContOut, 3600, 'true', 'true', 'true', 'true')

      *用多边形逼近XLD

      gen_polygons_xld (ContOut, Polygons, 'ramer', 2)

       

二、转换规律:

Halcon对象之间的相互转换,一般可以转化为"gen_目标对象_原对象"形式,路gen_region_contour_xld(根据xld创建一个区域region);再如gen_contour_region_xld(根据region创建一个xld轮廓)

三、转换算子

1、gen_region_contour_xld(Contour : Region : Mode : )

    根据轮廓xld创建一个区域region

    read_image(Image,'lena')

draw_xld (XLD1, 3600, 'true', 'true', 'true', 'true')

 

gen_region_contour_xld (XLD1, Region, 'filled')

2、gen_region_polygon_xld(Polygon : Region : Mode : )

    功能:根据多边形轮廓创建一个区域region

    read_image(Image,'lena')

draw_xld (XLD1, 3600, 'true', 'true', 'true', 'true')

gen_polygons_xld (XLD1, Polygons, 'ramer', 2)//用多边形逼近XLD轮廓, Polygons为XLD Polygon类型

 

gen_region_polygon_xld (Polygons, Region, 'filled')

3、gen_contour_region_xld(Regions : Contours : Mode : )

    功能:根据region创建一个xld

    read_image(Image,'lena')

draw_region (Region, 3600)

 

gen_contour_region_xld (Region, XLD1, 'border')

 

4、gen_polygons_xld(Contours : Polygons : TypeAlpha : )

    功能:用多边形逼近XLD轮廓

       Contours:输入要逼近的轮廓

       Polygons:输出逼近的多边形

       Type:逼近模式

       Alpha:逼近阈值

    例子:

*绘制XLD

draw_xld (ContOut, 3600, 'true', 'true', 'true', 'true')

*用多边形逼近XLD

gen_polygons_xld (ContOut, Polygons, 'ramer', 2)

 

 

5、gen_contours_skeleton_xld(Skeleton : Contours : LengthMode : )

    功能:把骨架转换层xld轮廓

posted @   QuincyYi  阅读(839)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律

喜欢请打赏

扫描二维码打赏

了解更多

点击右上角即可分享
微信分享提示