arguments did not match any overloaded call: QImage(): too many arguments QImage(QSize, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(int, int, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(bytes, int, int, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(PyQt5.sip.voidptr, int, int, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(bytes, int, int, int, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(PyQt5.sip.voidptr, int, int, int, QImage.Format): argument 1 has unexpected type 'memoryview' QImage(List[str]): argument 1 has unexpected type 'memoryview' QImage(str, format: str = None): argument 1 has unexpected type 'memoryview' QImage(QImage): argument 1 has unexpected type 'memoryview' QImage(Any): too many arguments 进程已结束,退出代码为 -1073740791 (0xC0000409)
时间: 2024-03-14 19:46:34 浏览: 35
这个报错提示是因为`QImage`函数中的第一个参数类型不正确。可能是您在使用`QImage`函数时传递的图像数据类型不正确,应该是`bytes`类型,而不是`memoryview`类型。可以将`memoryview`类型转换为`bytes`类型后再传递给`QImage`函数,例如:
```python
def deal_one_pic(self, image):
# 将图像转换为QPixmap格式
height, width, channel = image.shape
bytesPerLine = 3 * width
qImg = QImage(image.data.tobytes(), width, height, bytesPerLine, QImage.Format_RGB888).rgbSwapped()
pixmap = QPixmap(qImg)
return pixmap
```
上述代码中,我们使用`image.data.tobytes()`将`memoryview`类型的图像数据转换为`bytes`类型,然后将其传递给`QImage`函数。
相关问题
TypeError: arguments did not match any overloaded call:
这个错误提示意味着你调用了一个函数,但传递的参数与该函数的定义不匹配。这个问题可能有几种原因,例如:
1. 你传递的参数数量不正确。函数定义的参数数量可能与你传递的参数数量不匹配。
2. 你传递的参数类型不正确。函数定义的参数类型可能与你传递的参数类型不匹配。
3. 函数定义中可能有多个重载函数,但你的参数不满足任何一个函数的定义。
解决这个问题的方法是检查你的函数调用和函数定义,确保它们的参数数量和类型匹配,并确保你调用的是正确的函数。你还可以查看函数定义的文档,以确定应该传递哪些参数以及它们的类型。
依据报如下错误: audio_out = QAudioDeviceInfo(devtxt) TypeError: arguments did not match any overloaded call: QAudioDeviceInfo(): too many arguments QAudioDeviceInfo(QAudioDeviceInfo): argument 1 has unexpected type 'str'
这个错误的原因是你在调用 QAudioDeviceInfo(devtxt) 的时候传递了一个字符串类型的参数,而实际上它需要的参数类型是 QAudioDeviceInfo 类型。你可以使用 QAudioDeviceInfo::availableDevices(QAudio::Mode mode) 方法来获取可用的音频设备列表,并从中选择一个合适的设备来创建 QAudioDeviceInfo 对象。具体的实现方式可以参考 Qt 官方文档以及相关的例子。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)