radius of my image?

1 vue (au cours des 30 derniers jours)
Hever castellanos
Hever castellanos le 27 Juil 2015
% r= sqrt((X-x1).^2+(Y-y1).^2);
% t= atan2(y1,x1);

Réponses (1)

Jon
Jon le 28 Juil 2015
For the image you provided, you could simply compute the diameter by taking the difference between the max and min y-values of the membrane:
[x y] = find([your_image]); % returns coordinates of white pixels
r = (max(y)-min(y))/2; % computes radius
Of course, this only works if there are no aberrations at the top or bottom of the membrane. It might also be sensitive to a noisy edge. Not robust, but quick and easy.
If you want to compute the area (in pixels) of the entire membrane, including the aberration on the left side, you could simply write
area = sum(sum(imfill(your_image,'holes')));
If you want a more robust method, I think the functions bwboundaries and regionprops might be helpful. Check out the tutorial here to get started.
  2 commentaires
Jon
Jon le 12 Août 2015
Modifié(e) : Jon le 12 Août 2015
I guess I don't understand what you're trying to quantify. The area of the green pixels? The area of the red pixels? Are you just trying to fit a circle to the extent of the green portion? It's not clear what you'd like for a final result.
Jon
Jon le 13 Août 2015
Modifié(e) : Jon le 13 Août 2015
If you have multiple cells to process, and the bump on the left could be anywhere along the circumference in each cell (or may not be there at all, or there may be multiple bumps, etc), your method will not handle these cases without manual intervention. If that is OK with you, then proceed the way you are. However, I would think that you would want to make the code generalizable to many cases, and I think a better way to do that would be to fit a circle to all the edge cells. You could use this function, for example: http://www.mathworks.com/matlabcentral/fileexchange/5557-circle-fit
If you still prefer to manually remove portions of the image, you can find the intersecting points using intersections.m from the File Exchange. You'll need to make sure your x,y are in the same reference frame (in images, y is positive as you move downward).
Once you have the intersections, you can use poly2mask to remove those portions of the image.

Connectez-vous pour commenter.

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by