OpenCV没有来自isight网络摄像头的图像 [英] OpenCV no image from isight webcam

查看:101
本文介绍了OpenCV没有来自isight网络摄像头的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我无法使用以下OpenCV代码从网络摄像头捕获图像.

该代码可以显示来自本地AVI文件或视频设备的图像.它可以在"test.avi"文件上正常工作.

当我使用默认的网络摄像头(CvCapture * capture = cvCreateCameraCapture(0))时,程序可以从网络摄像头检测图像的大小,但无法显示图像.

有人遇到同样的问题吗?

您也可以在此处看到带有数字的我的帖子



Hi,

I can not capture image from my webcam using following OpenCV code.

The code can show images from a local AVI file or a video device. It works fine on a "test.avi" file.

When I make use my default webcam(CvCapture* capture =cvCreateCameraCapture(0)), the program can detected the size of the image from webcam,but just unable to display the image.

Anyone encounter the same problem?

You can also see my post here with figures



<pre lang="cs">

//code start
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
    CvCapture* capture =cvCreateFileCapture( "C:\\test.avi" );// show images from avi file, works well
//    CvCapture* capture =cvCreateCameraCapture(0);           //show the frame(images) from default webcam not work

    assert( capture );

    IplImage* image;
      while(1) {
    image = cvQueryFrame( capture );
         if( !image ) break;
          cvShowImage( "Example2", image );
        char c = cvWaitKey(33);
        if( c == 27 ) break;
    }
    cvReleaseCapture( &capture );
    cvDestroyWindow( "Example2" );




opencv 2.2
调试库* d.lib
WebCam isight
Macbook OS win7 32
VS2008




opencv 2.2
Debug library *d.lib
WebCam isight
Macbook OS win7 32
VS2008

推荐答案

最新更新!问题解决了!

这恰好是OpenCV 2.2的错误之一


Latest update! Problem solved!

This happen to be one of OpenCV 2.2′s bug

In


(OpenCV文件夹)\ modules \ highgui \ src \ precomp.hpp中,大约60行以上替换以下内容

#if!定义WIN32&& !defined _WIN32
#include"cvconfig.h"
#else
void FillBitmapInfo(BITMAPINFO * bmi,int宽度,int高度,int bpp,int原点);
#endif




#include"cvconfig.h"
#如果已定义WIN32 ||定义_WIN32
void FillBitmapInfo(BITMAPINFO * bmi,int宽度,int高度,int bpp,int原点);
#endif

更多信息:

http://dusijun.wordpress.com/2011 /01/11/opencv-unable-to-capture-image-from-isight-webcam/ [
(OpenCV Folder)\modules\highgui\src\precomp.hpp around line 60+ replace following

#if !defined WIN32 && !defined _WIN32
#include "cvconfig.h"
#else
void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin );
#endif

with


#include "cvconfig.h"
#if defined WIN32 || defined _WIN32
void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin );
#endif

More info:

http://dusijun.wordpress.com/2011/01/11/opencv-unable-to-capture-image-from-isight-webcam/[^]


尝试CvCapture * capture = cvCreateCameraCapture( -1);

问候
Espen Harlinn
Try CvCapture* capture =cvCreateCameraCapture(-1);

Regards
Espen Harlinn


这篇关于OpenCV没有来自isight网络摄像头的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆