资源简介
OCR中英文段落的提取、分割,最终得到英文字符
代码片段和文件信息
clear all;
close all;
%% read the image needing to process and prepare
%figure (); %figure 1
%subplot(231);
I=imread(‘C:\Users\EXIE\Desktop\test1.jpg‘);
%imshow(I);
%figure(); %figure 2
%subplot(232);
I1=rgb2gray(I);
%imshow(I1);
%figure(); %figure 3
%subplot(233);
I2=edge(I1‘robert‘0.20‘both‘);
%imshow(I2);
% new add code
se=[1;1;1]; %
I3=imerode(I2se);
%subplot(234);
%figure(); %figure 4
%imshow(I3);
se=strel(‘rectangle‘[2525]); %
I4=imclose(I3se);
%figure(); % figure 5
%subplot(235);
%imshow(I4);
%subplot(236);
I5=bwareaopen(I42000);
%figure(); % figure 6
%imshow(I5);
%I2=I5;
%------- accumulate the pixel amount ---------%
[yx]=size(I2); % just doing process on I2 not I5
I3=double(I2);
Y1=zeros(y1);
YTest=zeros(y2); %test each line‘s position on Y direction
for i=1:y
YTest(i2)=i; %test each line‘s position on Y direction
for j=1:x
if(I3(ij)==1) % 1 means White 0 means Black
Y1(i1)= Y1(i1)+1;
YTest(i1)=Y1(i1); %test each line‘s position on Y direction
end
end
end
%figure(); % test Y1
%plot(1:yY1);
%---------- locating the paragraph position ---------%
YConcaveS=1;
YConcaveE=1;
Sign=0;
for i=1:y
if ((Y1(i)>0) && Sign==0) % line beginning position on Y direction
Sign=1;
YConcaveS=[YConcaveS i];
elseif ((Y1(i)==0) && Sign==1) % line endding position on Y direction
Sign=0;
YConcaveE=[YConcaveE i];
end
end
%----------- abstract each line ----------%
[TempY n]=size(YConcaveS);
for iLine=2:2 %n % dividing pragraph into lines
%subplot(n-11iLine-1);
Line=I1(YConcaveS(iLine):YConcaveE(iLine):); % abstract each line for next step
figure(); % display processed each line of image
imshow(Line); % test LINE is corret or not
%Line=imresize(Line[2*y2*x]);
%--------- divide LINE into words ------------%
I=im2bw(Line0.3);
%I=Line;
[y1 x1]=size(I); % y1 x1 discrib LINE size
%--------- accumulating LINE‘s Top outline --------%
Top=zeros(1x1);
for iWord=1:x1
jWord=1;
while ((I(jWordiWord)==1)&&(jWord jWord=jWord+1;
end
Top(iWord)=y1-jWord; % accumulating Black Pixel amount
end
%--------- accumulating LINE‘s Bottom outline --------%
Bottom=zeros(1x1);
for iWord=1:x1
jWord=y1;
while ((I(jWordiWord)==1)&&(jWord>1))
jWord=jWord-1;
end
Bottom(iWord)=y1-jWord;
end
%figure(); % test Line Top Outline
%plot(1:x1Top); % Line Top outline
Number=0; % space amount between words
Sign=0; % state where the position is in word is 1 and in space is 0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4983 2013-10-11 23:38 Unti
----------- --------- ---------- ----- ----
4983 1
- 上一篇:ssim衡量两幅图像相似度的指标
- 下一篇:matlab植物叶片分类
相关资源
- matlab植物叶片分类
- ssim衡量两幅图像相似度的指标
- matlab的流体计算和传热
- Fuzzy Neural Network by matlab 四个不同的
- 手机拍摄图像的二维码的提取
- 利用四元数对彩色图像作图像处理
- LBP方法
- 织物疵点检测和识别系统
- SAO星表数据
- 粒子群算法路径规划动画演示
- 新型的配电网潮流计算的matlab源码
- 雷达交叉定位精度分析
- 磁流变减震器模型
- D2D的自适应链路仿真
- matlab实现的读取视频和音频
- matlab平台DCT算法压缩视频
- Softmax 函数处理
- 《精通Matlab数字图像处理与识别》(
- 5阶WENO有限差分法求解Sod型激波管问题
- foa 果蝇优化算法matlab程序
- CA元胞自动机源代码
- 应用条件随机场CRF 知识分割图像
- PSOGSA_v3
- 发动机悬置系统解耦率、固有频率以
- G-S算法matlab程序源代码
- DATCOM弹道计算工具
- matlab实现节点定位的三边定位算法
- CLAHE的matlab实现算法
- chan算法的源代码
- calculateuserposition 用MATLAB编写求解伪距
评论
共有 条评论