本帖旨在記錄一下在Ubuntu16.04下配置basler工業相機pylon sdk,以及結合opencv進行CMake配置使用的一些事項。
1.Prerequisite
ubuntu16.04 + Basler工業相機 + pylon5 sdk
給個傳送門:Pylon下載
2.pylon的安裝
解压安装包,把里面的SDK安装包解压到/opt目录下。
按照install的说法:
To install the pylon 5 Camera Software Suite in /opt/pylon5
follow these steps:
1. Change to the directory which contains this INSTALL file, e.g.:
cd ~/pylon-5.2.x.y-<ARCH>
2. Extract the corresponding SDK into /opt
sudo tar -C /opt -xzf pylonSDK*.tar.gz
3. Install udev-rules to set up permissions for Basler USB cameras
(Not required if installing using the Debian packages (*.deb))
./setup-usb.sh
4. Unplug and replug all USB cameras to get the udev rules applied.
5. Execute /opt/pylon5/bin/PylonViewerApp to test your cameras.
Readme里面有一句添加环境变量的,如下:
## For your convenience, we created the pylon-setup-env.sh script located in the
## pylon5/bin directory which can carry out the complete setup.
## To setup the environment for a pylon installation in <path> execute:
## source <path>/bin/pylon-setup-env.sh <path>
## If you want the environment for the standard installation to be persistent, you
## can add
## source /path/to/your/pylon5/bin/pylon-setup-env.sh /path/to/your/pylon5
## to ~/.bashrc
# 将下面这句加入~/.bashrc即可。我的如下:
source /opt/pylon5/bin/pylon-setup-env.sh /opt/pylon5
这一步完了之后连接上相机,打开PylonviewerApp可以看到相机,并且打开的。
3.CMake配置使用
直接粘上师兄门写的引用pylon sdk的 include目录和库目录,如下。
# 包含头文件
include_directories(/opt/pylon5/include)
link_directories(/opt/pylon5/lib64)
# target_link
target_link_libraries(vis_basler
${catkin_LIBRARIES}
${OpenCV_LIBS}
X11
pylonbase
pylonutility
GCBase_gcc_v3_1_Basler_pylon
GCBase_gcc_v3_1_Basler_pylon_v5_1
GenApi_gcc_v3_1_Basler_pylon
GenApi_gcc_v3_1_Basler_pylon_v5_1
)
具体的sdk使用教程还得学官方文档和samples,先记录到这儿了,加油。