为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

26个大写英文字符识别

2018-01-31 8页 doc 77KB 19阅读

用户头像

is_180829

暂无简介

举报
26个大写英文字符识别26个大写英文字符识别 程序1;对输入字母图片进行特征化数据处理并与库中26个字母特征化数据对比,找出最相 似的字母。 clc clear load('D:\26个英文字母识别\index.mat') load index.mat; %预处理 for i=1:52 RGB{i}=imread(['D:\26个英文字母识别\',index{i}]); FD{i}=Feature_Building(RGB{i}); FD{i}=reshape(FD{i},1,120); End %将矩阵两两之间求距离 ...
26个大写英文字符识别
26个大写英文字符识别 程序1;对输入字母图片进行特征化数据处理并与库中26个字母特征化数据对比,找出最相 似的字母。 clc clear load('D:\26个英文字母识别\index.mat') load index.mat; %预处理 for i=1:52 RGB{i}=imread(['D:\26个英文字母识别\',index{i}]); FD{i}=Feature_Building(RGB{i}); FD{i}=reshape(FD{i},1,120); End %将矩阵两两之间求距离 for i=1:26 for j=1:26 d(j,i)=norm(FD{i+26}-FD{j}); end end %将距离位置排序 [label da]=sort(d); %将最接近真实值的3个位置输出 three=da(1:3,:); 程序2;录入图像文件,录入1个字母图片,分别调用快速傅里叶变换,找出录入图片 与标准图片距离最小的图片位置。 clear RGB1=imread('D:A1.bmp');RGB2=imread('D:A.bmp'); RGB3=imread('D:B.bmp');RGB4=imread('D:C.bmp'); RGB5=imread('D:D.bmp');RGB6=imread('D:E.bmp'); RGB7=imread('D:F.bmp');RGB8=imread('D:G.bmp'); RGB9=imread('D:H.bmp');RGB10=imread('D:I.bmp'); RGB11=imread('D:J.bmp');RGB12=imread('D:K.bmp'); RGB13=imread('D:L.bmp');RGB14=imread('D:M.bmp'); RGB15=imread('D:N.bmp');RGB16=imread('D:O.bmp'); RGB17=imread('D:P.bmp');RGB18=imread('D:Q.bmp'); RGB19=imread('D:R.bmp');RGB20=imread('D:S.bmp'); RGB21=imread('D:T.bmp');RGB22=imread('D:U.bmp'); RGB23=imread('D:V.bmp');RGB24=imread('D:W.bmp'); RGB25=imread('D:X.bmp');RGB26=imread('D:Y.bmp'); RGB27=imread('D:Z.bmp'); FD1=Feature_Building(RGB1);FD2=Feature_Building(RGB2); FD3=Feature_Building(RGB3);FD4=Feature_Building(RGB4); FD5=Feature_Building(RGB5);FD6=Feature_Building(RGB6); FD7=Feature_Building(RGB7);FD8=Feature_Building(RGB8); FD9=Feature_Building(RGB9);FD10=Feature_Building(RGB10); FD11=Feature_Building(RGB11);FD12=Feature_Building(RGB12); FD13=Feature_Building(RGB13);FD14=Feature_Building(RGB14); FD15=Feature_Building(RGB15);FD16=Feature_Building(RGB16); FD17=Feature_Building(RGB17);FD18=Feature_Building(RGB18); FD19=Feature_Building(RGB19);FD20=Feature_Building(RGB20); FD21=Feature_Building(RGB21);FD22=Feature_Building(RGB22); FD23=Feature_Building(RGB23);FD24=Feature_Building(RGB24); FD25=Feature_Building(RGB25);FD26=Feature_Building(RGB26); FD27=Feature_Building(RGB27); FD1=reshape(FD1,1,120);FD2=reshape(FD2,1,120); FD3=reshape(FD3,1,120);FD4=reshape(FD4,1,120); FD5=reshape(FD5,1,120);FD6=reshape(FD6,1,120); FD7=reshape(FD7,1,120);FD8=reshape(FD8,1,120); FD9=reshape(FD9,1,120);FD10=reshape(FD10,1,120); FD11=reshape(FD11,1,120);FD12=reshape(FD12,1,120); FD13=reshape(FD13,1,120);FD14=reshape(FD14,1,120); FD15=reshape(FD15,1,120);FD16=reshape(FD16,1,120); FD17=reshape(FD17,1,120);FD18=reshape(FD18,1,120); FD19=reshape(FD19,1,120);FD20=reshape(FD20,1,120); FD21=reshape(FD21,1,120);FD22=reshape(FD22,1,120); FD23=reshape(FD23,1,120);FD24=reshape(FD24,1,120); FD25=reshape(FD25,1,120);FD26=reshape(FD26,1,120); FD27=reshape(FD27,1,120); d1=norm(FD1-FD1);d2=norm(FD1-FD2); d3=norm(FD1-FD3);d4=norm(FD1-FD4); d5=norm(FD1-FD5);d6=norm(FD1-FD6); d7=norm(FD1-FD7);d8=norm(FD1-FD8); d9=norm(FD1-FD9);d10=norm(FD1-FD10); d11=norm(FD1-FD11);d12=norm(FD1-FD12); d13=norm(FD1-FD13);d14=norm(FD1-FD14); d15=norm(FD1-FD15);d16=norm(FD1-FD16); d17=norm(FD1-FD17);d18=norm(FD1-FD18); d19=norm(FD1-FD19);d20=norm(FD1-FD20); d21=norm(FD1-FD21);d22=norm(FD1-FD22); d23=norm(FD1-FD23);d24=norm(FD1-FD24); d25=norm(FD1-FD25);d26=norm(FD1-FD26); d27=norm(FD1-FD27); 程序3;对输入字母图像进行轮廓提取。 function draw_outline(outline) B = cell(1); outline(:,1) = outline(:,1)*(-1); B{1,1} = outline; for k = 1:length(B) boundary = B{k} plot(boundary(:,2), boundary(:,1), 'b', 'LineWidth', 2) end 程序4;快速傅里叶变换 function rFSDs = fsd(outline,H,b,bN) % Forward elliptical Fourier transform - see Kuhl FP and Giardina CR % "Elliptic Fourier features of a closed contour" Computer Graphics % Returns a shape spectrum of input x,y data "outline" with % iNoOfHarmonicsAnalyse elements. % The output FSDs will be normalised for location, size and orientation % if bNormaliseSizeState and bNormaliseOrientationState are TRUE % Pre-calculate some constant arrays % n * 2 * pi % n^2 * 2* pi^2 % where n is the number of harmonics to be used in the analysis %H = iNoOfHarmonicsAnalyse %b = bNormaliseSizeState %[m n] = size(outline), b = m; %bN = bNormaliseOrientationState rTwoNPi = (1:1:H)* 2 * pi; rTwoNSqPiSq = (1:1:H) .* (1:1:H)* 2 * pi * pi; iNoOfPoints = size(outline,1) - 1; % hence there is 1 more data point in outline than iNoOfPoints rDeltaX = zeros(iNoOfPoints+1,1); % pre-allocate some arrays rDeltaY = zeros(iNoOfPoints+1,1); rDeltaT = zeros(iNoOfPoints+1,1); for iCount = 2 : iNoOfPoints + 1 rDeltaX(iCount-1) = outline(iCount,1) - outline(iCount-1,1); rDeltaY(iCount-1) = outline(iCount,2) - outline(iCount-1,2); end % Calculate 'time' differences from point to point - actually distances, but we are % carrying on the fiction of a point running around the closed figure at constant speed. % We are analysing the projections on to the x and y axes of this point's path around the figure for iCount = 1 : iNoOfPoints rDeltaT(iCount) = sqrt((rDeltaX(iCount)^2) + (rDeltaY(iCount)^2)); end check = (rDeltaT ~= 0); % remove zeros from rDeltaT, rDeltaX... rDeltaT = rDeltaT(check); 程序5,;图片的特征建立方法。 clc function FD=Feature_Building(RGB) %RGB=imread('d:A.bmp'); %figure(1),inshow(RGB) [B]=outline(RGB); %figure(2) %subplot(221),draw_outline(B); %title('outline of object'); [m,n]=size(B); FD=fsd(B,30,m,4); function rFSDs = fsd(outline,H,b,bN) % Forward elliptical Fourier transform - see Kuhl FP and Giardina CR % "Elliptic Fourier features of a closed contour" Computer Graphics % Returns a shape spectrum of input x,y data "outline" with % iNoOfHarmonicsAnalyse elements. % The output FSDs will be normalised for location, size and orientation % if bNormaliseSizeState and bNormaliseOrientationState are TRUE % Pre-calculate some constant arrays % n * 2 * pi % n^2 * 2* pi^2 % where n is the number of harmonics to be used in the analysis %H = iNoOfHarmonicsAnalyse %b = bNormaliseSizeState %[m n] = size(outline), b = m; %bN = bNormaliseOrientationState rTwoNPi = (1:1:H)* 2 * pi; rTwoNSqPiSq = (1:1:H) .* (1:1:H)* 2 * pi * pi; iNoOfPoints = size(outline,1) - 1; % hence there is 1 more data point in outline than iNoOfPoints rDeltaX = zeros(iNoOfPoints+1,1); % pre-allocate some arrays rDeltaY = zeros(iNoOfPoints+1,1); rDeltaT = zeros(iNoOfPoints+1,1); for iCount = 2 : iNoOfPoints + 1 rDeltaX(iCount-1) = outline(iCount,1) - outline(iCount-1,1); rDeltaY(iCount-1) = outline(iCount,2) - outline(iCount-1,2); end for iCount = 1 : iNoOfPoints rDeltaT(iCount) = sqrt((rDeltaX(iCount)^2) + (rDeltaY(iCount)^2)); end check = (rDeltaT ~= 0); % remove zeros from rDeltaT, rDeltaX... rDeltaT = rDeltaT(check); 运行结果:将输入字母图片与库中所有图片分别用快速傅里叶变换,得到的值进行按照升序排列对比。
/
本文档为【26个大写英文字符识别】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
热门搜索

历史搜索

    清空历史搜索