[Numpy-discussion] Speedup creation of a 3-color array from a 2-d color-index array a color lut

Delbert Franz ddf@iqdotdt....
Fri Feb 27 14:41:51 CST 2009



> Message: 2
> Date: Thu, 26 Feb 2009 23:32:35 -0600
> From: Robert Kern <robert.kern@gmail.com>
> Subject: Re: [Numpy-discussion] Speedup creation of a 3-color array
> 	from a	2-d color-index array a color lut
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID:
> 	<3d375d730902262132k5a011d14t84317458f9b6cf87@mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> On Thu, Feb 26, 2009 at 23:27, Delbert Franz <ddf@iqdotdt.com> wrote:
> >
> > I have ?geotiff files of scanned paper maps that use an indexed color scheme
> > with a 256-element
> > color lookup table (color lut) and a 9252 by 7420 array ?of uint8 elements.
> > The color is given by
> > three values. ?I want to create an array with shape: (9252, 7420, 3) so that
> > I can display the
> > image without creating internal array working space in Matplotlib that
> > exeeds 2^31 bytes.
> >
> > The following three approaches work in that the correct image is displayed,
> > but all of them
> > are waaaaay too slow:)
> >
> > ?Let
> > ? doq have shape (9252, 7420) and have uint8 elements
> > ? ctab have shape (256, 3) and have uint8 elements.
> > ? doqq have shape (9252, 7420, 3) and have unit8 elements
> 
> doqq = ctab[doq]
> 
Thanks, Robert!  It works just fine but it "blows my mind":)  Never would of 
thought of trying that.  I'll have to work hard at getting my "mind around" how
Numpy "views the universe".  I'm just starting to come to terms with what
"object oriented" means in Python.  In 46 years of developing software, one
is always on a learning curve, sometimes relatively flat, but sometimes
nearly vertical--this was a moment on the vertical:)

                              Delbert


More information about the Numpy-discussion mailing list