If statement with multiple conditions
이전 댓글 표시
I am processing an image in which I have found a blob and I want to compare the location of that blob to the location of a blob in another image using these lines of code:
for j=1:10
if ((blob(j,4)-50)<centroid(1)<(blob(j,4)+50))
if ((blob(j,5)-50)<centroid(2)<(blob(j,5)+50))
%more processing code
end
end
end
The variable 'blob' is a table of previous blobs that have been found with their x location in column 4 and the y location in column 5. The code should cycle through the 10 other voids in the table and if their location is within +/- 50 pixels to the new void then some further code is run.
At the moment these if statements seem to be taken as true regardless of what centroid values I put in and I can't see why.
Note that centroid(1) and centroid(2) have been found using regionprops.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Category Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!