Moving colored lines smoothly on a gray-scale image [message #78312] |
Mon, 14 November 2011 01:47 |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I've been trying to move markers like lines, squares and crosses on
images. I can pretty well manage this using the
"Set_graphics_function" option of the Device procedure. Here's an
example:
DEVICE, SET_GRAPHICS_FUNCTION = 3 ;Starting graphic settings
tvscl, dist(200) ;Draw something
;Define a square:
StartPosX = [50,50,150,150,50]
StartPosY = [50,150,150,50,50]
Draw the square:
DEVICE, SET_GRAPHICS_FUNCTION = 9
plots, StartPosX, StartPosY, color=255l, /device
Move the square by first drawing over the previous one and then
drawing it in a new position:
plots, StartPosX, StartPosY, color=255l, /device
NewPosX = StartPosX + 10
NewPosY = StartPosY + 10
plots, NewPosX, NewPosY, color=255l, /device
The type of code above I find pretty efficient. However, the drawn
lines have very low contrast when the gray-scale intensity is around
128. Because 128 XOR 255 = 127. Such a situation is visible in the
above code at the corners of the square in the starting position.
Is there a clever way to get around this that is as smooth as the
above?
I would really like to use colored markers that do not vanish when the
contrast is low, but that doesn't work very well (at least not what
I've tried).
I also tried storing the intensities of the image before drawing on
top of it, but that is a slow and annoying process (I used TVRD and
save the image in pointers...). However, it turned out that the image
flickers when moving the objects.
Any tips would be appreciated.
Thanks, Helder
|
|
|