How can I extract a part of an image?
15 views (last 30 days)
Show older comments
Hey, I'm new in Matlab and I'm working on mammograms, I need to extract the central region of the image and then calculate a few things. I don't know how to do this...Can you please help me with some code..
2 Comments
Image Analyst
on 21 Mar 2021
I doubt they've been trying to get it working for the past 4 years but since it was so long ago, they might not answer you and you'd be better off starting your own question and attaching the image and indicate what part you want to "extract" and what the "few things" are. In the meantime, see the Image Segmentation Tutorial in my File Exchange
Answers (2)
Image Analyst
on 17 Mar 2017
Some useful demos are in my File Exchange. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Or else post your image and some specific question.
5 Comments
Archana Sr
on 16 Jul 2020
Showing error like, Error in using regionprops expected input number 2,L to be one of these type etc..
Image Analyst
on 16 Jul 2020
This works fine:
% Read in mask image.
mask = imread('image.bmp');
mask = mask(:, :, 1) > 0; % Convert to logical/binary
% Display it.
hFig = figure;
subplot(2, 1, 1);
imshow(mask);
hold on;
hFig.WindowState = 'maximized';
% Make measurements
props = regionprops('table', mask, 'Area', 'Perimeter', 'Eccentricity')
props =
2×3 table
Area Eccentricity Perimeter
______ _________________ _________
302517 0.742397889745183 3425.716
171557 0.755030557816219 3159.85
If it doesn't work for you, what version do you have? If you have an old version, try getting rid of the 'table' option and try again.
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!