How to setup Allied Vision Camera Manta using Open

2019-05-26 23:05发布

问题:

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?

回答1:

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:

  1. Install Visual Studio 2015 from here
  2. Install the latest version of OpenCV from here and use this tutorial to install and configure OpenCV in the correct way.
  3. Connect Allied Vision camera (Manta) to your computer (you must have GigE controller in your computer)
  4. Install Vimba Viewer SDK from here and install drivers using Vimba Viewer Driver software. Rebbot computer.
  5. Run Vimba Viewer and see if your camera is detected and capture some images with camera.
  6. Close Vimba Viewer and then run Visual Studio. Open some of the APIs C++ examples from folder: ...\Allied Vision\Vimba_2.0\VimbaCPP_Examples . I suggest using ListCameras for the first time. You will be able to check if your camera is recognized by VS2015. If everything is ok, you should see camera parameters in VS console.

POSIBLE PROBLEMS THAT I HAD AND FIXES:

  • Visual Studio is crashing when you run APIs examples. FIX: Close Vimba Viewer
  • APIs C++ ListCameras doesn't find your camera: FIX: dissable firewal, all antiviruses or add exceptions in your antivirus programs to ListCameras.exe, Visual Studio 2015 and Vimba Viewer.