how to calculate distances between pixels on a contour
Hello, I have a contour in OPENCV C++ in the contour format, and I want to measure the distance between each two pixels on the contour ( the number of pixels on the contour between them). It is clear that there are two distances between every two points on a closed contour. I need a clear algorithm or a code to measure these two distances in pixel. Bests,
what do you mean with "It is clear that there are two distances " ?
I added the picture.
The points are given in a vector which has indices, right? Why not just do a difference on the indices in both directions and take the minimum value?
if you use CHAIN_APPROX_NONE, the contours are a "dense" array (no holes between the points).
so just counting how many there are between A and B would give you the L1 (or manhattan) distance.
would that be accurate enough for you ?
Yes Thank you and the rest of the chain will give L2.
@sadegh6383 -- Please add the code if you work it out. :)