Re: Avoiding FOR loops (version googleplex.infinity) [message #59739 is a reply to message #59696] |
Wed, 09 April 2008 05:56   |
MichaelT
Messages: 52 Registered: May 2006
|
Member |
|
|
On Apr 9, 2:33 pm, Gaurav <selfishgau...@gmail.com> wrote:
> Dear Nathan,
>
> And how do you propose I take care of the pixels where the 'chunks'
> will join other 'chunks'?
>
> I have thought of a very neat algorithm today, but will be able to
> implement it only later today. I promise to come up with some positive
> news tomorrow.
>
> Cheers,
> Gaurav
Hi Gaurav,
you could simply use some overlap.
Generate some vectors which contain the start and end positions of
each chunk.
Something like:
pxs = [0, p1-sr, p2-sr, p3-sr, ...]
pxe = [p1, p2, p3, ...]
and the same for y-coordinates
So you simply need a loop now and take the respective chunks from your
original array:
a = b[pxs[i]: pxe[i], pys[i]: pye[i]]
Then you will get the correct values for each of your chunks. So in
your case it seems to be impossible without loops...
What about Jim's method? What does that one look like? There could be
better solutions than mine.
Michael
|
|
|