halcon----图像矫正


dev_update_off ()
dev_close_window ()

read_image (Image_slanted, 'datacode/ecc200/ecc200_to_preprocess_001')
dev_open_window_fit_image (Image_slanted, 0, 0, -1, -1, WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_color ('green')
dev_set_line_width (3)
Message := 'This program demonstrates how to preprocess'
Message[1] := 'a slanted 2d data code with rectification'
Message[2] := 'before reading the data code symbol.'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()

XCoordCorners := [130,225,290,63]
YCoordCorners := [101,96,289,269]


gen_cross_contour_xld (Crosses, XCoordCorners, YCoordCorners, 6, 0.785398)
dev_display (Image_slanted)
dev_display (Crosses)
disp_message (WindowHandle, 'Slanted image', 'window', 12, 12, 'black', 'true')
Message := 'The marked corners are used to generate a'
Message[1] := 'homogeneous transformation matrix which'
Message[2] := 'defines the projective transformation for'
Message[3] := 'the rectification of the symbol.'
disp_message (WindowHandle, Message, 'window', 380, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
 

hom_vector_to_proj_hom_mat2d (XCoordCorners, YCoordCorners, [1,1,1,1], [70,270,270,70], [100,100,300,300], [1,1,1,1], 'normalized_dlt', HomMat2D)


projective_trans_image (Image_slanted, Image_rectified, HomMat2D, 'bilinear', 'false', 'false')


create_data_code_2d_model ('Data Matrix ECC 200', [], [], DataCodeHandle)
find_data_code_2d (Image_rectified, SymbolXLDs, DataCodeHandle, [], [], ResultHandles, DecodedDataStrings)


dev_display (Image_slanted)
dev_display (Image_rectified)
dev_display (SymbolXLDs)
disp_message (WindowHandle, 'Decoding successful ', 'window', 12, 12, 'black', 'true')
set_display_font (WindowHandle, 12, 'mono', 'true', 'false')
disp_message (WindowHandle, DecodedDataStrings, 'window', 350, 70, 'forest green', 'true')

在这里插入图片描述在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值