Measuring Binary Image Data

3 次查看(过去 30 天)
See attached file for my binary image. I have two questions:
Do any of you know how I can measure the more linear "body"? Right now my program is measuring the bottom cluster of pixels when I want it to measure the linear body.
My code for this:
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'all');
% Crop it to the bounding box.
bb = measurements.BoundingBox;
My other question is is it possible to just measure the right hand side of the linear portion of pixels and ignore the "tail end" on the left hand side where it makes a 90 degree angle?
If you need further details please let me know. Thanks!

采纳的回答

Image Analyst
Image Analyst 2012-10-4
Why don't you just crop off the bottom half of the picture, then call regionprops()? Or you can measure them all but just recognize which blob is the one you're interested in and ignore the rest. Looks like it would be blob #4 or 5 or so. But actually your program measures ALL blobs, not just the ones at the bottom - not sure why you thought that.
  2 个评论
Image Analyst
Image Analyst 2012-10-4
Responding to your "Answer" below...
Labeling goes from the top left to bottom left, then goes across the columns. You can transpose your image (with ') to get the same effect as going across columns first and then down rows. Transposing will allow you to detect the regions at the top first, before the blobs at the bottom.
Image Analyst
Image Analyst 2012-10-4
You probably can automate it more. But you only gave one image and I have no idea what distinguishes the desired blobs from the undesired blobs. You can check out my BlobsDemo in my File Exchange for examples of how to extract out just the desired blobs: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

请先登录,再进行评论。

更多回答(1 个)

Coulton
Coulton 2012-10-4
The problem is the "blobs" aren't always near the bottom. Many times they can be in the middle as well so a simple imcrop won't usually work. I know that my 'All' measures each blob, but I was curious if there was a way for the function to start looking from the top instead of the bottom.
  2 个评论
Image Analyst
Image Analyst 2012-10-4
Was this supposed to be a comment to my Answer?
Coulton
Coulton 2012-10-4
Yes. I have been doing imcrop so far, but I have to change the dimensions regularly because the "blobs" are in a different location. I am just trying to find out if I can make this process more automated.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by