Reputation: 199
I am using OpenCV 2.4.10 and I want to take image from my Asus Xtion Pro Live. When I'm trying to execute the code below, I get this error: "Can not open capture." I tried everything, like Sensor update, opencv with openni compiling and opencv re-installing (even the version 2.4.6).
OpenNI and Sensor are working properly since I am able to run examples such as NiViewer. But the example openni_capture.cpp (on opencv-2.4.10/samples/cpp) cannot run properly.
The code:
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
VideoCapture capture;
capture.open(CV_CAP_OPENNI_ASUS);
if ( !capture.isOpened() )
{
cout << "Error opening capture" << endl;
return -1;
}
if( !capture.grab() )
{
cout << "Can not grab image" << endl;
}
return 0;
}
The compiling is done with the following command: g++ capture.cpp -o capture pkg-config --cflags opencv --libs opencv
How can i fix this error? Is there any problem with the opencv version that i use?
I did what is being said on Can not grab image from VideoCapture OpenCV with Asus Xtion Pro Live but the problem still exists.
Upvotes: 0
Views: 1171
Reputation: 111
What serial ports are listed when you print out the list as you're doing ? Have you checked to see what serial port your camera is connected to ? On Linux you can list mounted devices with :
lsusb
Upvotes: 0