Azzera filtri
Azzera filtri

How can I find the droplet contact angle of the image using hough transform to determine the boundaries? The code gives me droplet contact angle 0. But I want to calculate the angle the contact surface makes with the bubble.

1 visualizzazione (ultimi 30 giorni)
Irgb = imread('hydrophobe1.jpg'); Igray = rgb2gray(Irgb); BW = edge(Igray,'canny'); [H,theta,rho] = hough(BW);
figure; imshow(imadjust(mat2gray(H)),[],... 'XData',theta,... 'YData',rho,... 'initialmagnification','fit'); colormap(gca,hot);
P = houghpeaks(H,5,'threshold',ceil(.7*max(H(:))));
lines = houghlines(BW,theta,rho,P,'Fillgap',5,'Minlength',7); figure, imshow(Igray), hold on max_len = 0; for k = 1:length(lines); xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'linewidth',2,'color','green');
plot(xy(1,1),xy(1,2),'x','linewidth',2,'color','green');
plot(xy(2,1),xy(2,2),'x','linewidth',2,'color','red');
len = norm(lines(k).point1 - lines(k).point2);
if (len > max_len)
max_len = len;
xy_long = xy;
end
end
plot(xy_long(:,1),xy_long(:,2),'Linewidth',2,'Color','Red');
x1 = xy_long(1); x2 = xy_long(2); x3 = xy(1); x4 = xy(2);
y1 = xy_long(3); y2 = xy_long(4); y3 = xy(3); y4 = xy(4);
theta1 = atan((y1-y2)/(x1-x2)) theta2 = atan((y3-y4)/(x3-x4)) ThetaFinal = abs((theta1-theta2)*(180/pi)
  1 Commento
Image Analyst
Image Analyst il 11 Lug 2017
What is the difference in your mind between the "contact angle" (which you say your code computes) and the "angle the contact surface makes with the bubble" (which you say you need)??? Please attach diagram with lines and angles indicated on it. Read this too.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Mathematics 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!

Translated by