Re: Moving colored lines smoothly on a gray-scale image [message #78309] |
Mon, 14 November 2011 05:38 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Helder Marchetto writes:
> PS: I left the post in case anybody does a search coming from a
> similar problem. I had trouble to find this and the right keyword was
> Rubberband box. Apparently I must first learn the name of what I'm
> looking for before I can find it :-)
What were you searching for? I'll add the search terms
to the article.
Cheers,
David
P.S. Yes, Device-Copy is the smoke and mirrors solution
to nearly all graphics problems in IDL. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Moving colored lines smoothly on a gray-scale image [message #78311 is a reply to message #78309] |
Mon, 14 November 2011 02:49  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Nov 14, 10:47 am, Helder Marchetto <hel...@marchetto.de> wrote:
> 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
OK... I solved my problem by doing a better search on the web.
David Fanning already showed a good solution to this problem by using
the COPY keyword for DEVICE. The image (background) can be copied into
a pixmap window (WINDOW, /PIXMAP) and then quickly redrawn by using
the DEVICE, COPY= [...] procedure.
Great tip David, saved my day.
Cheers, Helder
PS: I left the post in case anybody does a search coming from a
similar problem. I had trouble to find this and the right keyword was
Rubberband box. Apparently I must first learn the name of what I'm
looking for before I can find it :-)
|
|
|