您好,欢迎光临本网站![请登录][注册会员]  
文件名称: MATLAB车牌汉字识别
  所属分类: 其它
  开发工具:
  文件大小: 129kb
  下载次数: 0
  上传时间: 2009-04-26
  提 供 者: u0111*****
 详细说明: 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 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: MATLAB
 输入关键字,在本站1000多万海量源码库中尽情搜索: