cvCaptureFromCAM 分析


CV_IMPL CvCapture * cvCaptureFromCAM (int index)
{
    int  domains[] = 
	{
		CV_CAP_IEEE1394,   // identical to CV_CAP_DC1394 
		CV_CAP_STEREO, 
		CV_CAP_VFW,        // identical to CV_CAP_V4L
		CV_CAP_MIL, 
		CV_CAP_QT,
		-1 
	};
	

    // interpret preferred interface (0 = autodetect)
    int pref = (index / 100) * 100;
    if (pref) 
	{
		domains[0]=pref;
		index %= 100;
		domains[1]=-1;
    }

    // try every possibly installed camera API
    for (int i = 0; domains[i] >= 0; i++) 
	{

		// local variable to memorize the captured device
		CvCapture *capture;

		switch (domains[i]) 
		{
		#ifdef HAVE_TYZX
		case CV_CAP_STEREO:
			capture = cvCaptureFromCAM_TYZX (index);
			if (capture)
				return capture;
		#endif

		#if   defined (HAVE_VFW)
		case CV_CAP_VFW:
			capture = cvCaptureFromCAM_VFW (index);
			if (capture) 
				return capture;
		#elif defined (HAVE_CAMV4L) || defined (HAVE_CAMV4L2)
		case CV_CAP_V4L:
			capture = cvCaptureFromCAM_V4L (index);
			if (capture) 
				return capture;
		#endif

		#if   defined (HAVE_DC1394)
		case CV_CAP_DC1394:
			capture = cvCaptureFromCAM_DC1394 (index);
			if (capture)
				return capture;
		#elif defined (HAVE_CMU1394)        
			case CV_CAP_IEEE1394:
			capture = cvCaptureFromCAM_CMU (index);
			if (capture)
				return capture;
		#endif

		#ifdef HAVE_MIL
		case CV_CAP_MIL:
			capture = cvCaptureFromCAM_MIL (index);
			if (capture) 
				return capture;
		#endif
		
		#ifdef HAVE_QUICKTIME
		case CV_CAP_QT:
			capture = cvCaptureFromCAM_QT (index);
			if (capture)
				return capture;
		#endif
        }
    }

	// failed open a camera
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值