#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <sstream>
#include <filesystem>
#include "SpinStereoHelper.h"
#include "StereoParameters.h"
#include "Getopt.h"
using namespace std;
{
string executionPath = string(argv[0]);
size_t found = executionPath.find_last_of("/\\");
string programName = executionPath.substr(found + 1);
int iOpt;
const char* currentParamPosition;
if (argc == 1)
{
return true;
}
const char* paramMatchPattern = "h?";
while ((iOpt =
GetOption(argc, argv, paramMatchPattern, ¤tParamPosition)) != 0)
{
switch (iOpt)
{
case '?':
case 'h':
{
return false;
}
default:
cerr << "Invalid option provided: " << currentParamPosition << endl;
return false;
}
}
return true;
}
{
cout << "Usage: ";
cout << pszProgramName << " [OPTIONS]" << endl << endl;
cout << "OPTIONS" << endl << endl << "EXAMPLE" << endl << endl << " " << pszProgramName << endl << endl;
}
{
bool result = true;
INodeMap& nodeMapCamera = pCam->GetNodeMap();
return result;
}
{
bool result = true;
cout << endl << endl << "*** IMAGE ACQUISITION ***" << endl << endl;
try
{
pCam->BeginAcquisition();
gcstring serialNumber = pCam->TLDevice.DeviceSerialNumber.GetValue();
uint64_t timeoutInMilliSecs = 5000;
#define INFINITE_TIMEOUT 0xFFFFFFFFFFFFFFFF
cout << "Acquiring " << numImageSets << " image sets pending on GPIO signal,";
{
cout << " within an infinite time limit." << endl;
}
else
{
cout << " within a time limit of " << timeoutInMilliSecs / 1000 << " secs." << endl;
}
for (unsigned int counter = 0; counter < numImageSets; counter++)
{
try
{
cout << endl << "Acquiring stereo image set: " << counter << ", pending on GPIO signal." << endl;
imageList = pCam->GetNextImageSync(timeoutInMilliSecs);
{
cout << "Failed to get next image list." << endl;
continue;
}
}
{
cout <<
"Error: " << e.
what() << endl;
result = false;
}
}
pCam->EndAcquisition();
}
{
cout <<
"Error: " << e.
what() << endl;
result = false;
}
return result;
}
{
bool result = true;
try
{
INodeMap& nodeMapTLDevice = pCam->GetTLDeviceNodeMap();
pCam->Init();
cout << endl << "Checking camera stereo support..." << endl;
if (!ImageUtilityStereo::IsStereoCamera(pCam))
{
cout << "Device serial number " << pCam->TLDevice.DeviceSerialNumber.GetValue()
<< " is not a valid BX camera. Skipping..." << endl;
return true;
}
#ifdef _DEBUG
#else
#endif
cout << endl << "Configuring camera..." << endl;
cout << endl << "Configuring GPIO..." << endl;
cout << endl <<
"*** STEREO PARAMETERS *** " << endl << stereoParameters.
ToString() << endl;
#if _DEBUG
cout << endl << "*** CAMERA CALIBRATION PARAMETERS ***" << endl;
{
cerr << "Failed to get camera calibration parameters." << endl;
return false;
}
#endif
cout << endl << "Acquiring images..." << endl;
#ifdef _DEBUG
#endif
pCam->DeInit();
}
{
cout <<
"Error: " << e.
what() << endl;
result = false;
}
return result;
}
int main(
int argc,
char** argv)
{
string programName = argv[0];
{
return -1;
}
cout << "Application build date: " << __DATE__ << " " << __TIME__ << endl << endl;
const LibraryVersion spinnakerLibraryVersion = system->GetLibraryVersion();
cout <<
"Spinnaker library version: " << spinnakerLibraryVersion.
major <<
"." << spinnakerLibraryVersion.
minor
<<
"." << spinnakerLibraryVersion.
type <<
"." << spinnakerLibraryVersion.
build << endl
<< endl;
const unsigned int numCameras = camList.
GetSize();
cout << "Number of cameras detected: " << numCameras << endl << endl;
if (numCameras == 0)
{
system->ReleaseInstance();
cout << "Not enough cameras!" << endl;
cout << "Done! Press Enter to exit..." << endl;
getchar();
return -1;
}
bool result = true;
for (unsigned int i = 0; i < numCameras; i++)
{
cout << endl << "Running example for camera " << i << "..." << endl;
cout << "Camera " << i << " example complete..." << endl << endl;
}
pCam = nullptr;
system->ReleaseInstance();
cout << endl << "Done! Press Enter to exit..." << endl;
getchar();
return (result == true) ? 0 : -1;
}
int AcquireImages(CameraPtr pCam, INodeMap &nodeMap, INodeMap &nodeMapTLDevice)
Definition Acquisition.cpp:199
int main(int, char **)
Definition Acquisition.cpp:527
int ResetGVCPHeartbeat(CameraPtr pCam)
Definition Acquisition.cpp:138
int RunSingleCamera(CameraPtr pCam)
Definition Acquisition.cpp:479
int PrintDeviceInfo(INodeMap &nodeMap)
Definition Acquisition.cpp:441
int DisableGVCPHeartbeat(CameraPtr pCam)
Definition Acquisition.cpp:143
int GetOption(int argc, char **argv, const char *pszValidOpts, const char **ppszParam)
Definition Getopt.c:96
bool ProcessArgs(int argc, char *argv[], StereoAcquisitionParams ¶ms)
ProcessArgs.
Definition StereoAcquisition.cpp:75
void DisplayHelp(const string &pszProgramName, const StereoAcquisitionParams ¶ms)
DisplayHelp.
Definition StereoAcquisition.cpp:201
bool ConfigureGPIO(CameraPtr pCam)
Definition StereoGPIO.cpp:108
Class for handling parameters of the S3D camera.
Definition StereoParameters.h:66
std::string ToString() const
Converts the parameters to a string representation.
Definition StereoParameters.cpp:48
StreamTransmitFlags streamTransmitFlags
Flags to enable streams image transmission.
Definition StereoParameters.h:84
Used to hold a list of camera objects.
Definition CameraList.h:42
void Clear()
Clears the list of cameras and destroys their corresponding reference counted objects.
CameraPtr GetByIndex(unsigned int index) const
Returns a pointer to a camera object at the "index".
unsigned int GetSize() const
Returns the size of the camera list.
A reference tracked pointer to a camera object.
Definition CameraPtr.h:44
The Exception object represents an error that is returned from the library.
Definition Exception.h:51
virtual const char * what() const
virtual override for what().
Used to hold a list of image objects.
Definition ImageList.h:42
A reference tracked pointer to a system object.
Definition SystemPtr.h:44
interface SPINNAKER_API_ABSTRACT INodeMap
Interface to access the node map.
Definition INodeMap.h:54
bool SetEnumAsStringValueToNode(INodeMap &nodeMap, const gcstring &nodeName, gcstring nodeEnumValAsStr)
Sets an enumerated string value to a specified node.
Definition SpinStereoHelper.cpp:723
bool PrintCameraCalibrationParams(INodeMap &nodeMap)
Prints the camera calibration parameters.
Definition SpinStereoHelper.cpp:958
Definition SpinStereoHelper.cpp:34
bool ValidateImageList(const StreamTransmitFlags &streamTransmitFlags, ImageList &imageList)
Definition SpinStereoHelper.cpp:763
bool ConfigureAcquisition(CameraPtr pCam, StreamTransmitFlags &streamTransmitFlags)
Definition SpinStereoHelper.cpp:247
Definition Autovector.h:36
Definition StereoParameters.h:40
bool rectSensor1TransmitEnabled
Flag to enable rectified sensor1 image transmission.
Definition StereoParameters.h:43
bool disparityTransmitEnabled
Flag to enable disparity image transmission.
Definition StereoParameters.h:45
Provides easier access to the current version of Spinnaker.
Definition SpinnakerDefs.h:657
unsigned int minor
Minor version of the library.
Definition SpinnakerDefs.h:662
unsigned int major
Major version of the library.
Definition SpinnakerDefs.h:659
unsigned int type
Version type of the library.
Definition SpinnakerDefs.h:665
unsigned int build
Build number of the library.
Definition SpinnakerDefs.h:668
Definition StereoGPIO.h:32
bool doEnableDisparityTransmit
Definition StereoGPIO.h:35
bool doEnableRectSensor1Transmit
Definition StereoGPIO.h:34
int numImageGroups
Definition StereoGPIO.h:33