If statement with multiple conditions
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Image Category Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!