How can i get label in condition
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
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
0 个评论
回答(1 个)
  Walter Roberson
      
      
 2013-2-22
        RR = find(aspectRation < 1.6);
2 个评论
  Walter Roberson
      
      
 2013-2-22
				Sorry, aspectRatio is correct.
What happens when you attempt to use the code ?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!