【发布时间】:2016-09-18 19:41:07
【问题描述】:
好的,我正在尝试从处理过的正常人脸图像中提取我的本地二值模式图像,然后将其显示在我的 QT Gui 中。下面的代码是:
def extractFace(self):
try:
self.lbpface = self.model.lbpface(self.face)
height, width = self.self.lbpface.shape[:2]
#plt.imshow(self.lbpface, cmap= 'gray')
#plt.show()
img = QtGui.QImage(self.lbpface,
width,
height,
QtGui.QImage.Format_Indexed8)
return QtGui.QPixmap.fromImage(img)
except:
return QtGui.QPixmap("nosignal.jpg")
现在,如果我取消注释 plt.imshow,我会得到以下结果(这是我想在我的 GUI 中显示的内容):
我尝试了各种方法,如果我尝试添加,效果最好:
self.lbpface = np.asarray(self.model.lbpface(self.face), dtype = np.uint8)
任何想法如何解决这个问题?我的意思是,它在 matplot 图形上显示得很好,但是一旦变成 QImage 就会以某种方式严重扭曲
还要补充一点,我是 QT4 的新手。
【问题讨论】:
标签: python numpy image-processing matplotlib pyqt4