comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to draw a line on an image?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to draw a line on an image? [message #5652] Wed, 31 January 1996 00:00
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) wrote:
>
> Hello IDL experts,
>
> Is there a handy way to draw lines on an image in IDL?
>
> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far.

You might try using the normal drawing routines, like PLOT, OPLOT
and PLOTS, but set the graphics mode to XOR (exclusive-or) mode
like the following:

< xarray and yarray are integer arrays of coordinates >

wset, current_window
device, get_graphics = oldg, set_graphics = 6
plots, xarray, yarray, /device

This "draws" the lines on your image by XOR'ing all pixels. What
you get is usually not one continuous color, depending on the
contents of the image, but it may be workable. You can then
"undraw" the lines and restore the original image with:

plots, xarray, yarray, /device
device, set_graphics = oldg

Usually you will also want to restore the original graphics mode,
since most drawing operations are done using a different mode.

Hope this helps.

Dave Foster
UCSD Brain Image Analysis Lab
foster@bial1.ucsd.edu
Re: How to draw a line on an image? [message #5658 is a reply to message #5652] Tue, 30 January 1996 00:00 Go to previous message
kennealy is currently offline  kennealy
Messages: 11
Registered: August 1994
Junior Member
"Ian E. Sprod" <Ian.Sprod@gsfc.nasa.gov> writes:

> yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) wrote:
>> Hello IDL experts,
>>
>> Is there a handy way to draw lines on an image in IDL?
>>

> I think "oplot" is what you need.

Actually, "plot" with the /noerase option will be a better choice.
Re: How to draw a line on an image? [message #5663 is a reply to message #5658] Mon, 29 January 1996 00:00 Go to previous message
Hermann Mannstein is currently offline  Hermann Mannstein
Messages: 22
Registered: September 1995
Junior Member
Hiro Yoshida wrote:
>
> Hello IDL experts,
>
> Is there a handy way to draw lines on an image in IDL?
>
> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far. Any suggestions are welcome.

Hi, look for the cw_defroi.pro within the lib directory of your IDL, but basically
you have to give some pixels of the display another color to see them ;-)

--
Regards,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Hermann Mannstein Tel.: +49 8153 28-2503
Institut fuer Physik der Atmosphaere or -2558
DLR - Oberpfaffenhofen Fax.: +49 8153 28-1841
Postfach 1116 \ mailto:H.Mannstein@dlr.de
D-82230 Wessling \ 0 http://www.op.dlr.de/~pa64
Germany ________\/|________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`--------\--------'~ ~~~~~~~~~~~~~~~~~~~~
\
Re: How to draw a line on an image? [message #5665 is a reply to message #5663] Mon, 29 January 1996 00:00 Go to previous message
offenbrg is currently offline  offenbrg
Messages: 31
Registered: August 1993
Member
yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) writes:

> Hello IDL experts,

> Is there a handy way to draw lines on an image in IDL?

> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far. Any suggestions are welcome.


I believe that the routine you want is "plots" (not "Plot"), which
allows you to draw graphics on a TV window (such as lines, circles, etc).
Also tvcircle and tvbox.

Now, this does change the image as stored in the window. The array stored
in memory will not be changed by this. There isn't really any way to
"overlay" in video memory without altering the contents of the window.

What you *could* do is copy the image into a pixmap window, so you can
recover it unchanged after you've finished with the graphics. The only
other trick I can think of involves using a 24-bit display...

Joel


--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ ----------
| Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov |
| Hughes STX, NASA/GSFC/LASP | I get paid to stare into space. |
Re: How to draw a line on an image? [message #5666 is a reply to message #5663] Mon, 29 January 1996 00:00 Go to previous message
Ian E. Sprod is currently offline  Ian E. Sprod
Messages: 12
Registered: February 1995
Junior Member
yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) wrote:
> Hello IDL experts,
>
> Is there a handy way to draw lines on an image in IDL?
>

I think "oplot" is what you need.

--

Ian E. Sprod | 301-286-8036 | FAX 301-286-1616 | ian@skye.gsfc.nasa.gov
Hughes STX, Code 921, NASA/Goddard Space Flight Center, Greenbelt, MD 20771
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Random # generator?
Next Topic: Re: Problem addressing arrays from C routines running OSF

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:06:01 PDT 2025

Total time taken to generate the page: 0.00554 seconds