Halcom 发表于 2020-2-22 12:01:45

仿射变换:水平矫正

仿射变换:水平矫正,本例用于分析wafer的倾斜角度,wafer晶圆是一类特殊结构的obj;
* 使用text_line_orientation算法矫正wafer角度
*
dev_update_off ()
dev_close_window ()
read_image (Image, 'wafer/wafer_rotated')
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
set_display_font (WindowHandle, 10, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_display(Image)
*
* 初始化旋转中心
RotCenterRow := 360.13
RotCenterCol := 359.99
gen_cross_contour_xld (Cross, RotCenterCol, RotCenterCol, 20, 0.785398)
gen_rectangle1 (Rectangle, RotCenterRow - 55, RotCenterCol - 300, RotCenterRow + 55, RotCenterCol + 300)
*
* 使用text_line_orientation算法矫正wafer角度
reduce_domain (Image, Rectangle, ImageReduced)
text_line_orientation (Rectangle, ImageReduced, 25, rad(-30), rad(30), OrientationAngle)
Angle := -deg(OrientationAngle)
* correct the alignment
rotate_image (Image, ImageRotate, Angle, 'constant')
*
* Display the results
dev_clear_window ()
dev_display (ImageRotate)
dev_display (Cross)
disp_message (WindowHandle, 'The wafer must be rotated by ' + Angle .2f' + '° \nto be correctly aligned', 'window', 12, 12, 'black', 'true')


参考:
【1】频域自相关变换
【2】仿射变换hom_mat2d_identity

页: [1]
查看完整版本: 仿射变换:水平矫正