Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
90 views
in Technique[技术] by (71.8m points)

python - Convert ndarray to pixmap using pool

I have runtime generated ndarray of unit8 which i want to display as using pyqt5. Perfomance is crucial and the biggest problem is conversion from ndarray to QPixmap. While using main thread, it works but its laggy, and when using Pool from multiprocessing i'm revicing lot of errors. Function that is passed to pool.map is, where noise is ndarray:

def __array_to_pixmap(noise):
    img = Image.fromarray(noise, mode='L')
    qtImage = ImageQt.ImageQt(img)
    return QtGui.QPixmap.fromImage(qtImage)

Errors that i am reciving are:

  • ImportError: DLL load failed while importing cv2: The paging file is too small for this operation to complete. or
  • [...] File "..venvlibsite-packagescv2_init_.py", line 5, in from .cv2 import * ImportError: numpy.core.multiarray failed to import

Is there better (faster) way to make conversion from ndarray to pixmap, or what can i do to make it work with multiprocessing?

question from:https://stackoverflow.com/questions/65944132/convert-ndarray-to-pixmap-using-pool

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...