解释这个错误 terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.3) /home/li/opencv-3.4.3/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
时间: 2023-08-14 21:19:30 浏览: 263
这个错误是由 OpenCV 库中的 resize 函数引起的。它表明在调用此函数时,输入的大小参数为零或空。具体来说,这个错误指示输入图像的大小为空,可能是由于未正确加载图像或在处理图像时未正确处理大小参数所致。
要解决这个错误,您可以检查输入图像是否成功加载,并确保在使用 resize 函数时正确指定了图像的大小参数。您还可以尝试使用其他的图像处理函数来处理图像,或者使用其他的库来进行图像处理。
相关问题
imRGB = cv::imread(string(argv[3])+"/"+vstrImageFilenamesRGB[ni],CV_LOAD_IMAGE_UNCHANGED);报错 terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.3) /home/li/opencv-3.4.3/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
这个报错信息中的错误原因是在调用OpenCV库中resize函数时,输入的图像大小为空。这个问题通常是由于读取的图像文件不存在或路径不正确导致的。因此,你需要检查一下以下几个方面:
1. 检查图像文件路径是否正确,确保该路径可以找到图像文件;
2. 检查图像文件名是否正确,确保该文件存在于指定路径中;
3. 检查图像文件是否为有效的图像文件,例如JPEG、PNG等格式的图像文件;
4. 如果图像文件路径包含空格或特殊字符,需要将其用引号括起来。
如果以上检查都没有问题,你可以尝试重新安装OpenCV库或更新版本来解决这个问题。
terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.3) /home/cxf/opencv/opencv-3.4.3/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
这个错误通常是由于缺少OpenCV的GUI库或者GUI库不兼容导致的。解决方法如下:
1. 确认您已经安装了OpenCV的GUI库,比如GTK+ 2.x或者Carbon。如果您是在Ubuntu或Debian上运行,可以尝试安装libgtk2.0-dev和pkg-config,然后重新运行cmake或者configure脚本。
2. 如果您已经安装了GUI库但仍然遇到错误,请尝试重新编译OpenCV库并确保正确地链接了GUI库。您可以在编译OpenCV时指定需要链接的GUI库,具体方法取决于您使用的编译工具。
3. 如果以上方法都无法解决问题,您可以考虑使用其他的GUI库或者尝试不使用GUI相关的功能。例如,您可以将图像保存为文件而不是在窗口中显示。
需要注意的是,如果您使用的是OpenCV 4.x版本,可能会出现与GUI相关的兼容性问题,因为OpenCV 4.x已经将GUI部分移动到了opencv-imgui库中。在这种情况下,您需要安装opencv-imgui库并重新编译OpenCV。
阅读全文
相关推荐
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.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)
![](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)