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, 16, '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  为每个输入点生成一个十字形的XLD轮廓线。
gen_cross_contour_xld (Cross, YCoordCorners, YCoordCorners, 6, 0.785398)
dev_display (Image_slanted)
dev_display (Cross)
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')

*创建一个2D数据代码类的模型
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')
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值