Reputation: 202
I'm trying to develop a solution to segment corneal tomographies, and check for the distance between the cornea and a contact lens. For such, i thresholded the image and extracted the biggest 3 contours, being one of the cornea and the other 2 the interior and exterior edges of the lens.
I need to check for the distance between the green contour and the red one all along the x axis in the image.
I tried to check for contour distance in OpenCV but did not find anything.
Upvotes: 2
Views: 2708
Reputation: 2940
This answer explains how to find the radial distance between the red line and the green line. I have manually edited the image so that only the relevant parts of the image are considered.
The first step is to find a function that describes the curve of the lens (the red line). Scipy can find functions from data. Scipy.interp1d() found the function (in cyan) from the red line's contours:
Next, I could find the distance from the green line (the contours of the cornea), to the nearest point on the curve:
Upvotes: 2