How to fit an ellipse and line to droplet image?
4 views (last 30 days)
Show older comments
I am trying to use MATLAB to measure the contact angle of a droplet on a substrate from an image file, see below for what I mean by contact angle.
![Contact-angle.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271238/Contact-angle.jpeg)
Basically, the method is to first fit a line to where the droplet contacts the substrate, ignoring the reflection, and then fit an ellipse to the curved boundary of the droplet. From there, the contact angle can be easily calculated by getting the tangent line of the ellipse where the ellipse and the contact line meet and then calculating the angle between the tangent line and the contact line. My images look like what is shown below.
![glass slide 1 right.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271239/glass%20slide%201%20right.jpeg)
I can easily crop the image to remove the needle and also convert the image to binary using a threshold since the droplet is much darker than the background. However, what I do not know how to do is have the code detect the curved boundary of the drop to fit to an ellipse equation and also to detect the line where the droplet contacts the substrate, without it getting confused by the reflection. There is some code out there, but none seems to work reliably, especially with my images.
0 Comments
Answers (1)
Eleanor Betton
on 27 Feb 2020
Edited: Eleanor Betton
on 27 Feb 2020
You need to start by binarizing the image and isolating the drop. Then you need to look for the two extermities left and white. You should be able to fit a line between these 2 points which will be your liquid solid interface. You can then fit a cicle (https://blogs.mathworks.com/pick/2008/03/14/fitting-a-circle-easily/) and find the intersect between the line and the circle. Find the tangent of the circle at the edge point and then calculate the angle between the two lines.
You could skip the circle fit part and just fit a line to the edge few pixels of the citcle?
What aspect are you finding whcih is unreliable?
1 Comment
Eleanor Betton
on 27 Feb 2020
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!