Keep only the last of the same sub-matxices
Afficher commentaires plus anciens
hello
i have the above code that Walter Roberson help me with mean2.
for i=150:x-200
for j=150:y-800
if mean2(Pattern_epikef==Foto2(i:i+23,j:j+75) ) >= 0.85
%figure:imshow(Foto2(i:i+23,j:j+75));
%fprintf('dose pono mori astheneia\n');
figure:imshow(Foto2(i+20:i+100,j:j+800));
end
end
end
The thing i do is to search in a picture and if the pattern is the same with the specified segment of the picture do something. The pattern is multiple times in the picture. (4 times).When it finds the first, cause i have the theshold to be the same by 80%) it keep getting the same segment just shifted a bit by some pixels and so on fot the 2 etc .So,how can i keep only the last part of the same segmets???? Please help Monday last day before presentation!!
Réponses (1)
Walter Roberson
le 31 Mai 2012
for i=150:x-200
jrun = -1;
for j=150:y-800
if mean2(Pattern_epikef==Foto2(i:i+23,j:j+75) ) >= 0.85
jrun = j;
elseif jrun > 0
Theseis=[i,jrun];
%figure:imshow(Foto2(i:i+23,jrun:jrun+75));
%fprintf('dose pono mori astheneia\n');
figure:imshow(Foto2(i+20:i+100,jrun:jrun+800));
jrun = -1;
end
end
end
7 commentaires
Konstantinos Kontos
le 31 Mai 2012
Konstantinos Kontos
le 31 Mai 2012
Walter Roberson
le 31 Mai 2012
There is a bug in the code, but it has to do with it _not_ outputting matches that occur at the end of a run of "j".
You were not specific about what the "same segment" was, so I took it to mean the same series of "j". If you are also having extra matches on "i" then more work would be needed.
By the way, the ":" after "figure" should be a semi-colon.
Konstantinos Kontos
le 31 Mai 2012
Konstantinos Kontos
le 31 Mai 2012
Walter Roberson
le 31 Mai 2012
For this purpose, what do you mean by "arent close", and "do what i want" ?
Konstantinos Kontos
le 1 Juin 2012
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!