1.官网下载basler相机的pylon
2.安装pylon(我选用了5.0.12版本,下载最新的pylon我的电脑运行不了)
3.选择pylon的模式,二次开发选择development模式
4.选择接口,看相机的接口类型,选择相机的接口类型USB类型
5.完后安装就打开Pylon Viewer
6.在visual studio2022中配置属性,C/C++的常规->附加包含目录->右边编辑添加Basler\pylon 5\Development\include
7.链接器的常规->附加库目录->右边编辑添加Basler\pylon 5\Development\lib\x64,完成配置。
这样就可以引用OpenCV和Basler相机PYLON API的头文件
// Include files to use OpenCV API.
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
// Include files to use the PYLON API.
#include <pylon/PylonIncludes.h>
#include <pylon/usb/BaslerUsbInstantCamera.h>
// Namespace for using pylon objects.
using namespace Pylon;
// Namespace for using GenApi objects
using namespace GenApi;
// Namespace for using opencv objects.
using namespace