保存
我最近在做的一个缺陷检测项目,需要将杯子的杯壁展开。我参考了halcon的grid_rectification.hdev例子,但是我怎么设置参数也不能将整个杯壁展开,求路过的大神教一教。
这是我写的代码,只能成功一个角。
read_image (Image, '图像2.jpg')
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width/3, Height/3, 'black', WindowHandle)
dev_display (Image)
* create_rectification_grid (0.01, 9, 'rectification_grid.ps')
rgb1_to_gray (Image, GrayImage)
decompose3 (Image, R, G, B)
* trans_from_rgb (R, G, B, H, S, V, 'hsv')
find_rectification_grid (R, GridRegion, 5, 15)
reduce_domain (R, GridRegion, ImageReduced)
saddle_points_sub_pix (ImageReduced, 'facet', 2, 1, Row, Column)
*显示
gen_cross_contour_xld (Crosses, Row, Column, 48, 0.785398)
* dev_display (Image)
* dev_display (Crosses)
* stop()
connect_grid_points (ImageReduced, ConnectingLines, Row, Column, 0.7, 15)
dev_clear_window ()
dev_display (ConnectingLines)
stop()
gen_grid_rectification_map (ImageReduced, ConnectingLines, Map, Meshes, 30, 0, Row, Column, 'bilinear')
map_image (ImageReduced, Map, ImageMapped)