필터 지우기
필터 지우기

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 (최근 30일)
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
Image Analyst
Image Analyst 2017년 7월 11일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by