# How to Draw Line at non-integer pixel cooridantes on Image

I have lines (or segments really) I want to draw into a new image I. Let's define the intensity of the pixel at row = r and col = c as I(r,c). However, the lines are defined by 2 points whose coordinates are not integers.

For example, one line might be from point A (with row = 2.2 and col = 3.5) and to point B with (row = 10.8 and col = 30.4).

What is the algorithm or method for filling in the intensity values of image I at the integer rows and cols?

• Did you look at en.wikipedia.org/wiki/Xiaolin_Wu's_line_algorithm ? – Hilmar Jul 20 '17 at 1:18
• @Hilmar Thank you for mentioning this algorithm I did not know about – Laurent Duval Jul 20 '17 at 5:19
• @Hilmar You should add that as an answer, perhaps quoting some of the text. – Peter K. Jul 20 '17 at 10:51