Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Convert Python numpy array to PyQt QPixmap image result in noise image



  • Hello, I have 2 image data that are same but the first one has gone through pre-processing while the second one is from direct cv.imread . Both of this data are numpy array and has range between [0-255] . But I keep having blank/noisy result for my first data when I try to show it on my label , while the second data can show up without any problem. This is the code that I used, normal is the image data.

    height, width, channel = normal.shape
    bytesPerLine = 3 * width
    qImg = QtGui.QImage(normal.data, width, height, bytesPerLine, QtGui.QImage.Format_RGB32)
    self.normalImage = QtGui.QPixmap(qImg)
    self.ui.normalDisplay.setPixmap(self.normalImage)
    

    I hope someone can give me hint for my problem


  • Banned

    Can you supply an MRE (Minimal Reproducible Example) so that we can just copy/paste and run and see the error otherwise the answer we provide to the favor you are requesting my be completely wrong as we cannot actually troubleshoot this issue of yours.

    This would of course require you supply the images you are working with as well since the issue may not be the code but the image itself.

    Ultimately in the end help us help you with your problem


Log in to reply