Connecting 2 points?

Connecting 2 points?

Portrait de Nick T.

Hi Folks:

I have a image initialized with 0 for every pixel. Then there are tow points between which I would like to retrive a line with each pixel on this line being set to 1.

For the two points, there coordinates (x, y) are known, so the challenge I am facing is to get coordinates of all the pixels on the line (sub-pixel problem) that connects the two points. Once I retrived all (x, y) coordinates for the line, I should set thier value to 1.

Is there any IPP function can do this? Basically, connecting two points, and return the coordinates? Thanks a lot.

Nick

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Sergey Kostrov

Hi Nick,

>>...Is there any IPP function can do this? Basically, connecting two points, and return the coordinates?

Please take a look at Bresenham's Line algorithm for drawing a line between two points.

Best regards,
Sergey

Connectez-vous pour laisser un commentaire.