How to fit an ellipse and line to droplet image?

12 views (last 30 days)
Stephen Merriman
Stephen Merriman on 12 Feb 2020
Edited: Eleanor Betton on 27 Feb 2020
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.
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
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.

Answers (1)

Eleanor Betton
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 ( 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?

Community Treasure Hunt

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

Start Hunting!