Optimizing numpy
Gerdus van Zyl
gerdusvanzyl at gmail.com
Sat May 12 16:52:03 EDT 2007
I have the following, that is used to convert pixel data and thus
should be as fast as possible:
b = numpy.ndarray (shape=(w,h,4), dtype=numpy.uint8)
a = numpy.frombuffer(buf, numpy.uint8)
a.shape = (w, h, 3)
b[:,:,0] = a[:,:,2]
b[:,:,1] = a[:,:,1]
b[:,:,2] = a[:,:,0]
b[:,:,3] = 255
Can anyone tell me if there is a faster way? Will making use of
weave.blitz or pyrex help?
Thank You.
More information about the Python-list
mailing list