Reputation: 296
I have laptop with Windows 10 and Marvell Yukon 88E8072 PCI-E Gigabit Ethernet Controller. I have Allied Vision Manta camera connected to my laptop. I installed Visual Studio 2015 and also I installed Allied Vision SDK - Vimba Viewer. I am able to capture images with Vimba Viewer interface soo I know that camera is working ok.
The problem is when I try to capture images in Visual Studio. I downloaded sample source code and with this code I am able to capture image from my webcam.This is code:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv2\video\video.hpp>
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
//cerr << getBuildInformation() << endl;
VideoCapture cap(0); // open the video camera no. 0 - we camera, 1- should be GigE camera?
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;
}
If I change VideoCapture cap(0) to VideoCapture cap(1), so that I should get video from GigE camera, I get a message ''Canot open the video cam'', so cap.isOpen() is false (see code above).
I am assuming that this has to do something with PvAPI driver not installed/included correctly. When I run:
cerr << getBuildInformation() << endl;
in cmd I see under Video I/O there is a line that says: PvAPI NO!
My question is, how can I configure my sistem to be able to capture images from Allied Vision Camera, model Manta in Visual Studio?
Upvotes: 2
Views: 5862
Reputation: 3548
The C++ examples are a little hard to track down, so I'm pasting here the code snippet from there:
std::string name;
CameraPtrVector cameras;
VmbSystem &system = VmbSystem::GetInstance();
if( VmbErrorSuccess == system.Startup() )
{
if( VmbErrorSuccess == system.GetCameras( cameras ) )
{
for( CameraPtrVector::iterator iter = cameras.begin();
cameras.end() != iter;
++iter )
{
if( VmbErrorSuccess == (*iter)->GetName( name ) )
{
std::cout << name << std::endl;
}
}
}
}
This would be found in C:\Program Files\Allied Vision\VimbaX\doc
(it's an HTML compiled "readthedocs") when you install the VimbaX SDK from https://www.alliedvision.com/en/products/software/vimba-x-sdk/
The rest of the documentation there will help you grab frames and more.
Upvotes: 0
Reputation: 296
SO FOR ALL ENGINEERS WHO ARE TRYING (AND ARE NEW LIKE ME IN MACHINE VISION) TO USE VIMBA VIEWER APIs (C++, C#) TO CONNECT WITH MANTA CAMERAS, THIS IS HOW IT IS DONE:
POSIBLE PROBLEMS THAT I HAD AND FIXES:
Upvotes: 3