小编bur*_*kim的帖子

Opencv无法访问我的网络摄像头

我使用opencv 2.4.3访问网络摄像头时遇到问题.

我的系统:

惠普Probook 4530s - 惠普固定高清网络摄像头

Ubuntu 12.10

OpenCV 2.4.3

如果我想捕获我的内置摄像头我得到错误:捕获是NULL

我正在使用http://opencv.willowgarage.com/wiki/CameraCapture示例代码.

示例代码是:

#include "cv.h" 
#include "highgui.h" 
#include <stdio.h>  
// A Simple Camera Capture Framework 
int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
if ( !capture ) {
 fprintf( stderr, "ERROR: capture is NULL \n" );
 getchar();
 return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the …
Run Code Online (Sandbox Code Playgroud)

webcam opencv

3
推荐指数
1
解决办法
1万
查看次数

C++使用引用运算符传递数组

我有一个关于使用引用运算符传递数组的问题.我想编写使用引用运算符传递数组的代码.然后我试了一下

void swap(int &testarray[3]){
 // code
}
Run Code Online (Sandbox Code Playgroud)

它给了我错误.它说,

/main.cpp:5: error: declaration of 'testarray' as array of references
Run Code Online (Sandbox Code Playgroud)

但是当改变我的代码时

void swap(int (&testarray)[3]){
  // code
  }
Run Code Online (Sandbox Code Playgroud)

它运行正常.唯一的区别是有支架.

为什么它需要括号和int(&testarray)[3]和int&testarray [3]之间有什么区别?

谢谢你的帮助.

c++ arrays pass-by-reference

0
推荐指数
1
解决办法
384
查看次数

标签 统计

arrays ×1

c++ ×1

opencv ×1

pass-by-reference ×1

webcam ×1