The Realization of Digital Recognition Based on FPGA

Welcome to my WeChat public account: FPGA Open Source Studio

 

 

 

The realization of digital recognition based on FPGA II

                                                       Author: lee god

1 Background knowledge

1.1 FPGA - based digital recognition method

Generally, the algorithms used for the recognition of printed numbers include: recognition method based on template matching, recognition method based on BP neural network, recognition method based on digital features, etc. These algorithms are discussed and compared below.
   1> Template matching method
    Template matching method is a digital recognition algorithm that has been applied earlier. The key of the algorithm is to
build a template for all the numbers to be recognized, and then compare the numbers in the image with all the digital templates one by one. ,
calculate the similarity between the numbers in the image and each template, and identify according to the calculated similarity results.
The template with the highest similarity is the result we want to identify. The template matching method has high requirements on the normalization of the size and
structure of the numbers, and the normalization of the numbers has a direct impact on the recognition accuracy
. The principle of the algorithm is relatively simple, but the computational complexity is too large, and it is not conducive to the realization of FPGA.
    2> Neural Network Recognition Algorithm
   Neural network recognition method is an algorithm that imitates the characteristics of animal neural network and performs distributed parallel
processing . The neural network recognition algorithm has a certain anti-interference ability, but in order to ensure the
accuracy , the algorithm needs to be responsible and a lot of calculation to train the neural network, and too complicated
calculation is not conducive to the realization of the algorithm by FPGA.
    3> Digital feature recognition
    algorithm The core of the recognition algorithm based on digital features is
to analyze and count the geometric features such as the shape and structure of the numbers, and to recognize the numbers in the image through the recognition of the digital features.

1.2 Digital recognition based on digital feature algorithm

We use an algorithm based on digital features to identify numbers, collect images through the image acquisition module, perform grayscale, binarization, and then perform digital feature extraction and statistics to complete the identification of numbers, and finally display them on the digital tube. , complete the conversion of image information to digital information.

 

 

Figure 1 0-6 digital feature marking

 

 

Figure 2 7-8 Digital Characteristic Reticles

 

 

 

Figure 3 5 Numerical Features

The extraction of digital feature information is based on the printed body, as shown in Figure 1, Figure 2, and Figure 3 above. Taking the number 5 in Figure 3 as an example, the red box is the horizontal and vertical upper, lower, left, and right boundaries of the number 5 . X1 is the horizontal line at 2/5 of the vertical direction , x2 is the horizontal line at 2/3 of the vertical direction, and y is the horizontal line at 1/2 of the horizontal direction . We use this feature to count the intersection of x1, x2, y and the number 5 .

The characteristics of distinguishing 0-9 numbers by cross-statistic method are shown in Table 1 below :

                         Table 1 0-9 digital feature statistics table

number

Number of intersections with y

Number of intersections with x1

Number of intersections with x2

Classification

0

2

2

2

A

1

1

1

1

B

2

3

1

1

C

3

3

1

1

C

4

2

2

1

D

5

3

1

1

C

6

3

1

2

E

7

2

1

1

F

8

3

2

2

G

9

3

2

1

H

Since 2 , 3, and 5 have the same numerical feature statistics table, they cannot be distinguished, so we continue to add numerical features to distinguish 2, 3, and 5 . As table 2 :

Table 2 2,3,5 digital feature statistics

number

Position of intersection with x1 (left, right)

Position of intersection with x2 (left, right)

Classification

2

right

Left

I(C)

3

right

right

J(C)

5

Left

right

K(C)

This completely separates the numbers 0-9 through numerical statistics . Then use the FPGA system to build a real-time digital recognition system.

As shown in Figure 4 , the traffic camera performs real-time positioning on the car moving on the road. As the car moves, the red frame also moves with the car, framing the car in real time.

1.3 Target tracking method

The detection of moving objects in the background of static images based on real-time object movement is a research hotspot in the field of computer vision. It has great practical value in many fields such as security, surveillance, intelligent transportation, machine intelligence, and military fields. The essence of moving object detection is to segment and extract the changing area of ​​the image from the whole image from the real-time image sequence. Since the post-processing of images, such as classification, tracking, ranging, judging size, and behavior and action analysis of moving targets, mainly considers the pixel information of the moving target area, the accurate detection and effective segmentation of moving targets is the whole detection and tracking process. important foundation of the system.

              

 

                                Figure 4 Sports cars on the road

At present, three moving target detection algorithms are gradually formed:

1 ) The inter-frame difference method is a method of using the difference between two adjacent frames of images in a video sequence to detect moving objects in a video sequence. However, due to the influence of moving targets and background changes, there may be false targets or "holes" in the target during the detection process, and the target can be effectively detected when the target movement is not too fast.

2 ) The background subtraction method first obtains the background image in the scene without the target, and then uses the real-time video sequence and the background image to do the difference to realize the detection of the moving target. How to get the background is the key to the background subtraction method.

3 ) The optical flow method is to establish an optical flow field by assigning a velocity vector to each pixel in the image, and use the continuity of the vector motion in the optical flow field to detect moving targets. The computational complexity of this method is usually large, and it is difficult to realize real-time detection. 

In this section, based on FPGA target tracking and statistical feature statistics, we will realize real-time positioning of numbers and number recognition, not limited to the position of numbers on the screen, nor is it limited to the size of numbers.

2 Realization of digital recognition based on FPGA

 

 

Figure 5 FPGA real - time digital recognition system based on ov5640

As shown in Figure 5 , we use the ov5640 cmos 500W pixel camera for image acquisition. The collected color RGB images are first stored in SDRAM , and then the image data is read out by the TFT display control terminal. After reading the RGB image data, we first RGB to Ycbcr algorithm operation, and then perform threshold segmentation on the grayscale image to form a binary image, perform digital recognition on the basis of boundary tracking of the binary digital image, and finally display the boundary on the TFT 5 -inch screen. displayed on the nixie tube.

 

 

                            Figure 6 The three main core modules of border tracking digital recognition

As shown in Figure 6 , based on the display timing of the TFT screen, the boundary is first tracked, and after identifying the digital boundary, we carry out digital identification of statistical features on the basis of the boundary.

 

 

Figure 7 Boundary Tracking Module

As shown in Figure 7 , hcount is the column counter, vcount is the row counter, TFT_VS_fall and TFT_VS_rise are the frame falling edge mark and frame rising edge mark respectively, frame_cnt is the frame counter, hcount_l and hcount_r are the left and right boundaries of the numbers after recognition, vcount_l and vcount_r are the upper and lower bounds of the numbers, respectively. Th_flag_fall and th_flag_rise are the falling edge and rising edge flags after the threshold of the grayscale image, respectively.

 

 

Figure 8 Digital identification module

As shown in Figure 8 , the basic boundary information comes from the digital boundary recognition module. The digital recognition module mainly includes the intersection information of two horizontal and one vertical ( x1, x2, y ) and numbers in digital statistics, as well as other supplementary information.

Part of the core code:

/*

Module name:  digital_recognition.v

Description:  digital recognition

              

Data:         2018/04/17

Engineer: lipu

email: [email protected]

WeChat public account:    FPGA Open Source Studio

*/

 

 

Digital identification x1, x2, y core code:

 

 

 

TFT display shows the code:

 

 

Digital identification and digital tube display docking code:

 

 

Results show:

 

 

Figure 9 The original image of the experiment

 

 

Figure 10 Boundary Tracking Digit Recognition 6

 

 

Figure 11 Boundary Tracking Number Recognition 7

 

 

 

Figure 12 Boundary Tracking Digit Recognition 4

 

 

 

Figure 13 Boundary Tracking Digit Recognition 5

Outlook:

Recognition based on machine vision is the inevitable road to artificial intelligence, and character recognition is the stepping stone to this road. The result of this experiment is that no matter the size of the number, the position of the number on the screen can be correctly identified. Based on this, face location recognition, face template matching recognition, license plate recognition and other popular machine vision and artificial intelligence can be developed.

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324811780&siteId=291194637