Detection of two diffuse liquid fronts and tracking their evolution with time. Two liquids - water and a blue polymer solution are ascending against gravity on a strip of paper. I need to track their speed of ascent and interface-separation

3 views (last 30 days)
<<
<<
<<
>>
>>
>> I have a sequence of images (from a video) that show the rise of two liquids (colorless water and a blue liquid on a strip of paper. I need to find out:
1. How the mean height of the two liquid columns/ fronts changes with time,
2. The speed of this i.e. the rise velocity
3. The distance between the two interfaces (with time).
I started by extracting the blue channel but found the red one to be better. So, I'm working with the red channel now. My code below tries to track the interfaces inside a small window where the relevant action takes place. I tried to capture the first, second and third derivatives of the pixel value plot with height for a single frame in the hope of identifying a point of inflexion/ saddle point or some sort of local extrema that reflect the two real liquid interfaces (faint interface for water and sharper for the blue liquid) but am unable to correlate these plots with the actual physics. These graphs seem to have peaks and valleys at locations where nothing apparently happens and seem to miss the real discontinuities in the interfaces. My code goes like this (for an individual single image, this needs to be iterated in a time loop for the entire sequence):
%Read nth image!
A=imread('image_n.bmp');
B1=A(:,:,1);
%Select a window for reading image
C=size(B1);
d=C(:,2);
h=C(:,1);
if mod(d,2)==0
f=d/2;
else f=(d+1)/2;
end
if mod(h,2)==0
i=h/2;
else i=(h+1)/2;
end
G1=B1([i:h],f);
P=size(G1);
q=P(:,1);
J=[1:q];
%Averaging over 100 strips around the center-line
for r=f-50:f+50
H=mean(B1(i:h),r);
end
A1=B1(i:h);
Z=A(i:h,:,1);
imtool(Z)
Hs=smooth(H);
%Calculating first, second and third derivatives
D1=diff(Hs)./diff(J');
D1s=smooth(D1);
K=[1:q-1];
plot(K,D1s);
D2=diff(D1s)./diff(K');
D2s=smooth(D2);
L=[1:q-2];
plot(L,D2s);
D3=diff(D2s)./diff(L');
D3s=smooth(D3);
M=[1:q-3];
plot(M,D3s);
%Finding peaks in the derivatives to locate possible inflection points
%which may indicate discontinuities in interfaces
height=3;
[peaks,locs]=findpeaks(D2s, 'minpeakheight', height);
I have also tried to locate the inflexion points directly using the triple derivative test but the results I'm getting are not really the locations where something relevant happens. The plots also do not show peaks/valleys at the real points of discontinuity. Please help.
  1 Comment
Image Analyst
Image Analyst on 28 Jan 2014
Edited: Image Analyst on 28 Jan 2014
Finally a post where the author gets it right on the first try. Good, clear explanation (no "text-speak", misspellings, bad grammar, etc.), properly formatted code, attached images, good tags, etc. I wish everyone's post was this good. I won't be able to look at it until tomorrow though. I do analyses like this all the time (color segmentation, video analysis, dynamic scene analysis, etc.). You'll need a calibration image unless you're willing to have your units be pixels instead of millimeters.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 29 Jan 2014
I'm doing a similar thing right not to find the width and length of fluorescent strips. Yes the red channel will have the most contrast, so take that then take the mean across columns to get the vertical profile
verticalProfile = mean(redChannel(:, column1:column2));
Then look for where it's darker than some value
itsDark = verticalProfile < 50; % or whatever value you want.

More Answers (0)

Categories

Find more on C4ISR in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!