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.
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.