halcon Fun Machine Vision license plate recognition - Superman visual Luo Chao

I Superman vision - Luo Chao: Hello everyone, directly on dry goods. I have a new perspective from the philosophy and technologies to understand, thinking my whole routine visual learning is to show from a philosophical view of the world, here I will gradually begin my first blog to show you. First we need to have a full understanding of a machine vision system, a complete machine vision system is composed of a light source, an imaging system, the image capture system (CCD / CMOS), AD conversion system, an image processing module and the decision control system. Wherein the image processing module and the decision process is divided into four steps: Acquisition - "Pretreatment -" Image Segmentation - "feature extraction to identify and display communication. Our visual processing by means of halcon platform. Pre-processing aiming four general purpose (1. gradation changes in contrast, the corresponding grayscale morphological operators such as scale_image, emaphsize, gray_ the beginning, equ_hiso_image.2 denoising, with a corresponding mean filter (mean_image) median filtering (median_image), Gaussian (gauss_image) .3. geometrical transformation (affine transformation, projection transformation. polar coordinate conversion) 4. Cutout (hand-painted or blob approximation)), then the image segmentation herein generally refers to joint three brothers (three brothers binarized, and morphological feature selection, often with three shape_trans, intersection, difference, etc.). Then I took a license plate at any angle in halcon platform is based on the rapid identification, pay attention to here is to identify, if delivered to the customer need to add UI and business logic programming. If you use other platforms, like routine, remember thinking to solve is the soul of the project, the code itself is an objective, static. Identification code on the lower plate, can take a random. If you thought the integration of this technology my philosophy and interested friends are welcome to download http://pan.baidu.com/share/link?shareid=3266393619&uk=2369503810 . I can also enter the qq group 577 303 448, or add my personal qq1269131923 combat for machine vision project has demonstrated more of this idea. * 1 image collection 



 
read_image (Image, 'C: / Users / Administrator / Desktop / plate .jpg') 
dev_close_window () 
dev_open_window (0, 0, 512, 512, 'Black', the WindowHandle) 
dev_display (Image) 
* 2 pre-positioning of the plate, Usually there are two positioning, a blob is positioned pixel blob, a match template is positioned, and the geometric transformation to positive 
 decompose3 (Image, Red, Green, Blue) 
 trans_from_rgb (Red, Green, Blue, Hue, Saturation,, Intensity, 'HSV ') 
* Note that color channel conversion is for convenience of image segmentation, i.e. license plate location, here the more common simple BLOB, the actual project needs to consider the effect of light and the like is finely adjusted to optimize 
 * binarization here is a blob license plate location
 
 threshold (Saturation, Regions, 182, 255) 
* Note opening operation I have here, this operator is flashed from the brain depending on the circumstances, that is, the philosophy I had no tricks, tricks depends on my other side moves because the noise to see a small point, so immediately think of opening operation 
* Note remove pixels immediately thought of opening operation and corrosion, increasing the pixel closing operation and expansion. Specific differences you can see I made the link, which I set out.
 
opening_rectangle1 (Regions, RegionOpening, 6,6) 
* The following idea is required to obtain the entire region, so think shape_trans, because it is a rectangle with angled rectangle2 
shape_trans (RegionOpening, RegionTrans, 'rectangle2') 
* next seek angles and center of the region, to facilitate the imitation shot conversion to positive 
orientation_region (RegionTrans, Phi) 
area_center (RegionTrans, Area, Row, Column) 
* start solving the rotation matrix affine transformation, the point to note here is to go 180 degrees or 0 degrees, you need to pay attention to the polar axis at an angle to solve direction, concrete can see video link 
vector_angle_to_rigid (Row, the Column, Phi, Row, the Column, RAD (180 [), HomMat2D) 
* and the image regions to do this rotation conversion, and matting, further image segmentation 
affine_trans_image (image, ImageAffinTrans , HomMat2D, 'Constant', 'to false') 
affine_trans_region (RegionTrans, RegionAffineTrans, HomMat2D, 'nearest_neighbor') 
reduce_domain (ImageAffinTrans, RegionAffineTrans, ImageReduced) 
* image segmentation. 3 below will be carried out, that is, character segmentation, segmented interest areas, above all in doing positioning and geometry Transform it, pay attention to this idea routine 
rgb1_to_gray (ImageReduced, GrayImage) 
* Note that flip the image intensity because we are back halcon own character, and font comes halcon is black and white 

invert_image (GrayImage, ImageInvert) 
threshold (GrayImage, Regions1, 92, 135) 
* where the three brothers began joint usage is adaptable, like water, itself invisible, met container is a container shape 
opening_rectangle1 (Regions1, RegionOpening1, 3, 3) 
* attention must be cut into different domains can communicate with feature selection, which is halcon internal mechanisms, the provisions are not objective. That is, it must call Connection 
Connection (RegionOpening1, ConnectedRegions) 
select_shape (ConnectedRegions, SelectedRegions, 'Area', 'and', 546.74, 2000) 
* character was extracted, attention here I do not recognize Chinese characters, to recognize Chinese characters are possible , you can see the video link 
* character after ordering easy identification observe, because people are accustomed to from left to right
 
sort_region (SelectedRegions, SortedRegions, 'first_point', 'to true', 'column') 
* 4 identification display, pay attention to this recognition the halcon own character, while the non-rejection band NoRej representation, identification is not critical 
read_ocr_class_mlp ( 'Industrial_0-9A-Z_NoRej.omc', OCRHandle) 
* Note ocr Routine, generally can be identified with a plurality of areas, area identification may be a single, note that the above work is to get the area 
do_ocr_multi_class_mlp (SortedRegions, ImageInvert, OCRHandle, class, Confidence) 
dev_display (Image) 
disp_message (the WindowHandle, class, 'Image', 371, 264, 'Red', 'to false')

  • Picture: .jpg license plate

Guess you like

Origin blog.csdn.net/qingzhuyuxian/article/details/92799911