halcon識別斜著的車牌

2021-10-06 06:00:32 字數 1900 閱讀 3135

對於傾斜的車牌,我們必須用仿射變換,將車牌弄正,再進行識別。如圖

*定位orientation_region (regiontrans, phi)

area_center (regiontrans, area, row, column)

*仿射變換

vector_angle_to_rigid (row, column, phi, row, column, -0.1, hommat2d)

affine_trans_image (image666, imageaffintrans, hommat2d, 'constant', 'false')

affine_trans_region (regiontrans, regionaffinetrans, hommat2d, 'nearest_neighbor')

*擷取reduce_domain (imageaffintrans, regionaffinetrans, imagereduced)

*分割rgb1_to_gray (imagereduced, grayimage)

invert_image (grayimage, imageinvert1)

threshold (grayimage, regions1, 174, 231)

opening_rectangle1 (regions1, regionopening1, 5, 5)

fill_up (regionopening1, regionfillup1)

connection (regionfillup1, connectedregions1)

select_shape (connectedregions1, selectedregions, ['area','height','width'], 'and', [702.75,27.982,29.266], [1697.25,90.367,70.917])

sort_region (selectedregions, sortedregions, 'character', 'true', 'column')

read_ocr_class_mlp ('industrial_0-9a-z_norej.omc', ocrhandle)

do_ocr_multi_class_mlp (sortedregions, imageinvert1, ocrhandle, class, confidence)

參考程式基本類似,只是在二值化後多了union與膨脹操作,具體問題具體分析

參考:

Halcon 識別車牌學習筆記

有一張車牌 如下 c users lizhiqiang desktop 車牌2.jpg 讀取 rgb1 to gray image,grayimage 轉化成灰度影象 設定閾值 connection regions,connectedregions 斷開區域 根據特徵選中車牌號 sort regio...

halcon機器視覺玩轉車牌識別

1採集影象 read image image,c users administrator desktop 車牌.jpg dev close window dev open window 0,0,512,512,black windowhandle dev display image 2預處理之車牌定...

halcon機器視覺玩轉車牌識別 超人視覺羅超

1採集影象 read image image,c users administrator desktop 車牌.jpg dev close window dev open window 0,0,512,512,black windowhandle dev display image 2預處理之車牌定...