radius of my image?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
% r= sqrt((X-x1).^2+(Y-y1).^2);
% t= atan2(y1,x1);
0 comentarios
Respuestas (1)
Jon
el 28 de Jul. de 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 comentarios
Jon
el 13 de Ag. de 2015
Editada: Jon
el 13 de Ag. de 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.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!