image processing - testing blobs individually in matlab -
i have image contain many blobs . problem how test each blob individually masking on original image?! tried code did not know how complete it
labelledimage = bwconncomp(segmentedimage); stats = regionprops(labelledimage, 'all'); centroids = cat(1, stats.centroid); [row ,col] = size(centroids); = 1 : row areamatr(i) = stats(i).area; % gives area each blob in image % have put here testing blob , masking out on % original image? help? end
it may more prudent use bwlabel
instead, assigns unique id each unique blob in image. first output gives labelling , second output gives total number of unique ids / blobs in image. bear in mind image needs binary, given choice of variable name, i'm assuming true.
once find unique ids, can loop through each unique id, mask out blob , apply regionprops
blob.
something this:
%// apply bwlabel image [labelledimage, numlabels] = bwlabel(segmentedimage); %// each label... idx = 1 : numlabels %// create mask particular blob mask = labelledimage == idx; %// apply regionprops on mask stats = regionprops(mask, 'all'); %// use stats , mask in way see fit %// ... %// ... end
Comments
Post a Comment