Droplet Contact Angle Measurement

14 ビュー (過去 30 日間)
Voon Loong
Voon Loong 2012 年 8 月 19 日
Hi,
I am using the code below to generate the droplet image and measure the contact angle. After truncation, I only can get the subtrate image but not the actual droplet image i need. Can somebody help me to look into it?
Thanks you.
% Surface Tension Measurements Using the Pendant Drop Method
[filename, pathname] = ...
uigetfile({'*.jpg';'*.tif';'*.gif';'*.*'},'Select an image'); %Open standard dialog box for retrieving files
rgbImage = imread([pathname,filename]);
im = im2double(rgb2gray(rgbImage)); % Convert image to gray
imshow(im); % Display image
BW = im2bw(im);
L = bwlabeln(1-BW, 4); % Label White Spots
S = regionprops(L, 'Area'); % Measure Area of Spots
BW2 = ismember(L, find([S.Area] ==max( [S.Area]) )); % Find Largest Spot
BW2(1,:) = 1; % Turn First Row White
imshow(BW2);
figure(2);clf;
BW3 = imfill( BW2, 'holes' ); % Fill In Holes in Image
imshow(BW3);
[x_coordinates y_coordinates Pixel_vals] = impixel;
rot_line = polyfit(x_coordinates ,y_coordinates ,1 ); % Replicate Substrate
rot_point = round( polyval( rot_line, 1 )); % Truncation Point
rot_angle = atan( rot_line(1) ); % Correction Angle
BW4 = BW3( rot_point:end,: ); % Truncation
BW4 = imrotate( BW4, -rot_angle*180/pi ); % Correction
BW4 = BW4( -y_coordinates(2) + rot_point:end,: ); % Truncation Correction
imshow( BW4 ); % Display Image
Function_ContactAngleb([200 300], 250, BW4)
[val, status, message] = fminsearch( @(cntr_radius) ...
Function_ContactAngleb( cntr_radius(1:2), cntr_radius(3), BW4 ), ...
[200, 200, 100], optimset('display', 'iter' ) );
crcl = Function_ContactAngle( val(1:2), val(3), size(BW4) ); % Optimized Generated Circle
imagesc( 10*crcl+BW4 ); % Picture/Optimization Overlay
axis image; % Show axes
% Math manipulation to calculate contact points based on radius and
% location of the center of the circle
contact_pt = [ (sqrt( val(3)^2 - ( 1-val(1) )^2 ) + val(2)), ...
-(sqrt( val(3)^2 - ( 1-val(1) )^2 ) + val(2)) ];
% Determine tangent lines of contact points
tangent_slope = -( contact_pt-val(2) )/( 1-val(1) );
contact_angle = atan(tangent_slope); % Contact Angle
contact_angle = (contact_angle*180/pi); % Radians to Degrees
corrected_angle = [ mod( 180-contact_angle(1), 180 ),...
mod( 180+contact_angle(2), 180)]; % Correction for proper domain
return
%*******************************************************************************
% Finish Main Program
  2 件のコメント
Image Analyst
Image Analyst 2012 年 8 月 19 日
And how can we do that? (Put yourself in our position and think a minute.)
Walter Roberson
Walter Roberson 2012 年 8 月 20 日
... For example, is the cameraman image a suitable input?

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 8 月 20 日
Your array Function_ContactAngle is not initialized anywhere in the code you show.
The portion of your code starting at "Math manipulation" references the variable "val" which is previously unreferenced.
A reasonable hypothesis would be that the portion of your code starting at "Math manipulation" should be a function named Function_ContactAngle .
With regards to plotting not working as you expect, please read my graphics advice in http://www.mathworks.co.uk/matlabcentral/answers/22208-show-figure
  4 件のコメント
Voon Loong
Voon Loong 2012 年 8 月 21 日
編集済み: Walter Roberson 2012 年 8 月 21 日
Hi,
Thanks for your reply.
I have a problem when I need to truncate the substrate in order to get my actual droplet especially when those droplet with reflection on the substrate. Is it the problem with the truncation?
[x_coordinates y_coordinates Pixel_vals] = impixel;
rot_line = polyfit(x_coordinates ,y_coordinates ,1 ); % Replicate Substrate
rot_point = round( polyval( rot_line, 1 )); % Truncation Point
rot_angle = atan( rot_line(1) ); % Correction Angle
BW4 = BW3( rot_point:end,: ); % Truncation
BW4 = imrotate( BW4, -rot_angle*180/pi ); % Correction
BW4 = BW4( -y_coordinates(2) + rot_point:end,: ); % Truncation Correction
imshow( BW4 ); % Display Image
Kind regards,
Voon Loong
Walter Roberson
Walter Roberson 2012 年 8 月 21 日
I do not understand what you mean by "truncation" in this context?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by