[英]How to use Basler GigE camera pylon5 c++ libraries in Raspberry Pi
我試圖從單獨的項目中調用pylon5 C ++庫,但沒有成功。
我一直在尋找一個答案,但卻無法弄清楚我做錯了什么。
我想我的問題可能是設置環境變量和/或庫路徑? (我是基於Linux的初學者,當我在網上閱讀教程時,我很容易對一些顯而易見的東西感到困惑?我應該知道但我不知道的事情)
我已經測試過相機本身正在使用我的Raspberry,我可以使用示例代碼來獲取圖像。
我甚至可以修改相機設置(曝光時間等)並拍照並將其保存到SD卡中。 所以相機模塊不是問題。 我的問題更有可能以正確的方式使用共享庫。
此外,我已經制作了一些簡單的共享庫,希望我可以使用我的Pylon相機代碼。 當我沒有在我的庫中包含任何Pylon代碼時,它工作正常並返回我想要的值。 我甚至可以在那里添加Pylon接頭,它仍然可以很好地編譯。 然后,我可以從另一個(在本例中為C#)代碼調用我的lib並按預期獲得返回值,但是當嘗試調用任何Pylon代碼(在我的庫中)時,將導致'dllNotFoundException'。
我已將我的pylon5代碼放在/ opt / pylon5中,正如我從baslerweb.com獲得的手冊中所建議的那樣
http://s.baslerweb.com/media/documents/How%20to%20build%20pylon%20applications%20on%20Raspberry%20Pi.pdf
這是我的項目文件(我正在使用QtCreator)
#-------------------------------------------------
QT -= gui
QT += core
TARGET = baslercamera
TEMPLATE = lib
DEFINES += BASLERCAMERA_LIBRARY
SOURCES += baslercamera.cpp \
Grab.cpp \
Image.cpp \
main.cpp \
BaslerDLL.cpp
HEADERS += baslercamera.h\
baslercamera_global.h \
Image.h \
Grab.h
unix {
target.path = /usr/lib
INSTALLS += target
}
#INCLUDEPATH += $$PWD/../pylon5/include
#DEPENDPATH += $$PWD/../pylon5/include
INCLUDEPATH += /opt/pylon5/include
DEPENDPATH += /opt/pylon5/include
INCLUDEPATH += /home/pi/baslercamera/
DEPENDPATH += /home/pi/baslercamera/
LIBS += "/opt/pylon5/lib" \
-lpylonc
正如您所看到的,INCLUDEPATH和LIBS變量是我的弱點。 我無法弄清楚我應該包含哪些庫以及如何正確包含它們。 除了將它們包含在我的項目文件中之外,我還應該設置一些環境變量嗎?
我也嘗試設置一些庫路徑,但我真的不知道我應該在那里做什么。 用戶手冊說
Set the pylon environment variables:
# source ./pylon4/bin/pylon-setup-env.sh pylon4
然后我用pylon5替換了pylon4。 我認為這可能會將環境變量設置為使用pylon庫。 但我不確定那里會發生什么。 塔架5指南說:
Environment Variables
=====================
From pylon 5.0 upwards, no additional environment variables are required to
run pylon-based applications.
For development, though, the compiler must know where pylon is installed.
The pylon samples use the environment variable PYLON_ROOT to find the relevant information.
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
For special use cases, you can do a manual environment setup as follows:
export PYLON_ROOT=/path/to/your/pylon5
Even though there is currently only one variable needed, using pylon-setup-env.sh
is still the preferred way to set up your environment, as we might add more variables
in the future.
我已經在很多方面嘗試過,我很樂意在我自己的庫中繼續使用這些共享庫的任何幫助或建議。
哇,這個問題很老了,我很驚訝它還沒有回答。
我只是讓它工作,但我的項目使用Scons作為構建系統。 不過,我發現的問題是它沒有連接足夠的庫。 這是我設置得到我需要的東西( qmake
語法可能會關閉):
LIBS += \
-L/opt/pylon5/lib64 \
-lpylonbase \
-lGenApi_gcc_v3_0_Basler_pylon_v5_0 \
-lGCBase_gcc_v3_0_Basler_pylon_v5_0 \
-lLog_gcc_v3_0_Basler_pylon_v5_0 \
-lMathParser_gcc_v3_0_Basler_pylon_v5_0 \
-lXmlParser_gcc_v3_0_Basler_pylon_v5_0 \
-lNodeMapData_gcc_v3_0_Basler_pylon_v5_0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.