help with image processing
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a sequence of images whose area properties I wish to obtain. For this, I have to find the envelope of the object. In the 'samples.jpg' image attached here, we can see on the left column 4 grayscale images and on the right column the corresponding binary images. However, this almost gives me the area I need but not exactly. The area actually desired is that highlighted in the blue boundary, drawn by hand, in 'required.jpg'. I have provided 'L10_T1_A0.zip' which contain more such samples.
This is what I have been doing to get the area (more importantly the B/W binary image of the required shape). How can I get a better 'Ioppened' image?
half_Imr --> is the grayscale image on the left column of 'samples.jpg'
Iopenned --> is the binary image on the right column of 'samples.jpg'
get_area_from_image --> another custom function to get the area using 'regionprops' MATLAB function
level = 0.3;
I_BW = imbinarize(half_Imr,level); %binary image seen on right column of 'samples.jpg'
morph_rect = [4 39];
Ifill = imfill(I_BW,'holes');
se = strel('rectangle',morph_rect);
Iopenned = imopen(Ifill,se);
% evaluating area swept by ribbon
pixel2mm = 19/60; % Calibration from pixel to mm
Aimage = get_area_from_image(Iopenned, pixel2mm);
----------------------------------------------------------------------------------
function Aimage = get_area_from_image(Iopenned, pixels2mm)
%%This function gives the area
Iregion_temp = regionprops(Iopenned, 'Area');
[sz,~] = size(Iregion_temp);
temp = struct2cell(Iregion_temp);
temp1 = cell2mat(temp);
if sz > 1 %multiple clusters of white area in image giving multiple areas
Aimm2 = max(temp1 );
elseif isempty(temp1) == 0
Aimm2 = temp1 ;
else
Aimm2 = 0;
end
Aimm2 = Aimm2*pixels2mm^2;
Aimage = Aimm2*1e-6; %m^2
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Feature Detection and Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!