Re: Help with program speed (Recursive Merging Function) [message #61192] |
Wed, 09 July 2008 06:20  |
crd319
Messages: 5 Registered: June 2008
|
Junior Member |
|
|
On Jul 8, 4:32 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> Hi,
>
> one thing you could do is to keep track of who is neighbor of whom.
> Build an array with one entry per "block", identify the neighbors
> (likely the Moore neighborhood, for the first step). Then, when you want
> to process block N, just look in the table who are the neighbors. Do
> your computation and if you merge 2 block, add the neighbors of block2
> to the neighbors of block1, remove block2 from the list of neighbors of
> block1 and, eventually (not required), delete the entry corresponding to
> block2.
>
Thanks for the suggestion. By moving those three lines of code, I cut
my time down from 400 seconds to 5 seconds. Much more manageable.
Ill probably look at the other way to cut down on time, but for now
this is manageable and I have a deadline for this. Thanks for the
help.
Chris
> By doing this, you will NOT compare every block with every other blocks!
>
> *************
>
> In the meanwhile, if you want to keep using your loops, move the calls to
>
> p2 = n_elements(blk2)
> LBP_C2 = LBP_OVER_C(blk2)
> hist2 = HIST_2D(LBP_C2.LBP, LBP_C2.C, max1=255, max2=bins-1)
>
> in the "if..." section. There is no need to compute that if your blocks
> are not neighbors!
>
> Jean
|
|
|