A list,

What is OCR technology? OCR stands for Optical Character Recognition and Optical Character Recognition in Chinese. It uses optical technology and computer technology to read words printed or written on paper and convert them into a format that computers can accept and humans can understand. Character recognition is one of the branches of computer vision research, and this topic has been relatively mature, and there have been many landing projects in the business.

Classification of OCR technology: I. By subject: handwritten recognition and print recognition.

1. Most printed fonts are regular fonts. The technical difficulty is that fonts may become broken or ink sticks during printing, which makes OCR identification extremely difficult. Of course, these can be restored as much as possible through some image processing technology, and then improve the recognition rate. In general, simple print recognition in the industry has been able to do very good, but said that 100% recognition is certainly impossible, but said that recognition is good that is not wrong.

2. Handwriting recognition has always been a challenge for THE OCR community to overcome, but up to now, it is still very difficult to recognize. Why is handwriting recognition so difficult? Because human handwriting often has personal characteristics, everyone’s writing style is basically different, although human can read your writing, but the machine is difficult. Typography is generally regular, and there are basically dozens of fonts. It is not difficult for a machine to learn dozens of fonts. But in handwriting, if everyone has a font, how many fonts should the machine learn? That’s the difficulty.



two According to the content of recognition to classify, for our people are mainly divided into three categories: Chinese characters, English letters, Arabic numerals. Numbers are the easiest. After all, there are only 0 to 9 characters to recognize. English letters have 26 characters to recognize (52 if case is taken into account), while Chinese characters have thousands of characters to recognize because of the different glyphs of Chinese characters. Very complex structures (such as Chinese characters with hemlines) can be quite challenging to identify accurately. However, not all applications need to recognize such a large set of characters. For example, for license plate recognition, the difficulty is greatly reduced when we target only the abbreviations of dozens of Chinese provinces and municipalities. Of course, in some automatic document recognition applications are required to identify the entire Chinese character set, so it is difficult to ensure the overall recognition of recognition.

OCR process



Determine the orientation of the text on the page, because the document we end up with is not always perfect, probably with slants or stains, so the first thing we do is pre-process the image, do Angle correction and de-noising.

The document layout is analyzed, each line is segmented, each line of text is cut down, and finally each line of text is segmented, each character is cut out, and the character is sent into the trained OCR recognition model for character recognition, and the result is obtained.

For example, we can design a grammar detector to detect whether the combination logic of characters is reasonable. For example, consider the word ‘Because’, which our model identifies as 8ecause, and we can use a grammar detector to correct the spelling error, replacing 8 with B. This way,

The OCR process is complete. In terms of large modules, a set of OCR processes can be divided into: As can be seen from the above flow chart, character recognition is not a simple OCR module (if the simple OCR module, the recognition rate is quite low), but a combination of each module is needed to ensure a high recognition rate.

Ii. Source code

clc clear all close all Symbols =['0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '-']; P3 = []; Result = []; path = 'C:\Users\lenovo\Desktop\23149049ocr\'; % working Path ext = '_bold.bmp'; %Train Data Files Extension name P = zeros(16,12,11); % Read 0-9 digits data for i = 0: 9 file = [path,char(48 + i) , ext]; % char(48) => '0' P(:,:,i + 1) = imread(file); P3 = [P3,P(:,:,i + 1)']; end % imshow(P(:,:,1)); i = i + 1; % read other symbols file = [path,'dash' , ext]; P(:,:,i + 1) = imread(file); P3 = [P3,P(:,:,i + 1)']; % figure % for i = 1:11 % subplot( 11, 1, i ); % imshow( P(:,:,i) ); % end P1 = reshape(P3, 12 * 16, 11); T = zeros (11, 11); for i = 1:11 T(i,i) = 1; end [R,Q] = size(P1); [S2,Q] = size(T); S1 = 25; net = newff(minmax(P1),[S1 S1 S2],{'logsig' 'logsig','logsig'},'traingdx'); net.performFcn = 'sse'; Net. TrainParam. Goal = 0.05; net.trainParam.show = 100; net.trainParam.epochs = 5000; Net. TrainParam. MC = 0.95; [net,tr] = train(net,P1,T); sept2 = []; %character segment start-end pos Test1 =[]; file = [path,'test_bold2.bmp']; a = imread(file); figure; Subplot (3,24,1:24); imshow(a); j =1; seg1 = a; b = sum(seg1) ; % character segment, if the vertical projection is zero, means the space between characters. b(find(b < 1) ) = 0; c = find(b == 0); d= find(b > 0); e = find(c > d(1)); sept2 = []; for k = 1:size(e,2) -1 % delete repeated zero position if( c(e(k + 1)) - c(e(k)) > 1) sept2 = [sept2, c(e( k ))]; sept2 = [sept2, c(e(k + 1))]; end end %figure sept2 = [1, sept2]; chCount = size(sept2); for k = 1: chCount(2) -1 Test1 = []; TMP = zeros (16, 1); z = a(:,sept2(k)+1: sept2( k+1 )); t1 = size(z); if(t1(2)> 2) tt1 = size(z); % if( tt1(2) < 11) % z = [z,tmp]; % end tt1 = size(z); % if( tt1(2) < 11) % z = [tmp,z,tmp]; % end z2 = imresize(z,[16,12],'bilinear'); % z2 = ~z2; % z2 = ~z2; % z2 = double(z2); % z2 = imnoise(z2,'salt & pepper', 0.4); z2 = ~z2; z2 = ~z2; Subplot (3,24,24 + k); imshow(z2); z2 =z2'; Z3 = 0 0 (z2,16 * 12,1); Test1 = [Test1,z3]; %figure; %imshow(z2); %title('TRUE'); % endCopy the code

3. Operation results

Fourth, note

Complete code or simulation consulting to add QQ1575304183