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 @ 2023-09-20 14:08  QuincyYi  阅读(454)  评论(0编辑  收藏  举报