contour detection and distance measurement
Hi
I am trying to find the distance between an optical fiber and a reference plane.
The code I am using sees the external profile of the fiber but only generates a small contour around it and only find the flat metal surface in the top right.
The end of the fiber is match headed in this example, in most cases it will be a flat edge.
TL;DR I want to generate a rectangle around the fiber and measure the distance to the reference surface. I know how to do the distance measurement, getting the polygon around the fiber and detecting the reference surface is my issue.
The image comes from a live camera feed, where the fiber does not exist and the reference plane can float in direction a good bit but generally looks like the image below