text detection in matlab

1 次查看(过去 30 天)
annmaria
annmaria 2015-7-27
编辑: annmaria 2015-7-27
I am comparing different images inorder to done text recognition. I found out the matched images.figure1,figure2,figure3 are the input images as shown in the code. Is it possible to find the hierarchial centroid and distance of figure1,figure2,figure3 in a loop. Is it possible to display it in a single line. Now it is obtain like A B C are in different lines I want to obtain ABC.And also in between B and C I want to put a space also Is it possible in matlab Please help me I am new in matlab.Thanks in advance
clc,clear all,close all
plotFlag = 1;
depth = 6;
alef1 = im2bw(imread('figure1.bmp'));
alef2 = im2bw(imread('figure2.bmp'));%%Binary image
alef3=im2bw(imread('figure3.bmp'));
vec1 = hierarchicalCentroid(alef1,depth,plotFlag);
vec11 = hierarchicalCentroid(alef2,depth,plotFlag);
vec12 = hierarchicalCentroid(alef3,depth,plotFlag);
% subplot(1,3,1);
A=[];
vec2=[];
dist_1_1=[];
for ii=1:22
A{ii} = imread(['image' num2str(ii) '.bmp']);
% subplot(1,3,2);
vec2{ii} = hierarchicalCentroid(A{ii},depth,plotFlag);
dist_1_1{ii} = sum((vec1 - vec2{ii}) .^ 2);
dist_1_2{ii} = sum((vec11 - vec2{ii}) .^ 2);
dist_1_3{ii} = sum((vec12 - vec2{ii}) .^ 2);
end
[m,I]=min(cell2mat(dist_1_1));
[m,O]=min(cell2mat(dist_1_2));
[m,P]=min(cell2mat(dist_1_3));
if I==1
disp('A');
end
if O==2
disp('B')
end
if P==3
disp('C')
end
figure;
subplot(1,2,1);imshow(alef1);
subplot(1,2,2);imshow(A{I});
subplot(1,2,1);imshow(alef2);
subplot(1,2,2);imshow(A{O});
subplot(1,2,1);imshow(alef3);
subplot(1,2,2);imshow(A{P});

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by