如何在Visual Studio中使用OpenCV设置联盟视觉相机Manta [英] How to setup Allied Vision Camera Manta using OpenCV in Visual Studio

查看:493
本文介绍了如何在Visual Studio中使用OpenCV设置联盟视觉相机Manta的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台装有Windows 10和Marvell Yukon 88E8072 PCI-E千兆位以太网控制器的笔记本电脑.我已将Allied Vision Manta相机连接到我的笔记本电脑.我安装了Visual Studio 2015,也安装了Allied Vision SDK-Vimba Viewer.我可以使用Vimba Viewer界面捕获图像,所以我知道相机可以正常工作.

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.

问题是当我尝试在Visual Studio中捕获图像时.我下载了示例源代码,并使用此代码可以从网络摄像头捕获图像.这是代码:

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;
}

如果我将VideoCapture cap(0)更改为VideoCapture cap(1),以便从GigE摄像机获取视频,则会收到消息无法打开视频摄像机",因此cap.isOpen()为false (请参见上面的代码).

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).

我假设这与未正确安装/随附的PvAPI驱动程序有关.当我跑步时:

I am assuming that this has to do something with PvAPI driver not installed/included correctly. When I run:

cerr << getBuildInformation() << endl;

在cmd中,我在视频I/O"下看到一行显示:PvAPI NO!

in cmd I see under Video I/O there is a line that says: PvAPI NO!

我的问题是,如何配置系统以从Visual Studio中的Manta模型的Allied Vision Camera捕获图像?

My question is, how can I configure my sistem to be able to capture images from Allied Vision Camera, model Manta in Visual Studio?

推荐答案

因此,所有尝试使用(并且在机器视觉上像我一样)的工程师都可以使用VIMBA VIEWER API(C ++,C#)进行连接MANTA CAMERAS,这是怎么做的:

  1. 此处
  2. 安装Visual Studio 2015
  3. 此处安装最新版本的OpenCV,并使用此处安装Vimba Viewer SDK,并使用Vimba Viewer驱动程序安装驱动程序软件. Rebbot计算机.
  4. 运行Vimba Viewer,查看是否检测到您的相机并使用相机捕获一些图像.
  5. 关闭Vimba Viewer ,然后运行Visual Studio.从文件夹中打开一些API C ++示例:... \ Allied Vision \ Vimba_2.0 \ VimbaCPP_Examples.我建议第一次使用ListCameras.您将能够检查VS2015是否识别您的相机.如果一切正常,您应该在VS控制台中看到摄像机参数.
  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:

  • 运行API示例时,Visual Studio崩溃. FIX:关闭Vimba查看器
  • API C ++ ListCameras找不到相机:修复:禁用Firewal,所有防病毒软件或在防病毒程序中向ListCameras.exe,Visual Studio 2015和Vimba Viewer添加例外.
  • 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.

这篇关于如何在Visual Studio中使用OpenCV设置联盟视觉相机Manta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆