this is far from being efficient, it uses too many image processing commands and could hardly be less elegant. But it does find the edge - more or less.
This was because I imported the file by “pulling it from the post”. If I get it into Mathematica using Import I get what you report. That is curious because in both cases the image has the same resolution, i.e. ImageDimensions gives the same, namely {1311, 976}. Also the different result does not seem to depend on the parameter of EdgeDetect.
it is nice that you like my “solution”, I basically don’t do anything - it is more a demonstration of the ability of Mathematica.
And still the original problem is not solved: To recognice the border of lenses in a whole series of similar but different pictures. A slight variation - as you just found out (a really strange effect!) - ruins everything. I think an enhancement of the contrast (e.g. with ImageAdjust[img, 2]) might help a little.
which actually does the work by selecting the outermost closed contour. (If this contour is not closed one gets the next closed one, the result then is the picture in Marco’s last post.)
The original picture has a very sharp edge on its left side, therefore DeleteBorderComponents is necessary.
Finally Binarize to get {0 or 1} and Thinning to make the contourline “slim”.