drawing with subpixel precision

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

drawing with subpixel precision

Guy Levy
Hi all,
I’m pretty new to ImageJ and Image processing in general and currently working on an implementation for a point-tracking algorithm in ImageJ.
At the end of the algorithm I have particle positions along a trajectory (an array of Xs and Ys).
The position of the particles is with floating point precision (e.g. x= 12.98, y=23.01) and I would like to display the trajectory with this precision, possibly to animate it and save the original movie with the added trajectories displayed.
If I use the drawLine method then the minimum line width is 1 and I lose the precision.
I tried drawing on the ImageCanvas. That gives me the precision but I cant save it together with the original movie.
I will be happy to get any suggestions.
Guy
[hidden email]
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
Reply | Threaded
Open this post in threaded view
|

Re: drawing with subpixel precision

ctrueden
Hi Guy,

You could do a bilinear interpolation on the four nearest background points
(in your example: (12,23), (12,24), (13,23), (13,24)) to obtain weighted
alpha values for each endpoint over those pixels. For a line, you could
sample it in the center of each column (X), meaning you'd only have to do
linear interpolation with the two nearest points (rows above and below in Y
-- or if the line slope is more vertical than horizontal, instead sample a
point in the center of each row). Then plot each sampled "point" partially
transparent over those pixel values.

Alternately, if performance is not an issue, you could try scaling the image
up by 2x or more, drawing the line with width 1, then scaling it back down.
But that would probably reduce the quality of your image substantially,
depending on your downscaling algorithm.

-Curtis

On 7/28/06, Guy Levy <[hidden email]> wrote:

>
> Hi all,
> I'm pretty new to ImageJ and Image processing in general and currently
> working on an implementation for a point-tracking algorithm in ImageJ.
> At the end of the algorithm I have particle positions along a trajectory
> (an array of Xs and Ys).
> The position of the particles is with floating point precision (e.g. x=
> 12.98, y=23.01) and I would like to display the trajectory with this
> precision, possibly to animate it and save the original movie with the added
> trajectories displayed.
> If I use the drawLine method then the minimum line width is 1 and I lose
> the precision.
> I tried drawing on the ImageCanvas. That gives me the precision but I cant
> save it together with the original movie.
> I will be happy to get any suggestions.
> Guy
> [hidden email]
> _________________________________________________________________
> Be one of the first to try Windows Live Mail.
>
> http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
>