簡介

由於公司採購的AVT相機不足,需要用Basler相機來彌補,所以我也瞭解了一下Basler這款相機的SDK。由於Basler這邊的相機提供的沒有提供Qt的示例,所以我做一個分享出來。

開發環境

Qt:  5.6.2vc2013版 

Basler:  5.0.11版

效果圖

上圖只是做了SDK部分介面的獲取和設定。相機的觸發方式、曝光時間、增益、頻率,以及圖片的尺寸、燈的觸發訊號等。

Basler相機SDK介面呼叫控制類

  1. #ifndef SBASLERCAMERACONTROL_H

  2. #define SBASLERCAMERACONTROL_H

  3. #include <QObject>

  4. #include <pylon/PylonIncludes.h>

  5. #include <QImage>

  6. #include <QTimer>

  7. #define DOUBLE_MAX 100000

  8. #define DOUBLE_MIN 0

  9. using namespace std;

  10. using namespace Pylon;

  11. using namespace GenApi;

  12. class SBaslerCameraControl : public QObject

  13. {

  14. Q_OBJECT

  15. public:

  16. explicit SBaslerCameraControl(QObject *parent = 0);

  17. ~SBaslerCameraControl();

  18. enum SBaslerCameraControl_Type{

  19. Type_Basler_Freerun, //設定相機的內觸發

  20. Type_Basler_Line1, //設定相機的外觸發

  21. Type_Basler_ExposureTimeAbs, //設定相機的曝光時間

  22. Type_Basler_GainRaw, //設定相機的增益

  23. Type_Basler_AcquisitionFrameRateAbs, //設定相機的頻率

  24. Type_Basler_Width, //圖片的寬度

  25. Type_Basler_Height, //圖片的高度

  26. Type_Basler_LineSource, //燈的觸發訊號

  27. };

  28. void initSome();

  29. void deleteAll();

  30. QStringList cameras();

  31. int OpenCamera(QString cameraSN);

  32. int CloseCamera();

  33. void setExposureTime(double time); // 設定曝光時間

  34. int getExposureTime(); // 獲取曝光時間

  35. int getExposureTimeMin(); // 最小曝光時間

  36. int getExposureTimeMax(); // 最大曝光時間

  37. void setFeatureTriggerSourceType(QString type); // 設定種類

  38. QString getFeatureTriggerSourceType(); // 獲取種類:軟觸發、外觸發等等

  39. void setFeatureTriggerModeType(bool on); // 設定模式觸發

  40. bool getFeatureTriggerModeType(); // 獲取模式觸發

  41. void SetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index, double tmpValue = 0.0); // 設定各種引數

  42. double GetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index); // 獲取各種引數

  43. long GrabImage(QImage& image,int timeout = 2000);

  44. long StartAcquire(); // 開始採集

  45. long StopAcquire(); // 結束採集

  46. signals:

  47. void sigCameraUpdate(QStringList list);

  48. void sigSizeChange(QSize size);

  49. void sigCameraCount(int count);

  50. void sigCurrentImage(QImage img);

  51. private:

  52. void UpdateCameraList();

  53. void CopyToImage(CGrabResultPtr pInBuffer, QImage &OutImage);

  54. private slots:

  55. void onTimerGrabImage();

  56. private:

  57. CInstantCamera m_basler;

  58. QStringList m_cameralist;

  59. QString m_currentMode;

  60. bool m_isOpenAcquire = false; // 是否開始採集

  61. bool m_isOpen = false; // 是否開啟攝像頭

  62. QSize m_size;

  63. };

  64. #endif // SBASLERCAMERACONTROL_H

原始檔:

  1. #include "sbaslercameracontrol.h"

  2. #include <QDateTime>

  3. #include <QDebug>

  4. SBaslerCameraControl::SBaslerCameraControl(QObject *parent) : QObject(parent)

  5. {

  6. }

  7. SBaslerCameraControl::~SBaslerCameraControl()

  8. {

  9. }

  10. void SBaslerCameraControl::initSome()

  11. {

  12. qDebug() << "SBaslerCameraControl: PylonInitialize initSome" ;

  13. PylonInitialize();

  14. CTlFactory &TlFactory = CTlFactory::GetInstance();

  15. TlInfoList_t lstInfo;

  16. int n = TlFactory.EnumerateTls(lstInfo);

  17. TlInfoList_t::const_iterator it;

  18. for ( it = lstInfo.begin(); it != lstInfo.end(); ++it ) {

  19. qDebug() << "FriendlyName: " << it->GetFriendlyName() << "FullName: " << it->GetFullName();

  20. qDebug() << "VendorName: " << it->GetVendorName() << "DeviceClass: " << it->GetDeviceClass() ;

  21. }

  22. UpdateCameraList();

  23. emit sigCameraCount(n);

  24. qDebug() << "SBasler Camera Count: " << n;

  25. }

  26. void SBaslerCameraControl::deleteAll()

  27. {

  28. //停止採集

  29. if(m_isOpenAcquire) {

  30. StopAcquire();

  31. }

  32. //關閉攝像頭

  33. CloseCamera();

  34. //關閉庫

  35. qDebug() << "SBaslerCameraControl deleteAll: PylonTerminate" ;

  36. PylonTerminate();

  37. qDebug() << "SBaslerCameraControl deleteAll: Close" ;

  38. }

  39. QStringList SBaslerCameraControl::cameras()

  40. {

  41. return m_cameralist;

  42. }

  43. void SBaslerCameraControl::UpdateCameraList()

  44. {

  45. CTlFactory& TLFactory = CTlFactory::GetInstance();

  46. ITransportLayer * pTl = TLFactory.CreateTl("BaslerGigE");

  47. DeviceInfoList_t devices;

  48. int n = pTl->EnumerateDevices(devices);

  49. CInstantCameraArray cameraArray(devices.size());

  50. if(n == 0) {

  51. qDebug() << "Cannot find Any camera!";

  52. return;

  53. }

  54. for (int i=0 ; i<cameraArray.GetSize() ; i++) {

  55. cameraArray[i].Attach(TLFactory.CreateDevice(devices[i]));

  56. string sn = cameraArray[i].GetDeviceInfo().GetSerialNumber();

  57. m_cameralist << QString::fromStdString(sn);

  58. }

  59. emit sigCameraUpdate(m_cameralist);

  60. }

  61. void SBaslerCameraControl::CopyToImage(CGrabResultPtr pInBuffer, QImage &OutImage)

  62. {

  63. uchar* buff = (uchar*)pInBuffer->GetBuffer();

  64. int nHeight = pInBuffer->GetHeight();

  65. int nWidth = pInBuffer->GetWidth();

  66. if(m_size != QSize(nWidth, nHeight)) {

  67. m_size = QSize(nWidth, nHeight);

  68. emit sigSizeChange(m_size);

  69. }

  70. QImage imgBuff(buff, nWidth, nHeight, QImage::Format_Indexed8);

  71. OutImage = imgBuff;

  72. if(pInBuffer->GetPixelType() == PixelType_Mono8) {

  73. uchar* pCursor = OutImage.bits();

  74. if ( OutImage.bytesPerLine() != nWidth ) {

  75. for ( int y=0; y<nHeight; ++y ) {

  76. pCursor = OutImage.scanLine( y );

  77. for ( int x=0; x<nWidth; ++x ) {

  78. *pCursor =* buff;

  79. ++pCursor;

  80. ++buff;

  81. }

  82. }

  83. } else {

  84. memcpy( OutImage.bits(), buff, nWidth * nHeight );

  85. }

  86. }

  87. }

  88. void SBaslerCameraControl::onTimerGrabImage()

  89. {

  90. if(m_isOpenAcquire) {

  91. QImage image;

  92. GrabImage(image, 5);

  93. if(!image.isNull()) {

  94. emit sigCurrentImage(image);

  95. }

  96. QTimer::singleShot(5, this, SLOT(onTimerGrabImage()));

  97. }

  98. }

  99. int SBaslerCameraControl::OpenCamera(QString cameraSN)

  100. {

  101. try {

  102. CDeviceInfo cInfo;

  103. String_t str = String_t(cameraSN.toStdString().c_str());

  104. cInfo.SetSerialNumber(str);

  105. m_basler.Attach(CTlFactory::GetInstance().CreateDevice(cInfo));

  106. m_basler.Open();

  107. //獲取觸發模式

  108. getFeatureTriggerSourceType();

  109. m_isOpen = true;

  110. } catch (GenICam::GenericException &e) {

  111. OutputDebugString(L"OpenCamera Error\n");

  112. m_isOpen = false;

  113. return -2;

  114. }

  115. return 0;

  116. }

  117. int SBaslerCameraControl::CloseCamera()

  118. {

  119. if(!m_isOpen) {

  120. return -1;

  121. }

  122. try {

  123. if(m_basler.IsOpen()) {

  124. m_basler.DetachDevice();

  125. m_basler.Close();

  126. }

  127. } catch (GenICam::GenericException &e) {

  128. OutputDebugString(LPCWSTR(e.GetDescription()));

  129. return -2;

  130. }

  131. return 0;

  132. }

  133. void SBaslerCameraControl::setExposureTime(double time)

  134. {

  135. SetCamera(Type_Basler_ExposureTimeAbs, time);

  136. }

  137. int SBaslerCameraControl::getExposureTime()

  138. {

  139. return QString::number(GetCamera(Type_Basler_ExposureTimeAbs)).toInt();

  140. }

  141. int SBaslerCameraControl::getExposureTimeMin()

  142. {

  143. return DOUBLE_MIN;

  144. }

  145. int SBaslerCameraControl::getExposureTimeMax()

  146. {

  147. return DOUBLE_MAX;

  148. }

  149. void SBaslerCameraControl::setFeatureTriggerSourceType(QString type)

  150. {

  151. //停止採集

  152. if(m_isOpenAcquire) {

  153. StopAcquire();

  154. }

  155. if(type == "Freerun") {

  156. SetCamera(Type_Basler_Freerun);

  157. } else if(type == "Line1"){

  158. SetCamera(Type_Basler_Line1);

  159. }

  160. }

  161. QString SBaslerCameraControl::getFeatureTriggerSourceType()

  162. {

  163. INodeMap &cameraNodeMap = m_basler.GetNodeMap();

  164. CEnumerationPtr ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");

  165. ptrTriggerSel->FromString("FrameStart");

  166. CEnumerationPtr ptrTrigger = cameraNodeMap.GetNode ("TriggerMode");

  167. ptrTrigger->SetIntValue(1);

  168. CEnumerationPtr ptrTriggerSource = cameraNodeMap.GetNode ("TriggerSource");

  169. String_t str = ptrTriggerSource->ToString();

  170. m_currentMode = QString::fromLocal8Bit(str.c_str());

  171. return m_currentMode;

  172. }

  173. void SBaslerCameraControl::setFeatureTriggerModeType(bool on)

  174. {

  175. INodeMap &cameraNodeMap = m_basler.GetNodeMap();

  176. CEnumerationPtr ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");

  177. ptrTriggerSel->FromString("FrameStart");

  178. CEnumerationPtr ptrTrigger = cameraNodeMap.GetNode ("TriggerMode");

  179. ptrTrigger->SetIntValue(on?1:0);

  180. }

  181. bool SBaslerCameraControl::getFeatureTriggerModeType()

  182. {

  183. INodeMap &cameraNodeMap = m_basler.GetNodeMap();

  184. CEnumerationPtr ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");

  185. ptrTriggerSel->FromString("FrameStart");

  186. CEnumerationPtr ptrTrigger = cameraNodeMap.GetNode ("TriggerMode");

  187. return ptrTrigger->GetIntValue() == 1;

  188. }

  189. void SBaslerCameraControl::SetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index, double tmpValue)

  190. {

  191. INodeMap &cameraNodeMap = m_basler.GetNodeMap();

  192. switch (index) {

  193. case Type_Basler_Freerun: {

  194. CEnumerationPtr ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");

  195. ptrTriggerSel->FromString("FrameStart");

  196. CEnumerationPtr ptrTrigger = cameraNodeMap.GetNode ("TriggerMode");

  197. #ifdef Real_Freerun

  198. ptrTrigger->SetIntValue(0);

  199. #else //Software

  200. ptrTrigger->SetIntValue(1);

  201. CEnumerationPtr ptrTriggerSource = cameraNodeMap.GetNode ("TriggerSource");

  202. ptrTriggerSource->FromString("Software");

  203. #endif

  204. } break;

  205. case Type_Basler_Line1: {

  206. CEnumerationPtr ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");

  207. ptrTriggerSel->FromString("FrameStart");

  208. CEnumerationPtr ptrTrigger = cameraNodeMap.GetNode ("TriggerMode");

  209. ptrTrigger->SetIntValue(1);

  210. CEnumerationPtr ptrTriggerSource = cameraNodeMap.GetNode ("TriggerSource");

  211. ptrTriggerSource->FromString("Line1");

  212. } break;

  213. case Type_Basler_ExposureTimeAbs: {

  214. const CFloatPtr exposureTime = cameraNodeMap.GetNode("ExposureTimeAbs");

  215. exposureTime->SetValue(tmpValue);

  216. } break;

  217. case Type_Basler_GainRaw: {

  218. const CIntegerPtr cameraGen = cameraNodeMap.GetNode("GainRaw");

  219. cameraGen->SetValue(tmpValue);

  220. } break;

  221. case Type_Basler_AcquisitionFrameRateAbs: {

  222. const CBooleanPtr frameRate = cameraNodeMap.GetNode("AcquisitionFrameRateEnable");

  223. frameRate->SetValue(TRUE);

  224. const CFloatPtr frameRateABS = cameraNodeMap.GetNode("AcquisitionFrameRateAbs");

  225. frameRateABS->SetValue(tmpValue);

  226. } break;

  227. case Type_Basler_Width: {

  228. const CIntegerPtr widthPic = cameraNodeMap.GetNode("Width");

  229. widthPic->SetValue(tmpValue);

  230. } break;

  231. case Type_Basler_Height: {

  232. const CIntegerPtr heightPic = cameraNodeMap.GetNode("Height");

  233. heightPic->SetValue(tmpValue);

  234. } break;

  235. case Type_Basler_LineSource: {

  236. CEnumerationPtr ptrLineSource = cameraNodeMap.GetNode ("LineSource");

  237. ptrLineSource->SetIntValue(2);

  238. } break;

  239. default:

  240. break;

  241. }

  242. }

  243. double SBaslerCameraControl::GetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index)

  244. {

  245. INodeMap &cameraNodeMap = m_basler.GetNodeMap();

  246. switch (index) {

  247. case Type_Basler_ExposureTimeAbs: {

  248. const CFloatPtr exposureTime = cameraNodeMap.GetNode("ExposureTimeAbs");

  249. return exposureTime->GetValue();

  250. } break;

  251. case Type_Basler_GainRaw: {

  252. const CIntegerPtr cameraGen = cameraNodeMap.GetNode("GainRaw");

  253. return cameraGen->GetValue();

  254. } break;

  255. case Type_Basler_AcquisitionFrameRateAbs: {

  256. const CBooleanPtr frameRate = cameraNodeMap.GetNode("AcquisitionFrameRateEnable");

  257. frameRate->SetValue(TRUE);

  258. const CFloatPtr frameRateABS = cameraNodeMap.GetNode("AcquisitionFrameRateAbs");

  259. return frameRateABS->GetValue();

  260. } break;

  261. case Type_Basler_Width: {

  262. const CIntegerPtr widthPic = cameraNodeMap.GetNode("Width");

  263. return widthPic->GetValue();

  264. } break;

  265. case Type_Basler_Height: {

  266. const CIntegerPtr heightPic = cameraNodeMap.GetNode("Height");

  267. return heightPic->GetValue();

  268. } break;

  269. default:

  270. return -1;

  271. break;

  272. }

  273. }

  274. long SBaslerCameraControl::StartAcquire()

  275. {

  276. m_isOpenAcquire = true;

  277. qDebug() << "SBaslerCameraControl IsGrabbing";

  278. try {

  279. qDebug() << "SBaslerCameraControl StartAcquire" << m_currentMode;

  280. if(m_currentMode == "Freerun") {

  281. m_basler.StartGrabbing(GrabStrategy_LatestImageOnly,GrabLoop_ProvidedByInstantCamera);

  282. } else if(m_currentMode == "Software") {

  283. m_basler.StartGrabbing(GrabStrategy_LatestImageOnly);

  284. onTimerGrabImage();

  285. } else if(m_currentMode == "Line1") {

  286. m_basler.StartGrabbing(GrabStrategy_OneByOne);

  287. } else if(m_currentMode == "Line2") {

  288. m_basler.StartGrabbing(GrabStrategy_OneByOne);

  289. }

  290. } catch (GenICam::GenericException &e) {

  291. OutputDebugString(L"StartAcquire error:");

  292. return -2;

  293. }

  294. return 0;

  295. }

  296. long SBaslerCameraControl::StopAcquire()

  297. {

  298. m_isOpenAcquire = false;

  299. qDebug() << "SBaslerCameraControl StopAcquire";

  300. try {

  301. if (m_basler.IsGrabbing()) {

  302. m_basler.StopGrabbing();

  303. }

  304. } catch (GenICam::GenericException &e) {

  305. OutputDebugString(LPCWSTR(e.GetDescription()));

  306. return -2;

  307. }

  308. return 0;

  309. }

  310. long SBaslerCameraControl::GrabImage(QImage &image, int timeout)

  311. {

  312. try {

  313. if (!m_basler.IsGrabbing()) {

  314. StartAcquire();

  315. }

  316. CGrabResultPtr ptrGrabResult;

  317. if(m_currentMode == "Freerun") {

  318. } else if(m_currentMode == "Software") {

  319. if (m_basler.WaitForFrameTriggerReady(1000, TimeoutHandling_Return)) {

  320. m_basler.ExecuteSoftwareTrigger();

  321. m_basler.RetrieveResult(timeout, ptrGrabResult,TimeoutHandling_Return);

  322. }

  323. } else if(m_currentMode == "Line1") {

  324. m_basler.RetrieveResult(timeout, ptrGrabResult, TimeoutHandling_Return);

  325. } else if(m_currentMode == "Line2") {

  326. m_basler.RetrieveResult(timeout, ptrGrabResult, TimeoutHandling_Return);

  327. }

  328. if (ptrGrabResult->GrabSucceeded()) {

  329. if (!ptrGrabResult.IsValid()) { OutputDebugString(L"GrabResult not Valid Error\n"); return -1; }

  330. EPixelType pixelType = ptrGrabResult->GetPixelType();

  331. switch (pixelType) {

  332. case PixelType_Mono8: {

  333. CopyToImage(ptrGrabResult, image);

  334. } break;

  335. case PixelType_BayerRG8: { qDebug() << "what: PixelType_BayerRG8"; } break;

  336. default: qDebug() << "what: default"; break;

  337. }

  338. } else {

  339. OutputDebugString(L"Grab Error!!!");

  340. return -3;

  341. }

  342. } catch (GenICam::GenericException &e) {

  343. OutputDebugString(L"GrabImage Error\n");

  344. return -2;

  345. } catch(...) {

  346. OutputDebugString(L"ZP 11 Shot GetParam Try 12 No know Error\n");

  347. return -1;

  348. }

  349. return 0;

  350. }

如何呼叫

  1. #ifndef MAINWINDOW_H

  2. #define MAINWINDOW_H

  3. #include <QMainWindow>

  4. #include "BaslerCamera/sbaslercameracontrol.h"

  5. namespace Ui {

  6. class MainWindow;

  7. }

  8. class MainWindow : public QMainWindow

  9. {

  10. Q_OBJECT

  11. public:

  12. explicit MainWindow(QWidget *parent = 0);

  13. ~MainWindow();

  14. private slots:

  15. void on_pushButton_GetExTime_clicked();

  16. void on_pushButton_SetExTime_clicked();

  17. void on_pushButton_SetMode_clicked();

  18. void on_pushButton_GetMode_clicked();

  19. void on_pushButton_CFMode_clicked();

  20. void on_comboBox_CFMode_activated(int index);

  21. void on_pushButton_Start_clicked();

  22. void on_pushButtonRotate_clicked();

  23. private:

  24. Ui::MainWindow *ui;

  25. SBaslerCameraControl* m_control = Q_NULLPTR;

  26. QMatrix m_matrix;

  27. };

  28. #endif // MAINWINDOW_H

原始檔:

  1. #include "mainwindow.h"

  2. #include "ui_mainwindow.h"

  3. #include <QDebug>

  4. MainWindow::MainWindow(QWidget *parent) :

  5. QMainWindow(parent),

  6. ui(new Ui::MainWindow)

  7. {

  8. ui->setupUi(this);

  9. m_control = new SBaslerCameraControl(this);

  10. m_control->initSome();

  11. connect(m_control, &SBaslerCameraControl::sigCurrentImage, [=](QImage img){

  12. QPixmap pix = QPixmap::fromImage(img).transformed(m_matrix);

  13. ui->label->setPixmap(pix);

  14. ui->widget_pic->setFixedSize(pix.size());

  15. });

  16. connect(m_control, &SBaslerCameraControl::sigSizeChange, [=](QSize size){

  17. // 預設大小641,494

  18. ui->label_size->setText(QString("\345\260\272\345\257\270:%0*%1").arg(QString::number(size.width())).arg(QString::number(size.height()))); // 尺寸

  19. ui->widget_pic->setFixedSize(size);

  20. });

  21. m_control->OpenCamera(m_control->cameras().first());

  22. }

  23. MainWindow::~MainWindow()

  24. {

  25. m_control->CloseCamera();

  26. m_control->deleteAll();

  27. delete ui;

  28. }

  29. void MainWindow::on_pushButton_GetExTime_clicked()

  30. {

  31. ui->label_exTime->setText(QString::number(m_control->getExposureTime()));

  32. }

  33. void MainWindow::on_pushButton_SetExTime_clicked()

  34. {

  35. m_control->setExposureTime(ui->lineEdit_exTime->text().toDouble());

  36. }

  37. void MainWindow::on_pushButton_SetMode_clicked()

  38. {

  39. m_control->setFeatureTriggerSourceType(ui->lineEdit_SetMode->text());

  40. }

  41. void MainWindow::on_pushButton_GetMode_clicked()

  42. {

  43. ui->label_Mode->setText(m_control->getFeatureTriggerSourceType());

  44. }

  45. void MainWindow::on_pushButton_CFMode_clicked()

  46. {

  47. ui->label_CFMode->setText(m_control->getFeatureTriggerModeType()?"Open":"Close");

  48. }

  49. void MainWindow::on_comboBox_CFMode_activated(int index)

  50. {

  51. m_control->setFeatureTriggerModeType(index == 0);

  52. }

  53. void MainWindow::on_pushButton_Start_clicked()

  54. {

  55. if(ui->pushButton_Start->text() == "\345\274\200\345\247\213\351\207\207\351\233\206") {// 開始採集

  56. m_control->StartAcquire();

  57. ui->pushButton_Start->setText("\347\273\223\346\235\237\351\207\207\351\233\206");// 結束採集

  58. } else {

  59. m_control->StopAcquire();

  60. ui->pushButton_Start->setText("\345\274\200\345\247\213\351\207\207\351\233\206");// 開始採集

  61. }

  62. }

  63. void MainWindow::on_pushButtonRotate_clicked()

  64. {

  65. m_matrix.rotate(90);

  66. }

pro檔案

(注意:引用庫檔案的路徑哦)

  1. #-------------------------------------------------

  2. #

  3. # Project created by QtCreator 2017-12-14T17:55:52

  4. #

  5. #-------------------------------------------------

  6. QT += core gui

  7. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

  8. TARGET = Demo_BaslerCamera

  9. TEMPLATE = app

  10. CONFIG += c++11

  11. #--------------------------------------------Basler-------------------------------------------

  12. INCLUDEPATH += $$PWD/include

  13. LIBS += -L$$PWD/lib/Win32 -lGCBase_MD_VC120_v3_0_Basler_pylon_v5_0 -lGenApi_MD_VC120_v3_0_Basler_pylon_v5_0 -lPylonBase_MD_VC120_v5_0 -lPylonC_MD_VC120 -lPylonGUI_MD_VC120_v5_0 -lPylonUtility_MD_VC120_v5_0

  14. #----------------------------------------------------------------------------------------------

  15. SOURCES += main.cpp\

  16. mainwindow.cpp \

  17. BaslerCamera/sbaslercameracontrol.cpp

  18. HEADERS += mainwindow.h \

  19. BaslerCamera/sbaslercameracontrol.h

  20. FORMS += mainwindow.ui

我把程式碼已經上傳到

碼雲

以上是Basler相機小Demo。如有問題直接在部落格下提問,有時間的小夥伴也可以參與到專案中來……