I never thought of a 4-connected version. I don’t see, off the top of my head, how to do that in a simple, general way. I’ll give it a thought.

]]>This describes the original 8-connected version of the Bresenham algorithm. Any idea how you’d get the 4-connected version, i.e. avoiding moving along the diagonal? I’ve found some implementations of a 2d 4-connected version elsewhere

Best,

Dylan

]]>Great blog btw! I’m glad I stumbled on it.

]]>Look at the comment a few positions above yours, in it Adrian posted the C code for the algorithm as described on this post. Sorry I cannot help you personally with code, I really don’t have the time to do so.

]]>Thanks,

Cheers,

Prajwal ]]>

I don’t have time right now to explain the algorithm in detail, but if you download DIPimage (there’s a link on the right column), you should look for a function called `opticflow`

, which implements the Lucas and Kanade algorithm. It is an M-file, so you can see how it works.

I dont understand how lucas kanade algorithm works to find motion vectors between frames in video. I also want to implement lucas kanade algorithm in matlab. please help me in this regard…. thanks in advance.

]]>