It looks a very simple question.
There are many lines available as their two endpoints.
The question is how to discretize them into a matrix. Then the matrix can be used for image processing purposes.
At the following figure example lines (yellow) and their corresponding pixelated demonstrations are shown.
A piece of code in any language would be of great help and strongly recommended and of course is in advance appreciated.
Note that performance and accuracy are very important factors.
Also as demonstrated each point of line must have only one pixel (i.e., element of matrix) associated.
Codie CodeMonkey
The easiest way is to use Bresenham's algorithm.
来源:https://stackoverflow.com/questions/8397247/how-to-pixelate-a-set-of-lines-into-a-matrix