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

Robert Kern robert.kern@gmail....
Thu Feb 26 23:32:35 CST 2009

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]

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list