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

Home » Public Forums » archive » Resizing Oddity
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
Resizing Oddity [message #37860] Wed, 28 January 2004 21:58
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

Ok, here is a question about image resizing that
*really* has me scratching my head.

Consider a small 2D image:

demo_getdata, scan, filename='ctscan.dat', dim=[256,256]
scan = Rebin(scan, 64, 64)

I wish to make it larger. I'll use Congrid (but I have
the same problem with CMCongrid, Craig's alternative).
I can make it larger with and without interpolation.
Let's try interpolation first:

Window, Title='2D with Interpolation', 0, XSize=400, YSize=400
TV, Congrid(scan, 400, 400, Interp=1)

Fine. Now without interpolation:

Window, Title='2D without Interpolation', 1, XSize=400, YSize=400
TV, Congrid(scan, 400, 400, Interp=0)

This image has a "blocky" appearance, which in this case
is what I want. Good!

Next, consider a true-color image or 3D image. Here is one
for you to download. It is a 3x40x55 byte array.

http://www.dfanning.com/hounddog.tif

Let's have a look at it with interpolation:

dog = Read_Tiff('hounddog.tif')
Window, Title='3D with Interpolation', 2, XSize=400, YSize=400
TV, Congrid(dog, 3, 400, 400, Interp=1), True=1

Not bad. How about without interpolation:

Window, Title='Without (??) Interpolation', 3, XSize=400, YSize=400
TV, Congrid(dog, 3, 400, 400, Interp=0), True=1

What!? Looks exactly the same as the "with interpolation"
window. What's going on?

To make this have the same blocky appearance I desire,
I have to do this:

bigdog = BytArr(3, 400, 400)
bigdog[0,*,*] = Congrid(Reform(dog[0,*,*]), 400, 400)
bigdog[1,*,*] = Congrid(Reform(dog[1,*,*]), 400, 400)
bigdog[2,*,*] = Congrid(Reform(dog[2,*,*]), 400, 400)
Window, Title='Without Interpolation', 4, XSize=400, YSize=400
TV, bigdog, True=1

I have two questions. The first is for all of you.

1. Why do I have to deconstruct my image to get what I
expected to get with a single line of code? What is
Congrid doing in Window 3 that is different from what
it is doing in Window 4?

And the second is for those of you looking for extra credit.
(Nominations for the IEPA are due shortly.)

2. How do I get a blocky appearance with a row-interleaved
image? For example:

testdog = Transpose(dog, [1,0,2])

Cheers,

David

P.S. Let's just say the more timely your answer is, the more
extra credit you can receive. :-)

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Is there a way to detect if a program is running under IDL or the Virtual Machine?
Next Topic: Re: Array indexing problem: Appreciated

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

Current Time: Wed Oct 08 15:27:28 PDT 2025

Total time taken to generate the page: 0.00621 seconds