pyqt5中QImage读取16位raw图像,怎么正常显示?
imgName, imgType = QFileDialog.getOpenFileName(self.centralwidget, '选择文件', '', 'All files(*)')
img = np.fromfile(imgName, dtype=np.uint16)
N = int(np.size(img) / 640 / 512)
img = img.reshape(N, 512, 640)
img = img[0, :, :]
qimage = QtGui.QImage(self.shrink.data, self.shrink.shape[1], self.shrink.shape[0], self.shrink.shape[1], QtGui.QImage.Format_Grayscale16)
pix = QtGui.QPixmap.fromImage(qimage)
self.label.setPixmap(pix)
self.label.setScaledContents(True)