С строкой изображения scikit () , например:
import numpy as np
from skimage.draw import line
from skimage import io
# Create image
img = np.zeros((50, 50), dtype=np.uint8)
# Get row and col of pixels making line from (4,9) to (12,30)
rr, cc = line(4, 9, 12, 30)
print(rr)
array([ 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10,
10, 11, 11, 12, 12])
print(cc)
array([ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30])
# Visualise as image instead of list
img[rr, cc] = 255
io.imsave('result.jpg',img)