I have a cylindrical object which is being looked at from a sideways perspective. I know the pixel locations on the sides of the lines. How can I straighten these lines?
I have drawn a small example image.
edit: attached real example:
points order is top left - top right, second top left - second top right etc
import cv2
image = cv2.imread('image.jpg')
points = [[946, 721],[1814, 864],[934, 729],[1806, 874],[934, 729],[1806, 874],[923, 737],[1798, 885],[923, 737],[1798, 885],[912, 745],[1790, 896],[912, 745],[1790, 896],[900, 755],[1781, 909],[900, 755],[1781, 909],[889, 764],[1773, 922],[889, 764],[1773, 922],[877, 775],[1764, 936],[877, 775],[1764, 936],[866, 786],[1755, 951],[866, 786],[1755, 951],[854, 798],[1746, 966],[854, 798],[1746, 966],[843, 810],[1737, 983],[843, 810],[1737, 983],[832, 823],[1728, 1000],[832, 823],[1728, 1000],[820, 836],[1719, 1017],[820, 836],[1719, 1017],[809, 850],[1710, 1036],[809, 850],[1710, 1036],[798, 865],[1700, 1055],[798, 865],[1700, 1055],[787, 880],[1691, 1075],[787, 880],[1691, 1075],[777, 896],[1681, 1095],[777, 896],[1681, 1095],[766, 912],[1672, 1116],[766, 912],[1672, 1116],[756, 929],[1663, 1138],[756, 929],[1663, 1138],[745, 946],[1653, 1160],[745, 946],[1653, 1160],[735, 963],[1644, 1183]]
circles_image = image.copy()
for point in points:
circles_image = cv2.circle(circles_image, (int(point[0]), int(point[1])), 1, (255, 255, 255), 12)
cv2.imshow("test_img", mat=circles_image)
cv2.waitKey(0)