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

Home » Public Forums » archive » Re: Array resize with arbitrary arithmetic
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Array resize with arbitrary arithmetic [message #52944 is a reply to message #52943] Mon, 12 March 2007 14:50 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rpertaub@gmail.com writes:

> I have this 640x240 array. I need to change it to a 320x240 array.
> However, in first array, consecutive 2 pixels hold information for 1
> pixel in second array and I need to do a certain bit of arithmetic to
> obtain that. This should not be too difficult, except I keep getting
> errors and I am not sure why:
> This is what I do:
>
> pro compress_image
>
> image=read_bmp('9 March 2007\775u.bmp') ; 640x240 array
>
> comp_image=make_array(76800,/long) ;1x76800 array that I can
> reform to 320x240array later
>
> temp=0
>
> for j=0,239 DO BEGIN
> for i=0,319 DO BEGIN
>
> comp_image[0,temp]= image[2*i,j]*256 + image[2*i+1,j] ;
> arithmetic necessary
> temp=temp+1
> endfor
>
> endfor
>
>
> end

Seems to me the way to do this might be like this:

image=read_bmp('9 March 2007\775u.bmp') ; 640x240 array
temp = Rebin(image, 2, 320, 240)
temp = Total(Temporary(temp), 1)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sky Falling, etc. : Array substitution + addition with plus-equal (+=)
Next Topic: contours property sheet

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

Current Time: Sun Oct 12 07:06:59 PDT 2025

Total time taken to generate the page: 0.01126 seconds