combine_roads_xld(EdgePolygons, ModParallels, ExtParallels, CenterLines : RoadSides : MaxAngleParallel, MaxAngleColinear, MaxDistanceParallel, MaxDistanceColinear : )
combine_roads_xld结合了从两个不同分辨率级别获得的道路假设。
该算法只选择在两个分辨率水平上相互支持的假设。
参数EdgePolygons、ModParallels和ExtParallels对应于最高分辨率水平的道路假设。
参数CenterLines是低分辨率道路提取的结果。
这些多边形EdgePolygons返回的迹象是在两个分辨率级别的道路。
参数MaxAngleParallel和MaxAngleColinear分别决定由两个平行共线线段构成的角度。
参数MaxDistanceParallel和maxdistancecolar分别决定两个并行或共线线段的最大允许距离。
这个组合使用了许多规则。
下面是halcon自带的例程,提取公路中心
dev_update_off ()
dev_close_window ()
dev_close_window ()
read_image (Image, 'mreut4_3')
threshold (Image, Region, 160, 255)
reduce_domain (Image, Region, ImageReduced)
MaxLineWidth := 5
Contrast := 70
calculate_lines_gauss_parameters (MaxLineWidth, Contrast, Sigma, Low, High)
lines_gauss (ImageReduced, RoadCenters, Sigma, Low, High, 'light', 'true', 'bar-shaped', 'true')
read_image (ImagePart, 'mreut_y')
get_image_size (ImagePart, PartWidth, PartHeight)
edges_image (ImagePart, PartAmp, PartDir, 'mderiche2', 0.3, 'nms', 20, 40)
threshold (PartAmp, EdgeRegion, 1, 255)
clip_region (EdgeRegion, ClippedEdges, 2, 2, PartWidth - 3, PartHeight - 3)
skeleton (ClippedEdges, EdgeSkeleton)
gen_contours_skeleton_xld (EdgeSkeleton, EdgeContours, 1, 'filter')
gen_polygons_xld (EdgeContours, EdgePolygons, 'ramer', 2)
gen_parallels_xld (EdgePolygons, ParallelEdges, 10, 30, 0.15, 'true')
mod_parallels_xld (ParallelEdges, ImagePart, ModParallelEdges, ExtParallelEdges, 0.3, 160, 220, 10)
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_scale (HomMat2DIdentity, 8, 8, 0, 0, HomMat2DScale)
hom_mat2d_translate (HomMat2DScale, -250, -600, HomMat2DTranslate)
affine_trans_contour_xld (RoadCenters, ScaledRoadCenters, HomMat2DTranslate)
clip_contours_xld (ScaledRoadCenters, ClippedRoadCenters, 0, 0, 512, 512)
gen_polygons_xld (ClippedRoadCenters, RoadCenterPolygons, 'ramer', 2)
combine_roads_xld (EdgePolygons, ModParallelEdges, ExtParallelEdges, RoadCenterPolygons, RoadSides, rad(40), rad(20), 40, 40)
stop()
dev_open_window (0, PartWidth + 10, 512, 512, 'black', WindowHandle2)
dev_set_line_width (2)
dev_set_color ('green')
dev_display (ImagePart)
dev_display (RoadSides)
dev_display (EdgePolygons)
dev_set_color ('orange')
dev_display (ExtParallelEdges)
dev_set_color ('red')
dev_display (RoadCenterPolygons)
|