二维码读取之2d_data_codes_rectify_symbol.hdev
2020-08-28 23:11
761 查看
*这个实例展示了如何读取一个经过修正的倾斜的条码
- This program demonstrates how to read a slanted
- 2d data code by preprocessing with rectification
- 关闭更新
dev_update_off ()
*关闭窗体
dev_close_window ()
*获取图像并且显示 - Get the image and display it
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.’
*显示Message
disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)
*右下角显示’Press F5 TO continue’
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
*初始化坐标 - Initialize coordinates
XCoordCorners := [130,225,290,63]
YCoordCorners := [101,96,289,269] - 显示倾斜图像四角坐标
- Display the slanted image and the corners of the symbol
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’)
*右下角显示’Press F5 TO continue’
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop () - 第一步,用条码四角现有的点生成一个从四角点到修正后的条码正方形的变换矩阵
- First generate a transformation matrix using the given points
- of the corners of the data code symbol and the corresponding points
- of a quare.
*求投影矩阵变换
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) - 通过投影变换纠正倾斜图像
- Now rectifiy the slanted image by applying the projective transformation
projective_trans_image (Image_slanted, Image_rectified, HomMat2D, ‘bilinear’, ‘false’, ‘false’) - 创建二维码读取器,并且在纠正图像中读取二维码
- Create the data code model and search
- for the data code in the rectified image
*创建一维码读取器
create_data_code_2d_model (‘Data Matrix ECC 200’, [], [], DataCodeHandle)
*读取二维码
find_data_code_2d (Image_rectified, SymbolXLDs, DataCodeHandle, [], [], ResultHandles, DecodedDataStrings) - 显示结果
- Display result
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’) - 清除句柄,释放内存
- Clear the data code model
clear_data_code_2d_model (DataCodeHandle)
相关文章推荐
- find_data_code_2d 一次性识别图片中的多个二维码
- 出现:'DataTypeEnum' : ambiguous symbol 错误怎么办?
- ZXing生成和读取条形码二维码(C#)
- 将在本地获取jqdata的数据保存为sql数据库,并读取数据的方法
- tensorflow2.0 学习笔记-利用tf.data.Dataset API读取numpy array文件
- ASP.NET实现二维码(QRCode)的创建和读取
- C++ IplImage 读取imagedata内的数据
- 如何读取XML文件生成EXCEL文件通过Data Processor in Developer Client in B2B Data Transformation...
- 使用SqlDataReader读取数据示例
- Spark读取文本文件并转换为DataFrame
- MVS同时读取多个二维码
- android Zxing二维码之读取手机二维码图片
- java J2SE游戏,2D游戏地图读取
- 接连上篇章——Dom、Dom4J、Sax、JDom、读取(解析)Xml——ampie_data.xml
- FSDataInputStream对象 读取数据
- 在不root手机的情况下读取Data目录下的文件
- SqlDataReader读取数据
- VeryCodes.Log让日志记录和读取变的更简单
- QR Data Reconstructor-kali下视频和二维码解析
- SqlDataReader读取数据的代码