CvCapture* pCapture = cvCreateCameraCapture(-1)运行时提示mmap:无效的参数 munmap:无效的参数

quanfu7582 2016-10-13 10:14:12
我今天写了个测试程序,想用在820linux下的坐标测试,发现这句话执行时会报这样的提示,但依旧能正常预览视频,我很奇怪!虽说能运行,但下到板子里就不行了。请高人提示下,我的测试代码:


#include <stdio.h>

#include <cv.h>

#include <highgui.h>

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!

后面的都好好的。。。。 渴望您的指点
...全文
1917 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Winston_Jory 2016-10-13
  • 打赏
  • 举报
回复
我在google上得到: problem with libv4l2 Hi, I've looked for some post with my problem but I haven't found. I have started to use opencv with Harpia without problems. Today, I have decided to install the latest version of opencv. After the installation, I've re-compile my source and I've encountered this error: "...(software runs correctly)... 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 libv4l2: error converting / decoding frame data: v4l-convert: error parsing JPEG header: Not a JPG file ? HIGHGUI ERROR: V4L: Could not SYNC to video stream. Input/output error ...(software runs correctly) Segmentation fault" The error is generated by this code: ImgCap = cvCaptureFromCAM(0); if(!cvGrabFrame(ImgCap)) printf("Cannot Grab Image from camera 1"); ImgFr1 = cvRetrieveFrame( ImgCap ,0); and I think that it depends on "static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int)" of cvcap_v4l.cpp Someone knows the solution of my problem? I've tried with Opencv 2.0 and 2.1, with a philips spc1300nc and the integrated laptop camera. Same error, while the harpia opencv run correctly. Thanks ------------------------------------ Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com

2,851

社区成员

发帖
与我相关
我的任务
社区描述
本论坛以AI、WoS 、XR、IoT、Auto、生成式AI等核心板块组成,为开发者提供便捷及高效的学习和交流平台。 高通开发者专区主页:https://qualcomm.csdn.net/
人工智能物联网机器学习 技术论坛(原bbs) 北京·东城区
社区管理员
  • csdnsqst0050
  • chipseeker
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧