Image processing of miscible displacement experiment.
2 views (last 30 days)
Show older comments
I have 2D images of two miscible fluids. Let's assume I have two images, one reference and target. There is two main regions in each image. Pore space (filled by fluid) and rock space (or background which is yellowish (or cream)). ROI is pore space. What I am trying to do is using fully saturated image (reference) to define the ROI (where the fluid is). Then process pore space of target image (the saturated model is flooded with another fluid) to capture where is fluid A (initial colour (here blue)) and where is fluid B (secondly injected white fluid) and also catch the transition zone between them. Both are attached in following. I am using the code below but can not figure out how to mask out the image.
reference image

Target image:

one of the processed images is attached as well. What I want is getting rid of the blue background from each processed image.

if truefigure
clear M
d=dir('reference.JPG');
min_sat_ref=0;
max_sat_ref=0.1;
% defines color range over which saturation is kept (ie. relates to the colour range of the dye (in this case a pinkish red colour).
dye_hsv_min_limit = 0.1;
dye_hsv_max_limit = 0.11;
% read "final" reference image and set max saturation accordingly
finalname = 'target.JPG';
I=imread(finalname);
Ihsv = rgb2hsv(I);
S = Ihsv(:,:,2) .* ( (Ihsv(:,:,1) < dye_hsv_min_limit) | (Ihsv(:,:,1) > dye_hsv_max_limit) );
s=sort(S(:));
max_sat_ref = s( round(0.98*length(s)) ); % cycle thru each image in turn
for i=1:length(d)
I= imread(d(i).name); Ihsv = rgb2hsv(I);
S = Ihsv(:,:,2) .* ( (Ihsv(:,:,1) < dye_hsv_min_limit) | (Ihsv(:,:,1) > dye_hsv_max_limit) );
subplot(2,1,1)
imagesc(I);axis equal tight;
title(d(i).name);
subplot(2,1,2);
% scale image to 0..100 where the estimated max saturation goes to 100 % and virtually no saturation goes to zero.
imagesc( min( 100*S / max_sat_ref , 100 ) );
caxis([0 100]);
axis equal tight
colorbar
drawnow;
M(i)=getframe(gcf);
end
% and just plot the reference to complete the process
I=imread(finalname);
Ihsv = rgb2hsv(I);
S = Ihsv(:,:,2) .* ( (Ihsv(:,:,1) < dye_hsv_min_limit) | (Ihsv(:,:,1) > dye_hsv_max_limit) );
subplot(2,1,1)
imagesc(I);axis equal tight;
title(finalname);
subplot(2,1,2);
imagesc( min( 100*S / max_sat_ref , 100 ) ); caxis([0 100]);
axis equal tight
colorbar
drawnow;
M(end+1)=getframe(gcf);
Thanks in advance,
0 Comments
Answers (0)
See Also
Categories
Find more on Green 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!