博主之前的写的的pyqt5的代码,在进行bug优化时,突然就爆出TypeError: arguments did not match any overloaded call:错误。
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
Q_img = QImage(image,
TypeError: arguments did not match any overloaded call:
QImage(): too many arguments
QImage(QSize, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(int, int, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(bytes, int, int, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(sip.voidptr, int, int, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(bytes, int, int, int, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(sip.voidptr, int, int, int, QImage.Format): argument 1 has unexpected type 'numpy.ndarray'
QImage(List[str]): argument 1 has unexpected type 'numpy.ndarray'
QImage(str, format: str = None): argument 1 has unexpected type 'numpy.ndarray'
QImage(QImage): argument 1 has unexpected type 'numpy.ndarray'
QImage(Any): too many arguments
if len(image.shape) == 3:
Q_img = QImage(image.data,
image.shape[1],
image.shape[0],
image.shape[1] * 3,
QImage.Format_RGB888)
Q_img = QImage(image,
image.shape[1],
image.shape[0],
image.shape[1] * 3,
QImage.Format_RGB888)
将要显示的image进行一个copy操作
if len(image.shape) == 3:
Q_img = QImage(image.copy(),
image.shape[1],
image.shape[0],
image.shape[1] * 3,
QImage.Format_RGB888)