I want to find the distance between 2 irregular edges in a binary image. That is I have marked with red on the below image. My idea was to draw a colored line (say red) on both the edges and then calculate the distance between them at 10 equal intervals (yellow-colored marking)
I cropped the image into two. Say the top half is
Bottom half is
I want to draw the two red lines or just find the distance between those two somehow. I have been using OpenCV and PILLOW for a lot of steps.
there are also image instances where at few columns there are no black pixels in the top image. How do i calculate the distance of the black pixels only from the top? Just the top image.




