Halcon 二維碼信息識別並打印

上結果:
在這裏插入圖片描述
上原圖:
在這裏插入圖片描述
上代碼:

dev_set_draw ('margin')
*不加這句,disp_message顯示中文會亂碼
set_system ('filename_encoding', 'utf8')
*創建model
create_data_code_2d_model ('QR Code', [], [], DataCodeHandle)
set_data_code_2d_param (DataCodeHandle, 'polarity', 'light_on_dark')
dev_open_window (0, 0, 800, 600, 'black', WH)
*加載二維碼圖片
read_image (Image,'D:/HalconWorkplace/img/QRCode.png')
*識別
find_data_code_2d (Image, SymbolXLDs, DataCodeHandle, 'train', 'all', ResultHandles, DecodedDataStrings)
*框選二維碼
dev_display (SymbolXLDs)
*顯示二維碼信息
disp_message (WH, DecodedDataStrings, 'window', 20, 20, 'red', 'true')
*消除句柄
clear_data_code_2d_model (DataCodeHandle)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章