Hello, I installed vimbaviewer on windows 7. Then, I installed opencv 2.4.8. I build it using cmake with With_PVAPI and WITH_QT. I am using QT 5.2.0 with mingw32. At this stade the webcam is running correctly but the prosilica camera did not work.
After that I found the link link text. So I nstalled the SDK AVT for windows and I rebuild it with With_PVAPI and WITH_QT. At this phase, the webcam did not work and also the prosilica camera always did not work. SEE my code to get video:
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
cout<<"Start"<<endl;
VideoCapture cap(0); // open the video camera no. 0
//VideoCapture cap(CV_CAP_PVAPI); // open the video camera prosilica
cout<<"end"<<endl;
if (!cap.isOpened()) // if not success, exit program
{
cout << "Cannot open the video cam" << endl;
return -1;
}
double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
cout << "Frame size : " << dWidth << " x " << dHeight << endl;
namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
while (1)
{
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess) //if not success, break loop
{
cout << "Cannot read a frame from video stream" << endl;
break;
}
imshow("MyVideo", frame); //show the frame in "MyVideo" window
if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
return 0;
}
Thanks for help me