Re: IDL calculating elements in arrays plus there offsets [message #70040 is a reply to message #70039] |
Mon, 08 March 2010 04:40   |
Will
Messages: 7 Registered: June 2004
|
Junior Member |
|
|
On Mar 8, 12:26 pm, jeanh
<jghasb...@DELETETHIS.environmentalmodelers.ANDTHIS.com> wrote:
> Let's see last point in your message first.
> For images, you don't need more than 3 or 4 dimensions.
> 1) X
> 2) Y
> 3) Z - number of images
> 4) (RGB)
>
> Now, and this may not be the most efficient way but it will allow you to
> understand what is going on, you can do something like:
>
> image1Array
> image2Array
> nbImagesFirstGroup = 10
> nbImagesSecondGroup = 5
>
> for img1 = 0, nbImagesFirstGroup -1 do begin
> for img2 = 0, nbImagesSecondGroup -1 do begin
> result = image1Array[*,*,img1] - image2Array[*,*,img2]
> endfor
> endfor
>
> here, image1Array has 3 dimensions (x, y, z). By using the subscript
> [*,*,img1], you are accessing "each elements of the 1 and 2nd
> dimensions, corresponding to img1", img1 being a simple counter.
> Of course, in this example, the result will be overwritten in each
> iteration so you may want to save it.
>
> This being said, you should first write a more precise question. "offset
> the elements by 1 to the right" can mean lots of things... are yo
> comparing 2 images, shifting in the X direction? Y? or are you
> considering multiple images?
>
> Jean
>
> On 08/03/2010 6:43 AM, Will wrote:
>
>
>
>> Hi
>
>> sorry I don't think the heading was very clear there.
>
>> I have loaded a group of arrays (jpeg files) into a seperate float
>> array, and again with another group of files I have done the same
>> thing. I am now trying to have the two arrays perform a subtraction
>> calculation with one another and what I want to do is have the arrays
>> do this with each other until they have did the calculation with every
>> element. i.e
>
>> it does the first calculation, then offsets the elements by one to the
>> right and does the next calculation then repeats this until it has
>> done every element in the array.
>
>> I was curious as to how to do this successflly I am currently trying
>> to use a FOR loop after my Repeat loop failed. I have the maths I need
>> here but I don't know how to access the subscripts of my array. I have
>> inputted all the files into an array using the FLOAT command. the
>> likes of FLTARR just keeps saying that I have more than 8 dimensions
>> and hence it won't work.
>
>> Any ideas guys?
>
>> Thanks
>
>> Will- Hide quoted text -
>
> - Show quoted text -
Sorry for impreciseness. I don't seem to be on the ball at all today.
Yeah that makes sense, and to answer your questions it is multiple
images I am loading into two seperate float arrays thats 122 images
for each array, so a grand total of 244 images are being loaded. The
idea being to compare the mass amount of images with each other and
moving the array around both in the x and y direction until the
closest match is found.
I hope that clears it up for you, as I say I am not really on the ball
today.
Thanks
Will
|
|
|