Question
Calculate distances in a shape with Python
I want to calculate the min vertical distance and max horizontal distance of this image.
Like the lines.
I was trying:
_, binary_image = cv2.threshold(image, 0, 255, cv2.THRESH_BINARY)
horizontal_distances = np.sum(binary_image==255, axis=1)
max_horizontal_distance = np.max(horizontal_distances)
vertical_distances = np.sum(binary_image==255, axis=0)
min_vertical_distance = np.min(vertical_distances)
But min_vertical_distance returns 11, which is not accurate.
2 119
2