Halcon - 获取世界坐标中的区域面积

Halcon - get area of region in world coordinates

我有以下代码:

image_points_to_world_plane (CamParam, Pose, intersection_points_row, intersection_points_col, 'mm', X1, Y1)
distance_pp (X1[2], Y1[2], X1[3], Y1[3], Measure1)

此代码以毫米为单位返回值。

现在代码如下所示,我需要以 mm² 为单位的 Regions1 面积。相反,我以像素为单位获取它们..

access_channel(Image, ImageMono, 1)

threshold(ImageMono, Region, 0, 100)
fill_up(Region, RegionFillUp)

reduce_domain(ImageMono, RegionFillUp, ImageReduced)

threshold (ImageReduced, Regions1, 230, 255)
connection (Regions1, Connection)
select_shape(Connection, Labels, 'area', 'and', 2000, 99999)
area_center(Labels, AreaLabels, RowLabels, ColumnLabels)

AreaLabels 以 px² 为单位,我需要以 mm² 为单位。但找不到类似 region_to_world_plane 的东西...这怎么办?

尝试查看运算符 "image_to_world_plane"。它将转换图像,使像素大小以公制单位(或您喜欢的任何单位)为单位。它还会扭曲图像,使其看起来像是直接从头顶拍摄的。然后,您在此转换后的图像上执行的任何面积计算都将采用您指定的单位(mm、m 等)。