regionprops

11 次查看(过去 30 天)
UMP
UMP 2012-4-15
hello all, I'm having problem to get the region of interest on my final year project. my advisor advised me to use regionprops and boundingbox. however, I didn't understand and didn't know how to manipulate the coding in the example. can anybody teach me how? I really need your help guys. urgent. this is my coding so far.
clc
% img = imread('149.jpg');
% h_im = imshow(img);
% e = imellipse(gca,[100 100 120 120]);
% BW = createMask(e,h_im);
close all
I=imread('149.jpg');
figure, subplot (2,2,1),imshow(I)
Igray = rgb2gray(I);
subplot (2,2,2), imshow(Igray)
Ibw = im2bw(Igray,graythresh(Igray));
Ibw = im2bw(Igray,0.60);
subplot (2,2,3),imshow(Ibw)
Iedge = edge(uint8(Ibw));
subplot (2,2,4),imshow(Iedge)

回答(1 个)

Image Analyst
Image Analyst 2012-4-15
regionprops() is demonstrated well in my image segmentation tutorial, BlobsDemo: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862, including how to get the bounding box of the blobs and to extract each blob out to its own sub-image. It's well commented and should be fairly easy to follow. Take a look at it. You should be able to just replace 'coins.png' (the demo image that ships with MATLAB) with '149.jpg' and adjust the folder name where that file lives, and it should run right out of the box with your image.

Community Treasure Hunt

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

Start Hunting!

Translated by