我今天写了个测试程序,在linux下坐测试,发现这句话执行时会报这样的提示,但依旧能正常预览视频,我很奇怪!虽说能运行,但下到板子里就不行了。请高人提示下,我的测试代码:
#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!
后面的都好好的。。。。 渴望您的指点
zhe这难道是opencv的一个bug???######
我在google上得到:
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
######和我的问题一样啊!!!!######http://ubuntuforums.org/showthread.php?t=1453004 这个人的问题也和我一样
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。