MATLAB车牌汉字识别

时间:2012-05-15 19:05:42
【文件属性】:
文件名称:MATLAB车牌汉字识别
文件大小:129KB
文件格式:RAR
更新时间:2012-05-15 19:05:42
MATLAB function result = letter_compare(ocr_letters, document_letter) % LETTER_COMPARE.M % % function result = letter_compare(ocr_letters, document_letter) % % Parameters: ocr_letters is an array (1..4) of structures % with fields: Mean, Covariance % Subscripts of array mean 1=O 2=E 3=A 4=U % document_letter fields is a structure which has % with fields: Image, EulerNumber, Area, BoundingBox % % This function compares a letter extracted from the image paragraph % to each of the four vowels. Returns the index of the vowel % which the letter from the paragraph matches, if any. % If no vowels match up, return 0. % % Assumptions: % - the letter form the document/paragraph is properly oriented % Calculate the data necessary for the matching perImg = bwperim(document_letter.Image); perArea = bwarea(perImg); compactness = perArea^2/document_letter.Area; moments = invmoments(document_letter.Image); % Calculate the top/bottom area ratio midpoint = floor(document_letter.BoundingBox(4)/2); topPart = document_letter.Image(1:midpoint,:); bottomPart = document_letter.Image((midpoint+1):end,:); partRatio = bwarea(topPart)/bwarea(bottomPart); % Final vector for the doucment image which will be used for comparison vector = [ moments(1) moments(2) moments(3) compactness partRatio ]; % Go through all four letters for i = 1: 4, % Closeness will be Mahalanobis distance without the log term closeness(i) = (vector - ocr_letters(i).Mean)*... inv(ocr_letters(i).Covariance)*... (vector - ocr_letters(i).Mean)'; % Distance is Mahalanobis distance with the log term % The log term equalizes the distance space so that % we can compare which one of the four letters % is closer to the letter extracted from the paragraph distance(i) = closeness(i) + log(det(ocr_letters(i).Covariance)); end % Find one of the vowels with the smallest distance to the document letter minimumDistance = distance(1); closestMatch = 1; for j = 1:4, if distance(j) 0.87 ) % S rejected because the weight of the top % half is about equal to the wight of the % bottom half closestMatch = 0; end elseif closestMatch == 4 % It thinks it is a U % Euler# can be 0 or 1 if (document_letter.EulerNumber ~=1 ) % Reject closestMatch = 0; end % Also, calculate the Eulers for the top and % bottom slices midpoint = floor(document_letter.BoundingBox(4)/2); topPart = im2bw(document_letter.Image(1:midpoint,:), 0.5); bottomPart = im2bw(document_letter.Image(midpoint+1,:), 0.5); topFeature = imfeature(double(topPart), 'EulerNumber'); bottomFeature = imfeature(double(bottomPart), 'EulerNumber'); topEuler = topFeature(1).EulerNumber; bottomEuler = bottomFeature(1).EulerNumber; % For u's, the top Euler number is 2, and the bottom % part has Euler number of 2 if (topEuler~=2) | (bottomEuler ~= 2) % Can't be an U according to Euler checks closestMatch = 0; end end result = closestMatch; else result = 0; end
【文件预览】:
www.pudn.com.txt
简易OCR程序
----centralmoment.m(1021B)
----e.mat(488B)
----invmoments.m(1KB)
----vowel.m(5KB)
----a.mat(488B)
----ncmoment.m(1KB)
----CS585 Fall 1998 Project One by Stanislav Rost.files()
--------background.jpg(395B)
--------title.jpg(15KB)
--------par1result.gif(8KB)
--------u2.gif(900B)
--------program.jpg(3KB)
--------results.jpg(3KB)
--------tilted.gif(9KB)
--------mahalanobis.gif(1KB)
--------tiltedresult.gif(8KB)
--------code.jpg(2KB)
--------goals.jpg(2KB)
--------par2result.gif(19KB)
--------Thumbs.db(36KB)
--------istilted.gif(4KB)
--------scaledresult.gif(12KB)
--------split.gif(581B)
--------method.jpg(3KB)
--------n2.gif(1KB)
--------readme.txt(83B)
----o.mat(488B)
----u.mat(488B)
----CS585 Fall 1998 Project One by Stanislav Rost.htm(18KB)
----gravcenters.m(1KB)
----train.m(3KB)
----letter_compare.m(5KB)

网友评论

  • 可以参考 能用
  • 代码注释比较少,不过还是可以参考调试的
  • 这些文档要是设计成一个统一的界面就好了。都是零散的文件。