熟悉halcon助手的操作,利用助手快速完成几何测量和车牌识别。
一、测量
为了每次只用一个固定的测量线段进行测量,对于每次来的不同方向的图片先做放射变换进行校正并移到图像中心位置处进行测量。
read_image (Image, '1.jpg')
get_image_size (Image, Width, Height)
rgb1_to_gray (Image, GrayImage)
*二值化
binary_threshold (GrayImage, Region, 'max_separability', 'dark', UsedThreshold)
*反转图像,即用255去减原来像素
invert_image (GrayImage, ImageInvert)
*计算方向角度
orientation_region (Region, Phi)
*计算面积和中心坐标
area_center (Region, Area, Row, Column)
*变换矩阵,每次将图片校正并移到图像中心位置
vector_angle_to_rigid (Row, Column, Phi, Height/2, Width/2, 0, HomMat2D)
*放射变换
affine_trans_image (ImageInvert, ImageAffinTrans, HomMat2D, 'constant', 'false')
运行结果如下: