Re: Display two images on one position [message #28627] |
Wed, 02 January 2002 14:57 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Emmler, Oliver" <oemmler@ix.urz.uni-heidelberg.de> writes:
>> But this goes even further afield from "easy" than my
>> previous example, so I'm not sure it would meet
>> your criteria. :-)
>
> Thanks. I tried using your procedures. The scaling of the colortable/images
> will cause the picture to lose details. I think i have to use the following
> loop. Is there any way to speed it up ?
>
> FOR x = 0,510 DO BEGIN
> FOR y = 0,510 DO BEGIN
> IF highlight(x,y) NE 0 THEN TV, highlight(x:x+1,y:y+1),x,y
> ENDFOR
> ENDFOR
This may seem obvious, but if you only want to update a part of an
image, but keep the rest the same, why don't you keep a copy of the
preexisting screen image in memory. I.e., if you want to keep the
rest the same, then you better keep your own copy of the "rest." You
could wrap this in your own TV-like function.
pro mytv, img, highlight
common mytv_common, screenimg
if n_elements(screenimg) EQ 0 then begin
screenimg = img
endif else begin
wh = where(highlight, ct)
if ct then screenimg(wh) = img(wh)
endelse
tv, screenimg
end
Of course this is all toy code here, you have to deal with cases like
the image size changes, etc. Another possibility is to read the
screen image every time using TVRD() but that can get to be hairy with
true color, and/or a performance bottleneck.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Display two images on one position [message #28630 is a reply to message #28627] |
Wed, 02 January 2002 07:14  |
Emmler, Oliver
Messages: 14 Registered: May 2001
|
Junior Member |
|
|
> But this goes even further afield from "easy" than my
> previous example, so I'm not sure it would meet
> your criteria. :-)
Thanks. I tried using your procedures. The scaling of the colortable/images
will cause the picture to lose details. I think i have to use the following
loop. Is there any way to speed it up ?
FOR x = 0,510 DO BEGIN
FOR y = 0,510 DO BEGIN
IF highlight(x,y) NE 0 THEN TV, highlight(x:x+1,y:y+1),x,y
ENDFOR
ENDFOR
With Best Regards for the new year,
Oliver
|
|
|
Re: Display two images on one position [message #28657 is a reply to message #28630] |
Mon, 24 December 2001 09:37  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Emmler, Oliver (oemmler@ix.urz.uni-heidelberg.de) writes:
> Great. This is nearly what i want to.
>
> Isn't there a function Just to display two images on one array 256x256
> without deleting the first displayed one ?
Why would we be holding back on you in this
season of giving? :-)
> I am creating two images devided by the value x so i get highlight and
> image. Easiest Way to do would be :
>
> LoadCT, 0
> tv, image
> LoadCT, 5
> tv, highlight
>
> Unfortunately this erases the first image.
Unfortunately.
One could certainly *write* a function to do this,
I think. But it would involve the Z-buffer,
images as patterns to PolyFill commands, use of the
Transparent keyword, etc.
But this goes even further afield from "easy" than my
previous example, so I'm not sure it would meet
your criteria. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Display two images on one position [message #28658 is a reply to message #28657] |
Mon, 24 December 2001 00:51  |
Emmler, Oliver
Messages: 14 Registered: May 2001
|
Junior Member |
|
|
> How about this:
>
> LoadCT, 0, NColors=100
> s = Size(image, /Dimensions)
> composite = BytArr(s[0], s[1])
> imageIndex = Where(highlight EQ 0, Complement=hltIndex)
> composite[imageIndex] = BytScl(image[imageIndex], Top=99)
> composite[hltIndex] = BytScl(highlight[hltIndex], Top=99) + 100B
> LoadCT, 5, NColors=100, Bottom=100
> TV, composite
Great. This is nearly what i want to.
Isn't there a function Just to display two images on one array 256x256
without deleting the first displayed one ?
;## Produce Highlighted Area
highlight = image
ndots = WHERE(image LT x)
highlight(ndots) = 0
;## Produce Negative of Highlighted Area out of Image
pdots = WHERE(image GT x-1)
negative = image
negative(pdots) = 0
I am creating two images devided by the value x so i get highlight and
image. Easiest Way to do would be :
LoadCT, 0
tv, image
LoadCT, 5
tv, highlight
Unfortunately this erases the first image.
Regards,
Oliver
|
|
|
Re: Display two images on one position [message #28659 is a reply to message #28658] |
Sun, 23 December 2001 18:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning (david@dfanning.com) writes:
> At the very least, you can speed this code up
> tremendously by doing this:
>
> TV, image
> LoadCT, 5
> TV, highlight * (highlight NE 0)
Well, that's probably not right, come to think
of it. Let's see..
How about this:
LoadCT, 0, NColors=100
s = Size(image, /Dimensions)
composite = BytArr(s[0], s[1])
imageIndex = Where(highlight EQ 0, Complement=hltIndex)
composite[imageIndex] = BytScl(image[imageIndex], Top=99)
composite[hltIndex] = BytScl(highlight[hltIndex], Top=99) + 100B
LoadCT, 5, NColors=100, Bottom=100
TV, composite
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Display two images on one position [message #28660 is a reply to message #28659] |
Sun, 23 December 2001 14:57  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Oliver Emmle (oemmler@ix.urz.uni-heidelberg.de) writes:
> i want to display two images on one position. I do this by using the
> attached Code becuase i don't want the pixels of IMAGE being erased when
> using the TV function for HIGHLIGHT.
>
> My Question:
> - Is there a shorter way to display to images like in the code ?
> - Is it possible to set some of the pixels of one image transparent ?
>
> Can anyone help ?
You can find an article on how to create
transparent images in both direct graphics and
object graphics here:
http://www.dfanning.com/color_tips/color_overlay.html
> TV, image
> LoadCT,5
> FOR x = 0,510 DO BEGIN
> FOR y = 0,510 DO BEGIN
> IF highlight(x,y) NE 0 THEN TV, highlight(x:x+1,y:y+1),x,y
> ENDFOR
> ENDFOR
At the very least, you can speed this code up
tremendously by doing this:
TV, image
LoadCT, 5
TV, highlight * (highlight NE 0)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|