Я получил программное обеспечение C ++ для получения изображений с камер Basler от производителя;сейчас я пытаюсь заставить это работать.
#include <pylon/PylonIncludes.h>
#ifdef PYLON_WIN_BUILD
# include <pylon/PylonGUI.h>
#endif
// Namespace for using pylon objects.
using namespace Pylon;
using namespace GenApi;
#include <opencv2/opencv.hpp>
using namespace cv;
// Namespace for using cout.
using namespace std;
#include <stdio.h>
#include "kbhit.h"
#include <sys/stat.h> // for checking the file size
#include <sstream>
// Number of images to be grabbed.
//static const uint32_t c_countOfImagesToGrab = 100;
int main(int argc, char* argv[])
{
// The exit code of the sample application.
int exitCode = 0;
// Automagically call PylonInitialize and PylonTerminate to ensure the pylon runtime system
// is initialized during the lifetime of this object.
Pylon::PylonAutoInitTerm autoInitTerm;
VideoWriter cvVideoCreator;
struct stat statbuf;
string filenameBase = "/opt/PylonTestAVI";
uint filecounter = 1;
string filename = "";
try
{
// Create an instant camera object with the camera device found first.
CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());
camera.Open();
INodeMap& nodeMap = camera.GetNodeMap();
CEnumerationPtr TestImageSelector = nodeMap.GetNode("TestImageSelector");
TestImageSelector->FromString("Testimage4");
CIntegerPtr Width = nodeMap.GetNode("Width");
CIntegerPtr Height = nodeMap.GetNode("Height");
Size FrameSize = Size(Width->GetValue(),Height->GetValue());
stringstream s ;
s<<"_" ;
s<< filecounter;
filename = filenameBase;
filename += s.str() + ".avi";
//cvVideoCreator.open("/opt/PylonTest_DIVX.avi",CV_FOURCC('M','P','4','2'),20,FrameSize,true);
cvVideoCreator.open(filename,CV_FOURCC('D','I','V','X'),20,FrameSize,true);
...
Я пытаюсь скомпилировать это, используя
g++ $(pkg-config --cflags --libs opencv4) GrabV3.cpp -I/opt/pylon5/include -I/opt/pylon5/include/pylon -L/opt/pylon5/lib64 -L/opt/pylon5/include/pylon
, но получаю сообщение об ошибке
GrabV3.cpp: In function ‘int main(int, char**)’:
GrabV3.cpp:86:32: error: ‘CV_FOURCC’ was not declared in this scope
cvVideoCreator.open(filename,CV_FOURCC('D','I','V','X'),20,FrameSize,true);
Я не понимаю этого, поскольку CV_FOURCC ('D', 'I', 'V', 'X') является встроенной функцией, определенной в /usr/include/opencv2/videoio/videoio.h, которая должна бытьпути включения.
Что не так?
Я начал это обсуждение здесь: Компиляция программы для использования камеры Basler , но я начинаю новую тему, потому чтоакцент проблемы изменился.