Is there a convenient way to apply a lookup table to a large array in numpy?

You can just use image to index into lut if lut is 1D. Here’s a starter on indexing in NumPy: http://www.scipy.org/Tentative_NumPy_Tutorial#head-864862d3f2bb4c32f04260fac61eb4ef34788c4c In [54]: lut = np.arange(10) * 10 In [55]: img = np.random.randint(0,9,size=(3,3)) In [56]: lut Out[56]: array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90]) In [57]: img Out[57]: array([[2, 2, 4], … Read more