opencv报错 error: (-215) size.width>0 && size.height>0 in function cv::imshow

使用opencv读取摄像头并且显示事出现此问题:

后来发现是图像为空时的错误,加入:

  if(!frame.empty())
        imshow("video",frame);

完整的代码:

int main()
{
   /* unsigned char buf_show[1920*1080*3];
    uint32_t addr_bar0;
    unsigned char *bar0_map_base;
    long int screensize = 0;
    unsigned char *fbp = NULL;
    unsigned char *ptail;
    Mat MatRGB ;*/       

    VideoCapture cap(1);

    if(!cap.isOpened())
    printf("camre open failed!\n");
    Mat frame;
    namedWindow("video");
    if(!frame.empty())
        imshow("video",frame);
    else
        printf("image empty\n");
    while(1)
    {
    cap>>frame;
    if(!frame.empty())
        imshow("video",frame);
    else
        printf("image empty\n");
    if(waitKey(10)==27)
       break;

    }
   cap.release();

原文地址:https://www.cnblogs.com/xiaojianliu/p/9443874.html

时间: 2024-10-14 23:54:09

opencv报错 error: (-215) size.width>0 && size.height>0 in function cv::imshow的相关文章

OpenCV报错size.width>0 && size.height>0 in function

(1)错误代码 import cv2 as cv src = cv.imread("D:\images\我喜欢的发型\07.PNG") cv.namedWindow("Hello", cv.WINDOW_AUTOSIZE) cv.imshow("Hello", src) cv.waitKey(0) cv.destoryAllWindows() (2)错误描述 D:\DevKits\Anaconda3\python.exe D:/workspace

【MySQL笔记】mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法

step1:查看 1.1 Mysql命令行里输入"show engines:"查看innoddb数据引擎状态, 1.2 show variables "%_buffer%"里查看innodb_buffer_pool_size的数值,默认是8M(太小,需要改大一点!) step2:找配置文件,修改innodb_buffer_pool_size=64M 2.1 在linux里配置文件是my.cnf,windows里是my.ini(注:不是my-default.ini).

springAOP注解方式定义切入点报错error at ::0 can't find referenced pointcut

[说明] 1.使用spring版本:4.0.4 2.springAOP相关依赖包: 1)aopalliance-1.0.jar 2)aspectjweaver-1.8.9.jar 3)aspectjrt-1.8.9.jar 3.分析: 1)当切面类的方法上通知注解直接输入切入点表达式时,没有报错.切面类代码如下: import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect

安装Scrapy报错 error: Microsoft Visual C++ 14.0 is required解决方法

[问题背景]:在Windows 10系统,pip install Scrapy,报错error: Microsoft Visual C++ 14.0 is required,还有提示Twisted需要安装. [解决方法步骤] 1.根据提示,去https://landinghub.visualstudio.com/visual-cpp-build-tools下载C++编译工具.但是,页面已经打不开,无法下载.  2.之前因需要安装uwsgi,在Windows 10 安装过MinGW,通过可以Min

Asp.Net程序报错 - error CS2001: Source file 'C:\Windows\TEMP\eulevokb.0.cs' could not be found warning CS2008

一个Asp.Net项目,Excel导入功能出现如下错误:error CS2001: Source file 'C:\Windows\TEMP\eulevokb.0.cs' could not be foundwarning CS2008: No source files specified 本地执行是没有问题的,访问正式服务器就会出现这样的错误,搜索一下,原来是权限的问题. 解决办法:打开C盘,找到C:\Windows\TEMP目录,给temp添加IIS_IUSER的权限就没有问题了! Asp.

源码安装mysql5.6x启动报错:[ERROR] Can't find messagefile '/data/mysqldata/3306/english/errmsg.sys'

170502 10:43:40 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata/3306/data 2017-05-02 10:43:40 0 [Warning] The syntax '--language/-l' is deprecated and will be removed in a future release. Please use '--lc-messages-dir' instead.

安装MySQL-python报错error: command 'gcc' failed with exit status 1

[[email protected] MySQL-python-1.2.3]# python setup.py install function) .... _mysql.c:133: error: 'ER_SYNTAX_ERROR' undeclared (first use in this function) _mysql.c:380: error: '_mysql_ConnectionObject' has no member named 'connection' _mysql.c:382

一看便知linux下mysql报错ERROR 1044: Access denied for user: '@localhost' to database 'mysql'

错误信息:ERROR 1044: Access denied for user: '@localhost' to database 'mysql' linux下解决方案: mysql> use mysql ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql' mysql> exit Bye [[email protected] ~]# service mysqld stop如果该命令不

编译android4.4 报错error: call to '__property_get_too_small_error' declared with attribute 的处理 (转载)

转自:http://blog.csdn.net/syhost/article/details/14448899 完整的报错为: system/core/include/cutils/properties.h:64:39: error: call to '__property_get_too_small_error' declared with attribute error: property_get() called with too small of a bufferIn function