image_folder = '/Volumes/Untitled/MATLAB copy/Foam_Experiments_inj_pressure/V3 @300mbar/2019-11-21_10-31-53';
filenames = dir(fullfile(image_folder, '*.jpg'));
total_images = numel(filenames);
for n = 1:total_images
f= fullfile(image_folder, filenames(n).name);
our_images = imread(f);
figure (n)
J = imrotate(our_images,90,'bilinear','loose');
K=imcrop(J,[0.5 1220.5 5504 5810]);
red=K(:,:,1);
green=K(:,:,2);
blue=K(:,:,3);
channel1Min = 225.000;
channel1Max = 255.000;
channel2Min = 210.000;
channel2Max = 252.000;
channel3Min = 210.000;
channel3Max = 255.000;
BW = (K(:,:,1) >= channel1Min ) & (K(:,:,1) <= channel1Max) & ...
(K(:,:,2) >= channel2Min ) & (K(:,:,2) <= channel2Max) & ...
(K(:,:,3) >= channel3Min ) & (K(:,:,3) <= channel3Max);
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
morph=bwmorph(BW,'erode');
dilate=bwmorph(morph,'dilate',1);
BW2 = bwareaopen(dilate,20);
numWhitePixels = numel(BW2)
end
0 Comments
Sign in to comment.