How to deal with floating point coordinate values in image
image-processing, matlab, opencv
Solution
This problem is actually quite a common one in computer graphics. Rasterisation is the problem domain you are currently struggling with. You may find Bresenham's line algorithm a good introduction to the topic. Here is a nice interactive site with a few different rasterisation algorithms.
Hope that helps!
Problem
I am plotting some geometry on an image. The problem is the coordinates are coming out as floats, so I am not able to plot them. As a work around I am using floor(); to truncate it to nearest Integer. This works fine in some cases, except that it shifts my image a little bit. ``` x=9.7 x'=floor(x)= 9 //the plot is now at 9 and not at 9.7 as desired, (this is 'shift') ``` But in cases where my requirement is to draw multiple shapes at equal distance I am facing problem as the shift (because of floor();)is not uniform for each shape. It is just like quantization noise in digital communication. Is there any way I can get around this problem ?