赞
踩
"
错误的提示信息太少呀?不能给你有效的解决方法?######我在运行程序的时候,就出现这些警告!然后可以正常预览视频了!有时候 出完这些警告直接死机了 有时候视频前几秒正常 一会就死了 蛋疼啊!!!######
你把你的程序关于mmap和munmap的的代码贴上来我看看,然后再帮你分析一下。######
引用来自“yuanlu”的答案
你把你的程序关于mmap和munmap的的代码贴上来我看看,然后再帮你分析一下。
您好,大哥,谢谢您的指点!前两天一直在弄移植,今天我又写了个测试程序,在linux下运行,终于定位到哪个函数调用产生这个问题了,原来是 CvCapture* pCapture = cvCreateCameraCapture(-1);这句话出的问题。在执行这句话的时候,会出现上面贴出来的提示,这可能和调用的v4l2接口有关系,该怎么调呢??大哥赐教一下,多谢了。我的测试代码如下:
#include
#include
#include
int main()
{
//声明IplImage指针
IplImage* pFrame = NULL;
printf("IplImage oK\n");
//获取摄像头
CvCapture* pCapture = cvCreateCameraCapture(-1);
printf("cvCreateCameraCapture OK!\n");
//创建窗口
cvNamedWindow("video", 1);
printf("cvNamedwindow OK!\n");
//显示视屏
while(1)
{
pFrame=cvQueryFrame( pCapture );
printf("first frame\n");
if(!pFrame)
{
printf("fail to cvQueryFrame!\n");
break;
}
cvShowImage("video",pFrame);
char c=cvWaitKey(33);
if(c==27)break;
}
cvReleaseCapture(&pCapture);
cvReleaseImage(&pFrame);
cvDestroyWindow("video");
}
用gcc编译器之后,运行结果如下:
IplImage oK
mmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
cvCreateCameraCapture OK!
cvNamedwindow OK!
后面的都好好的。。。。 渴望您的指点
######yuanlu,已经查出来是调用opencv的 cvCreateCameraCapture这个函数时出现的警告,但我不会调试啊 。。好像要调试opencv的源代码######
是不是你的opencv的函数使用的参数不对,你需要查找到opencv的函数代码的实现处去看看这些函数是如何使用的,你用source insight软件新建一个工程,把opencv和你自己编写的代码然后查看opencv的代码实现处。######多谢您的解答,参数是没有问题的! 就是申请内存的时候 有点问题。。。"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。