Re: Optimization help [message #48158 is a reply to message #48157] |
Thu, 30 March 2006 17:54  |
Andrew Cool
Messages: 219 Registered: January 1996
|
Senior Member |
|
|
Jonathan Greenberg wrote:
> I was wondering if there are any tricks to speeding up the following
> database merging problem:
>
> Say I have a 3 x 10000 array, and I want to find out the row # of the 10,000
> rows matches (if any) an arbitrary 3 x 1 array. I can do this by cycling
> through each column one at a time and doing an intersection (e.g. Where(
> array[0] eq database[0,*]) intersected with where(array[1] eq database[1,*]
> intersected with where(array[2] eq database[2,*])
>
> This seems like a pretty slow approach to doing this, so are there any
> tricks to making this run a lot faster? I'm talking about doing this for an
> image, so the overhead is going to be pretty significant if I can't do any
> matrix tricks and have to look up at pixel one at a time using the above
> method...
>
> --j
For a true colour image, this seems to work just fine in picking out
those pixels that match a particular R,G,B sequence, 25 for the image
I chose as a test.
file = 'Bpic.jpg'
read_jpeg,file,image
rgb = [11,12,17]
match = where(image[0,*] EQ rgb[0] AND $
image[1,*] EQ rgb[1] AND $
image[2,*] EQ rgb[2])
Is that what you're after?
Andrew
|
|
|