필터 지우기
필터 지우기

Keep only the last of the same sub-matxices

조회 수: 1 (최근 30일)
Konstantinos Kontos
Konstantinos Kontos 2012년 5월 31일
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!!

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 31일
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
Walter Roberson
Walter Roberson 2012년 5월 31일
For this purpose, what do you mean by "arent close", and "do what i want" ?
Konstantinos Kontos
Konstantinos Kontos 2012년 6월 1일
'arent close'
when the if is true and i extract a Foto [ Foto2(i+20:i+100,j:j+800 ] ,then it will go to to next i and it will extract the
Foto too cause the 85% is true.So in the array theseis(i) when i print the results i had 447 447
448 448
449 449
964 964
965 965
1593
1594
1595
2397
2398
So i want the pixels that are not nearby. (A)
'do what i want'
i mean that when i find them just use figure;imshow(Foto2(i+20:i+100,j:j+800)); with the (A) pixels
i think is right but with a lot of fors.if you think something let me know cause i dont know if it will work this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by