ImageItem performance boost by avoiding makeQImage(transpose=True)
This commit is contained in:
parent
a08b28c958
commit
bd2330af9f
@ -875,6 +875,9 @@ def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False):
|
|||||||
order = [2,1,0,3] ## for some reason, the colors line up as BGR in the final image.
|
order = [2,1,0,3] ## for some reason, the colors line up as BGR in the final image.
|
||||||
|
|
||||||
if data.ndim == 2:
|
if data.ndim == 2:
|
||||||
|
# This is tempting:
|
||||||
|
# imgData[..., :3] = data[..., np.newaxis]
|
||||||
|
# ..but it turns out this is faster:
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
imgData[..., i] = data
|
imgData[..., i] = data
|
||||||
elif data.shape[2] == 1:
|
elif data.shape[2] == 1:
|
||||||
|
@ -260,8 +260,8 @@ class ImageItem(GraphicsObject):
|
|||||||
#print lut.shape
|
#print lut.shape
|
||||||
#print self.lut
|
#print self.lut
|
||||||
|
|
||||||
argb, alpha = fn.makeARGB(self.image, lut=lut, levels=self.levels)
|
argb, alpha = fn.makeARGB(self.image.T, lut=lut, levels=self.levels)
|
||||||
self.qimage = fn.makeQImage(argb, alpha)
|
self.qimage = fn.makeQImage(argb, alpha, transpose=False)
|
||||||
prof.finish()
|
prof.finish()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user