フィルターのクリア

extract text from image and write in text file (template matching)

3 ビュー (過去 30 日間)
ahmed
ahmed 2014 年 4 月 5 日
コメント済み: Harshit 2014 年 6 月 14 日
i made acode for extract text from image but there are something wrong anybody can help me ??
clc
[n,p]=uigetfile('*.*');
a=imread([p,n]);
path='C:\Users\ahmed shouaib\Desktop\New folder (2)';
folder = path;
dirListing = dir(folder);
imcell = cell(1,numel(dirListing));
for d = 1:length(dirListing)
fileName = fullfile(folder,dirListing(d).name);
imcell{d}=imread(fileName);
target = a ;
template=imcell{d};
[r1,c1]=size( target);
[r2,c2]=size(template);
disp(t);
y=[];
%for g=1:t
for i=1:r1-r2+1
for j=1:c1-c2+1
b1=target(i:i+r2-1,j:j+c2-1);
y(i,j)=corr2(b1,imcell{d});
f=max(y); %max row
[m,u]=max(max(y));%max column
q=fopen('c.txt','w');
if m >.8
if g==3
fprintf(x,'t');
elseif g==4
fprintf(x,'e');
elseif g==5
fprintf(x,'x');
elseif g==6
fprintf(x,'t');
end
end
end
disp(d);
end
end
fclose(q);
  2 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 5 日
I doubt anyone will take the time until put in more comments to explain the code and you explain "there are something wrong". http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Harshit
Harshit 2014 年 6 月 14 日
Requires folder permissions Right click on matlab and Run as Admin

サインインしてコメントする。

回答 (2 件)

ahmed
ahmed 2014 年 4 月 5 日
ok the problem i think in here imcell{d}=imread(fileName); or in the loop before it or may be here y(i,j)=corr2(b1,imcell{d}); please take alook on the code
  1 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 5 日
Please step through it with the debugger and give us all the red error message that you see. You will find out which line it is because it will spew out red when it bombs.

サインインしてコメントする。


ahmed
ahmed 2014 年 4 月 5 日
編集済み: ahmed 2014 年 4 月 5 日
this is the message
??? Error using ==> imread at 357
Can't open file "C:\Users\ahmed shouaib\Desktop\New folder (2)\." for
reading;
you may not have read permission.
Error in ==> grooop at 11
imcell{d}=imread(fileName);

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by