Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Generation vector out put of Correlation two images using template ?

1 view (last 30 days)
This is code implement algorithm that will pass every image in W22{} to template {}, then calculate correlation between every image , then generate vector that contains ones,zeros equal 1 if it is match entry of template and W22{} image otherwise equal zero and so on , but the final vector is get wrong vector , i am not sure a bout output handel of corr2 function ,any one help me?
% clear all
% function [Selected_vector] = Template();
load template
load W22
comp=[];
sem =[];
s=size(W22);
for n_o = 1:s(:,2)
W22{n_o}= imresize(W22{n_o},[50 50]);
for n=1:8
template{n}= imresize(template{n},[50 50]);
comp(n_o,n) = corr2(template{n},W22{n_o});
end
end
for n_o = 1:s(:,2)
if n_o ==1
and_out(n_o,:) =(comp(n_o,:)&[1 0 0 0 0 0 0 0]);%Damah
or_out =and_out(n_o,:);
else
if n_o ==2
and_out(n_o,:) =(comp(n_o,:)&[0 1 0 0 0 0 0 0]);%Fatha
or_out =and_out(n_o,:)|or_out;
else
if n_o == 3
and_out(n_o,:) =(comp(n_o,:)&[0 0 1 0 0 0 0 0]);%Noqta
or_out =and_out(n_o,:)|or_out;
else
if n_o == 4
and_out(n_o,:) =(comp(n_o,:)&[0 0 0 1 0 0 0 0]);%kasra
or_out =and_out(n_o,:)|or_out;
else
if n_o == 5
and_out(n_o,:) =(comp(n_o,:)&[0 0 0 0 1 0 0 0]);%skoon
or_out =and_out(n_o,:)|or_out;
else
if n_o == 6
and_out(n_o,:) =(comp(n_o,:)&[0 0 0 0 0 1 0 0]);%hamza
or_out =and_out(n_o,:)|or_out;
else
if n_o == 7
and_out(n_o,:) =(comp(n_o,:)&[0 0 0 0 0 0 1 0]); %Shada
or_out =and_out(n_o,:)|or_out;
else
if n_o == 8
and_out(n_o,:) =(comp(n_o,:)&[0 0 0 0 0 0 0 1]);%Noqta_2
or_out =and_out(n_o,:)|or_out;
end
end
end
end
end
end
end
end
end
[Selected_vector]= [ or_out];

Answers (0)

Community Treasure Hunt

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

Start Hunting!