How can i get label in condition
Afficher commentaires plus anciens
Hi everyone.
I searching a method for connected component.
I used this code.
[lbimg numBlob] = bwlabel(resultG, 8);
stats = regionprops(lbimg, 'BoundingBox', 'Area');
allBlobAreas = [stats.Area];
%loop through all blobs, putting up Bounding box
for k = 1 : numBlob
boundingBox = stats(k).BoundingBox; % Get box.
x1 = boundingBox(1);
y1 = boundingBox(2);
x2 = x1+boundingBox(3)-1;
y2 = y1+boundingBox(4) -1;
verticesX = [x1 x2 x2 x1 x1];
verticesY = [y1 y1 y2 y2 y1];
aspectRatio(k) = boundingBox(3) / boundingBox(4);
end
as you know, i got a aspect ratio of each label.
but i want to get a any result image(or Mat) labels in my condition.
example
if aspectRatio(k) < 1.6
RR = 1;
else
RR = 0;
... exactly..how can i get filtered labels with aspectRatio.
I'm not good at English. sorry..please note...
thanks for watching
Réponses (1)
Walter Roberson
le 22 Fév 2013
RR = find(aspectRation < 1.6);
2 commentaires
Walter Roberson
le 22 Fév 2013
Sorry, aspectRatio is correct.
What happens when you attempt to use the code ?
Catégories
En savoir plus sur Line Plots 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!