Given a simple example of code that draws lines between given coordinates with the use of ax.plot()
import matplotlib.pyplot as plt
x_values = [0, 2, 4, 5]
y_values = [3, 1, 5, 2]
fig, ax = plt.subplots(1, 1)
ax.set_xlim(0,5)
ax.set_ylim(0,5)
ax.plot(x_values, y_values)
plt.show()
In order to do image processing, I need the raw pixel data (b/w is sufficient) of that image, in a given pixel size, let it be [MxN]
, given just the line endpoint coordinates The data I am looking at would be an array with the dimensions of [MxN]
just containing out of 0
and 1
.
Of cause there is interpolation needed, depending on the pixel size.
In my specific use case, I have very much and complex lines that are drawn with ax.plot()
, so I wont be able to interpolate each line manually.
As I saw, there is ax.imshow()
, but this will not return a matrix/vector.
Does anybody have an idea?