#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;
cout << "Trigger mode disabled." << endl;
cout << "Trigger source set to hardware, line 0." << endl;
cout << "Trigger selector set to frame start." << endl;
cout << "Line selector set line 1." << endl;
cout << "Line source set to exposure active." << endl;
cout << "Trigger mode enabled." << endl;
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;
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 set." << 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;
{
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;
cout << "Trigger mode disabled." << endl;
#ifdef _DEBUG
#endif
pCam->DeInit();
}
{
cout <<
"Error: " << e.
what() << endl;
result = false;
}
return result;
}
int main(
int argc,
char** argv)
{
{
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;
}