What I'm trying to do is generate multiple lines on a binary image based on a length and angle. Then return all of the row/column values along with pixel values underneath those lines and place them into a python list. To generate those lines I wrote a function that outputs start and end coordinates of each line. Using these coordinates I want to generate the lines and extract the values.
To extract values from a horizontal line from pixel (0,1) to (3,1) I can do:
a = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
pixels = a[1, 0:3]
or vertical:
pixels = a[0:3, 1]
which returns an array of all the pixel values underneath that line:
array([3, 4, 5])
array([1, 4, 7])
How could I apply this method on lines with an angle? so with an x1,y1 and x2,y2? These return (syntax) errors:
a([0,0], [2,2])
a([0,0]:[2,2])
a[0,0:2,2]
I'm looking for something similiar as 'improfile' in Matlab. Many thanks for your help!