#include <iostream>
#include <sstream>
using namespace Spinnaker;
using namespace Spinnaker::GenApi;
using namespace Spinnaker::GenICam;
using namespace std;
{
cout << "Unable to get " << node << " (" << name << " " << node << " retrieval failed)." << endl << endl;
cout << "The " << node << " may not be readable on all camera models..." << endl;
cout << "Please try a Blackfly S camera." << endl << endl;
}
{
int result = 0;
cout << endl << endl << "*** CONFIGURING LOOKUP TABLES ***" << endl << endl;
try
{
{
{
return -1;
}
ptrLUTType->SetIntValue(static_cast<int64_t>(ptrLUTTypeType->GetValue()));
}
CEnumEntryPtr ptrLUTSelectorLUT = ptrLUTSelector->GetEntryByName(
"LUT1");
{
ptrLUTSelectorLUT = ptrLUTSelector->GetEntryByName("UserDefined1");
{
return -1;
}
cout << "Lookup table selector set to User Defined 1..." << endl;
}
else
{
cout << "Lookup table selector set to LUT 1..." << endl;
}
ptrLUTSelector->SetIntValue(static_cast<int64_t>(ptrLUTSelectorLUT->GetValue()));
{
return -1;
}
{
return -1;
}
int maxVal = (int)ptrLUTValue->GetMax();
cout << "\tMaximum Value: " << maxVal << endl;
int maxIndex = (int)ptrLUTIndex->GetMax();
cout << "\tMaximum Index: " << maxIndex << endl;
int increment = maxVal / maxIndex;
if (increment > 0)
{
cout << "\tIncrement: " << increment << endl;
for(int i = 0; i < maxIndex; i++)
{
ptrLUTIndex->SetValue(i);
ptrLUTValue->SetValue(i * increment);
}
}
else
{
int denominator = maxIndex / maxVal;
cout << "\tIncrement: 1/" << denominator << endl;
for(int i = 0; i < maxIndex; i++)
{
ptrLUTIndex->SetValue(i);
ptrLUTValue->SetValue(i / denominator);
}
}
cout << "All lookup table values set..." << endl;
CBooleanPtr ptrLUTEnable = nodeMap.GetNode(
"LUTEnable");
{
{
return -1;
}
CEnumEntryPtr ptrLUTModeActive = ptrLUTMode->GetEntryByName(
"Active");
ptrLUTMode->SetIntValue(ptrLUTModeActive->GetValue());
}
else
{
ptrLUTEnable->SetValue(true);
}
cout << "Lookup tables enabled..." << endl << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
CBooleanPtr ptrLUTEnable = nodeMap.GetNode(
"LUTEnable");
{
{
cout << endl << "Unable to disable lookup tables. Non-fatal error..." << endl << endl;
return -1;
}
else
{
ptrLUTMode->SetIntValue(ptrLUTModeOff->GetValue());
}
}
else
{
ptrLUTEnable->SetValue(false);
}
cout << "Lookup tables disabled..." << endl << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
cout << endl << "*** DEVICE INFORMATION ***" << endl << endl;
try
{
FeatureList_t features;
CCategoryPtr category = nodeMap.GetNode(
"DeviceInformation");
{
category->GetFeatures(features);
FeatureList_t::const_iterator it;
for (it = features.begin(); it != features.end(); ++it)
{
cout << pfeatureNode->GetName() << " : ";
cout << (
IsReadable(pValue) ? pValue->ToString() :
"Node not readable");
cout << endl;
}
}
else
{
cout << "Device control information not readable." << endl;
}
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
cout << endl << "*** IMAGE ACQUISITION ***" << endl << endl;
try
{
{
cout << "Unable to get or set acquisition mode to continuous (node retrieval). Aborting..." << endl << endl;
return -1;
}
CEnumEntryPtr ptrAcquisitionModeContinuous = ptrAcquisitionMode->GetEntryByName(
"Continuous");
{
cout << "Unable to get acquisition mode to continuous (entry 'continuous' retrieval). Aborting..." << endl
<< endl;
return -1;
}
int64_t acquisitionModeContinuous = ptrAcquisitionModeContinuous->GetValue();
ptrAcquisitionMode->SetIntValue(acquisitionModeContinuous);
cout << "Acquisition mode set to continuous..." << endl;
pCam->BeginAcquisition();
cout << "Acquiring images..." << endl;
CStringPtr ptrStringSerial = nodeMapTLDevice.GetNode(
"DeviceSerialNumber");
{
deviceSerialNumber = ptrStringSerial->GetValue();
cout << "Device serial number retrieved as " << deviceSerialNumber << "..." << endl;
}
cout << endl;
for (
unsigned int imageCnt = 0; imageCnt <
k_numImages; imageCnt++)
{
try
{
ImagePtr pResultImage = pCam->GetNextImage(1000);
if (pResultImage->IsIncomplete())
{
cout << "Image incomplete with image status " << pResultImage->GetImageStatus() << "..." << endl
<< endl;
}
else
{
cout << "Grabbed image " << imageCnt << ", width = " << pResultImage->GetWidth()
<< ", height = " << pResultImage->GetHeight() << endl;
ostringstream filename;
filename << "LookupTable-";
if (deviceSerialNumber != "")
{
filename << deviceSerialNumber.c_str() << "-";
}
filename << imageCnt << ".jpg";
convertedImage->Save(filename.str().c_str());
cout << "Image saved at " << filename.str() << endl;
}
pResultImage->Release();
cout << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
}
pCam->EndAcquisition();
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
int err = 0;
try
{
INodeMap& nodeMapTLDevice = pCam->GetTLDeviceNodeMap();
pCam->Init();
if (err < 0)
{
return err;
}
pCam->DeInit();
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
FILE* tempFile = fopen("test.txt", "w+");
if (tempFile == nullptr)
{
cout << "Failed to create file in current folder. Please check "
"permissions."
<< endl;
cout << "Press Enter to exit..." << endl;
getchar();
return -1;
}
fclose(tempFile);
remove("test.txt");
int result = 0;
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;
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;
}
for (unsigned int i = 0; i < numCameras; i++)
{
cout << endl << "Running example for camera " << i << "..." << endl;
cout << "Camera " << i << " example complete..." << endl << endl;
}
system->ReleaseInstance();
cout << endl << "Done! Press Enter to exit..." << endl;
getchar();
return result;
}