Sometimes it is necessary to modify certain sequencer parameters. The standard way to do this is to
This depending on the device, the system and the application can take quite some time. This is where the feature explained in this example might come in handy. The mvIMPACT::acquire::GenICam::CustomCommandGenerator class is capable of sending commands to a device that can directly modify one or more parameters in one or more sequencer sets without stopping the running sequencer or the acquisition engine. As this happens fast but asynchronously an application must accept that changes applied this way might become effective not with the next but with the 2nd frame captured after the parameter change applied but most of the time this is OK.
#include <algorithm>
#include <array>
#include <functional>
#include <iostream>
#include <iomanip>
#include <thread>
#include <apps/Common/exampleHelper.h>
#ifdef _WIN32
# include <conio.h>
# define USE_DISPLAY
enum keys
{
KEY_MINUS = 45,
KEY_PLUS = 43,
KEY_PAGEDOWN = 81,
KEY_PAGEUP = 73,
KEY_UP = 72,
KEY_DOWN = 80,
KEY_LEFT = 75,
KEY_RIGHT = 77,
KEY_SPACE = 32,
KEY_L = 108,
KEY_R = 114,
KEY_ENTER_CR = 13,
KEY_ENTER_LF = 10,
KEY_USELESS_ADDITIONAL_KEY_1 = 224,
KEY_USELESS_ADDITIONAL_KEY_2 = 1234,
KEY_USELESS_ADDITIONAL_KEY_3 = 2345
};
#else
# include <stdio.h>
# include <termios.h>
# include <unistd.h>
char _getch( void )
{
struct termios oldTerminalSettings, newTerminalSettings;
char ch;
tcgetattr( 0, &oldTerminalSettings );
newTerminalSettings = oldTerminalSettings;
newTerminalSettings.c_lflag &= ~ICANON;
newTerminalSettings.c_lflag &= ~ECHO;
tcsetattr( 0, TCSANOW, &newTerminalSettings );
ch = getchar();
tcsetattr( 0, TCSANOW, &oldTerminalSettings );
return ch;
}
enum keys
{
KEY_MINUS = 45,
KEY_PLUS = 43,
KEY_PAGEDOWN = 54,
KEY_PAGEUP = 53,
KEY_UP = 65,
KEY_DOWN = 66,
KEY_LEFT = 68,
KEY_RIGHT = 67,
KEY_SPACE = 32,
KEY_L = 108,
KEY_R = 114,
KEY_ENTER_CR = 13,
KEY_ENTER_LF = 10,
KEY_USELESS_ADDITIONAL_KEY_1 = 27,
KEY_USELESS_ADDITIONAL_KEY_2 = 91,
KEY_USELESS_ADDITIONAL_KEY_3 = 126
};
#endif
using namespace std;
struct SequencerSetParameter
{
const int64_type setNr_;
const int64_type sequencerSetNext_;
const int64_type alternativeSetNext_;
const double exposureTime_us_;
explicit SequencerSetParameter( const int64_type setNr, const int64_type sequencerSetNext, const int64_type alternativeSetNext, const double exposureTime_us ) :
setNr_( setNr ), sequencerSetNext_( sequencerSetNext ), alternativeSetNext_( alternativeSetNext ), exposureTime_us_( exposureTime_us )
{
}
};
struct ThreadParameter
{
Device* pDev;
GenICam::AcquisitionControl ac;
GenICam::ImageFormatControl ifc;
GenICam::SequencerControl sc;
GenICam::CustomCommandGenerator ccg;
GenICam::DigitalIOControl dic;
int curWidth;
int curHeight;
int setWidth;
int setHeight;
int maxSensorWidth;
int maxSensorHeight;
int minSensorWidth;
int minSensorHeight;
int maxAllowedWidth;
int maxAllowedHeight;
int minAllowedWidth;
int minAllowedHeight;
int widthStepWidth;
int heightStepWidth;
int numWidthSteps;
int numHeightSteps;
int curStepX;
int curStepY;
int setStepX;
int setStepY;
int minExpStep;
int maxExpStep;
int curStepExposure;
int setStepExposure;
bool applyInitialParameters;
bool runRandomParameters;
bool runLoopAndUserInputMode;
bool loopAndUserInputModeRunning;
#ifdef USE_DISPLAY
ImageDisplayWindow displayWindow;
#endif
explicit ThreadParameter( Device* p ) : pDev( p ), ac( p ), ifc( p ), sc( p ), ccg( p ), dic( p ), curWidth( 0 ), curHeight( 0 ), setWidth( 0 ), setHeight( 0 ), maxSensorWidth( 0 ), maxSensorHeight( 0 ), minSensorWidth( 0 ), minSensorHeight( 0 ), maxAllowedWidth( 0 ), maxAllowedHeight( 0 ), minAllowedWidth( 0 ), minAllowedHeight( 0 ), widthStepWidth( 0 ), heightStepWidth( 0 ), numWidthSteps( 0 ), numHeightSteps( 0 ), curStepX( 0 ), curStepY( 0 ), setStepX( 0 ), setStepY( 0 ), minExpStep( 0 ), maxExpStep( 0 ), curStepExposure( 0 ), setStepExposure( 0 ), applyInitialParameters( true ), runRandomParameters( true ), runLoopAndUserInputMode( false ), loopAndUserInputModeRunning( false )
#ifdef USE_DISPLAY
, displayWindow( "mvIMPACT_acquire sample, Device " + pDev->serial.read() )
#endif
{
}
ThreadParameter( const ThreadParameter& src ) = delete;
ThreadParameter& operator=( const ThreadParameter& rhs ) = delete;
};
static bool s_boTerminated = false;
static array<SequencerSetParameter, 6> s_SequencerData =
{
SequencerSetParameter( 0, 1, 8, 11000. ),
SequencerSetParameter( 1, 2, 8, 12000. ),
SequencerSetParameter( 2, 3, 8, 13000. ),
SequencerSetParameter( 3, 4, 8, 14000. ),
SequencerSetParameter( 4, 5, 8, 15000. ),
SequencerSetParameter( 5, 0, 8, 16000. )
};
static array<SequencerSetParameter, 1> s_SequencerLoopData =
{
SequencerSetParameter( 8, 8, 0, 8888. )
};
static void configureDevice( Device* pDev, ThreadParameter* pTP );
static bool isDeviceSupportedBySample( const Device* const pDev );
static void liveThread( ThreadParameter* pTP );
void printHelp( void )
{
cout << "#############################################################################" << endl
<< "#############################################################################" << endl
<< "# This example runs " << s_SequencerData.size() << " SequencerSets, where the ExposureTime varies between" << endl
<< "# the SequencerSets. There are two modes. The example starts in random mode," << endl
<< "# where ExposureTime as well as OffsetX and OffsetY is changed every 100" << endl
<< "# images randomly. The manual mode allows to change these parameters using" << endl
<< "# keys:" << endl
<< "# [Space] (re)start manual mode" << endl
<< "# [l] (re)start loop mode" << endl
<< "# [r] go back to / restart random mode" << endl
<< "#" << endl
<< "# [Left] move AOI to the left" << endl
<< "# [Right] move AOI to the right" << endl
<< "# [Up] move AOI upwards" << endl
<< "# [Down] move AOI downwards" << endl
<< "# [+] increase AOI size" << endl
<< "# [-] decrease AOI size" << endl
<< "#" << endl
<< "# [PageUp] increase ExposureTime" << endl
<< "# [PageDown] decrease ExposureTime" << endl
<< "#############################################################################" << endl
<< "#############################################################################" << endl
<< "# Press [h] to show this help." << endl
<< "#############################################################################" << endl
<< "#############################################################################" << endl
<< "# Press [ENTER] to end the application." << endl
<< "#############################################################################" << endl
<< "#############################################################################" << endl;
}
void checkedMethodCall( Device* pDev, Method& method )
{
{
std::cout << "An error was returned while calling function '" << method.displayName() << "' on device " << pDev->serial.read()
}
}
void configureDevice( Device* pDev, ThreadParameter* pTP )
{
try
{
GenICam::UserSetControl usc( pDev );
conditionalSetEnumPropertyByString( usc.userSetSelector, "Default" );
{
std::cout << "An error occurred while restoring the factory default for device " << pDev->serial.read()
}
GenICam::AcquisitionControl acqc( pDev );
conditionalSetEnumPropertyByString( acqc.exposureMode, "Timed" );
conditionalSetEnumPropertyByString( acqc.exposureAuto, "Off" );
GenICam::AnalogControl ac( pDev );
if( ac.gainSelector.isValid() )
{
vector<string> validGainSelectorValues;
ac.gainSelector.getTranslationDictStrings( validGainSelectorValues );
for( const auto& gainSelectorValue : validGainSelectorValues )
{
conditionalSetEnumPropertyByString( ac.gainSelector, gainSelectorValue );
conditionalSetEnumPropertyByString( ac.gainAuto, "Off" );
}
}
else
{
conditionalSetEnumPropertyByString( ac.gainAuto, "Off" );
}
GenICam::ChunkDataControl cdc( pDev );
cdc.chunkModeActive.write(
bTrue );
ImageProcessing ip( pDev );
ip.colorProcessing.write(
cpmRaw );
if( ip.tapSortEnable.isValid() )
{
ip.tapSortEnable.write(
bFalse );
}
pTP->maxSensorWidth = static_cast<int>( pTP->ifc.widthMax.read() );
pTP->maxSensorHeight = static_cast<int>( pTP->ifc.heightMax.read() );
pTP->minSensorWidth = static_cast<int>( pTP->ifc.width.getMinValue() );
pTP->minSensorHeight = static_cast<int>( pTP->ifc.height.getMinValue() );
pTP->widthStepWidth = static_cast<int>( pTP->ifc.width.getStepWidth() );
pTP->heightStepWidth = static_cast<int>( pTP->ifc.height.getStepWidth() );
pTP->curWidth = pTP->maxAllowedWidth = ( min( ( pTP->maxSensorWidth - pTP->minSensorWidth ) * 2 / 3, 1600 ) / pTP->widthStepWidth ) * pTP->widthStepWidth;
pTP->curHeight = pTP->maxAllowedHeight = ( min( ( pTP->maxSensorHeight - pTP->minSensorHeight ) * 2 / 3, 1024 ) / pTP->heightStepWidth ) * pTP->heightStepWidth;
pTP->ifc.width.write( pTP->curWidth );
pTP->ifc.height.write( pTP->curHeight );
pTP->minAllowedWidth = ( max( ( pTP->maxSensorWidth - pTP->minSensorWidth ) * 1 / 10, 512 ) / pTP->widthStepWidth ) * pTP->widthStepWidth;
pTP->minAllowedHeight = ( max( ( pTP->maxSensorHeight - pTP->minSensorHeight ) * 1 / 10, 512 ) / pTP->heightStepWidth ) * pTP->heightStepWidth;
do
{
pTP->numWidthSteps = ( pTP->maxSensorWidth - pTP->curWidth ) / pTP->widthStepWidth;
if( pTP->numWidthSteps > 100 )
{
pTP->widthStepWidth *= 2;
}
}
while( pTP->numWidthSteps > 100 );
do
{
pTP->numHeightSteps = ( pTP->maxSensorHeight - pTP->curHeight ) / pTP->heightStepWidth;
if( pTP->numHeightSteps > 100 )
{
pTP->heightStepWidth *= 2;
}
}
while( pTP->numHeightSteps > 100 );
pTP->curStepX = pTP->numWidthSteps / 2;
pTP->curStepY = pTP->numHeightSteps / 2;
cout << "#############################################################################" << endl
<< "#############################################################################" << endl
<< "Width: max=" << pTP->maxSensorWidth << "=" << pTP->maxAllowedWidth << " cur=" << pTP->curWidth << " minAllowed=" << pTP->minAllowedWidth << " min=" << pTP->minSensorWidth << " step=" << pTP->widthStepWidth << endl
<< "Height: max=" << pTP->maxSensorHeight << "=" << pTP->maxAllowedHeight << " cur=" << pTP->curHeight << " minAllowed=" << pTP->minAllowedHeight << " min=" << pTP->minSensorHeight << " step=" << pTP->heightStepWidth << endl
<< "numWidthSteps=" << pTP->numWidthSteps << endl
<< "numHeightSteps=" << pTP->numHeightSteps << endl
<< "curStepX=" << pTP->curStepX << endl
<< "curStepY=" << pTP->curStepY << endl
<< "#############################################################################" << endl
<< "#############################################################################" << endl;
pTP->minExpStep = 1;
pTP->curStepExposure = 10;
pTP->maxExpStep = static_cast<int>( ( acqc.exposureTime.getMaxValue() / 1000 ) - 2 );
}
catch( const ImpactAcquireException& e )
{
std::cout << "An error occurred while configuring the device " << pDev->serial.read()
<< "(error code: " << e.getErrorCodeAsString() << ")." << endl
<< "Press [ENTER] to end the application..." << endl;
cin.get();
exit( 1 );
}
}
void configureSequencerSet( ThreadParameter* pTP, const SequencerSetParameter& ssp )
{
pTP->sc.sequencerSetSelector.write( ssp.setNr_ );
pTP->ac.exposureTime.write( ssp.exposureTime_us_ );
pTP->sc.sequencerPathSelector.write( 0LL );
pTP->sc.sequencerTriggerSource.writeS( "ExposureEnd" );
pTP->sc.sequencerSetNext.write( ssp.sequencerSetNext_ );
pTP->sc.sequencerPathSelector.write( 1LL );
pTP->sc.sequencerTriggerSource.writeS( "UserOutput0" );
pTP->sc.sequencerSetNext.write( ssp.alternativeSetNext_ );
checkedMethodCall( pTP->pDev, pTP->sc.sequencerSetSave );
}
void configureSequencer( ThreadParameter* pTP )
{
try
{
pTP->sc.sequencerMode.writeS( "Off" );
pTP->sc.sequencerConfigurationMode.writeS( "On" );
pTP->sc.sequencerFeatureSelector.writeS( "ExposureTime" );
pTP->sc.sequencerFeatureEnable.write(
bTrue );
pTP->sc.sequencerFeatureSelector.writeS( "mvImagePositionAndSize" );
pTP->sc.sequencerFeatureEnable.write(
bTrue );
for_each( s_SequencerData.begin(), s_SequencerData.end(), [pTP]( const SequencerSetParameter & sequencerSetParameter )
{
configureSequencerSet( pTP, sequencerSetParameter );
} );
for_each( s_SequencerLoopData.begin(), s_SequencerLoopData.end(), [pTP]( const SequencerSetParameter & sequencerSetParameter )
{
configureSequencerSet( pTP, sequencerSetParameter );
} );
pTP->sc.sequencerSetStart.write( 0 );
pTP->sc.sequencerConfigurationMode.writeS( "Off" );
pTP->sc.sequencerMode.writeS( "On" );
}
catch( const ImpactAcquireException& e )
{
std::cout << "An error occurred while setting up the sequencer for device " << pTP->pDev->serial.read()
<< "(error code: " << e.getErrorCodeAsString() << ")." << endl;
s_boTerminated = true;
}
}
void configureSequencerAtRuntime( ThreadParameter* pTP )
{
try
{
if( pTP->runLoopAndUserInputMode == false && pTP->loopAndUserInputModeRunning == true )
{
pTP->dic.userOutputSelector.write( 0 );
pTP->dic.userOutputValue.write(
bFalse );
pTP->dic.userOutputValue.write(
bTrue );
pTP->dic.userOutputValue.write(
bFalse );
pTP->loopAndUserInputModeRunning = false;
}
if( pTP->runRandomParameters )
{
static bool s_boApplyOriginalData = true;
if( s_boApplyOriginalData )
{
for( size_t i = 0; i < s_SequencerData.size(); i++ )
{
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspExposureTime, s_SequencerData[i].exposureTime_us_ );
}
}
else
{
for( size_t i = 0; i < s_SequencerData.size(); i++ )
{
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspExposureTime, s_SequencerData[i].exposureTime_us_ * 3 );
}
}
s_boApplyOriginalData = !s_boApplyOriginalData;
int sequencerSetNumber = rand() % s_SequencerData.size();
int64_t offsetX = rand() % ( pTP->maxSensorWidth - pTP->curWidth );
offsetX -= offsetX % pTP->ifc.offsetX.getStepWidth();
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( sequencerSetNumber ),
sspOffsetX, offsetX );
int64_t offsetY = rand() % ( pTP->maxSensorHeight - pTP->curHeight );
offsetY -= offsetY % pTP->ifc.offsetY.getStepWidth();
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( sequencerSetNumber ),
sspOffsetY, offsetY );
}
else
{
if( pTP->applyInitialParameters )
{
if( pTP->runLoopAndUserInputMode == true && pTP->loopAndUserInputModeRunning == false )
{
pTP->dic.userOutputSelector.write( 0 );
pTP->dic.userOutputValue.write(
bFalse );
pTP->dic.userOutputValue.write(
bTrue );
pTP->dic.userOutputValue.write(
bFalse );
pTP->loopAndUserInputModeRunning = true;
}
pTP->curStepX = pTP->numWidthSteps / 2;
pTP->curStepY = pTP->numHeightSteps / 2;
pTP->curStepExposure = static_cast<int>( ( s_SequencerData[0].exposureTime_us_ / 1000 ) );
pTP->curWidth = ( min( ( pTP->maxSensorWidth - pTP->minSensorWidth ) * 2 / 3, 1600 ) / pTP->widthStepWidth ) * pTP->widthStepWidth;
pTP->curHeight = ( min( ( pTP->maxSensorHeight - pTP->minSensorHeight ) * 2 / 3, 1024 ) / pTP->heightStepWidth ) * pTP->heightStepWidth;
}
int64_t offsetX = pTP->curStepX * pTP->widthStepWidth;
int64_t offsetY = pTP->curStepY * pTP->heightStepWidth;
double startExposure = pTP->curStepExposure * 1000.0;
if( pTP->loopAndUserInputModeRunning )
{
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( s_SequencerLoopData[0].setNr_ ),
sspExposureTime, startExposure + 880. );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( s_SequencerLoopData[0].setNr_ ),
sspOffsetX, offsetX );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( s_SequencerLoopData[0].setNr_ ),
sspOffsetY, offsetY );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( s_SequencerLoopData[0].setNr_ ),
sspWidth,
static_cast<int64_type
>( pTP->curWidth ) );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( s_SequencerLoopData[0].setNr_ ),
sspHeight,
static_cast<int64_type
>( pTP->curHeight ) );
}
else
{
for( size_t i = 0; i < s_SequencerData.size(); i++ )
{
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspExposureTime, startExposure + ( i * 1000.0 ) );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspOffsetX, offsetX );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspOffsetY, offsetY );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspWidth,
static_cast<int64_type
>( pTP->curWidth ) );
pTP->ccg.queueSequencerSetValueModification(
static_cast<int64_type
>( i ),
sspHeight,
static_cast<int64_type
>( pTP->curHeight ) );
}
}
}
int sendCommandBufferResult = pTP->ccg.sendCommandBuffer();
{
}
pTP->setWidth = pTP->curWidth;
pTP->setHeight = pTP->curHeight;
pTP->setStepX = pTP->curStepX;
pTP->setStepY = pTP->curStepY;
pTP->setStepExposure = pTP->curStepExposure;
pTP->applyInitialParameters = false;
}
catch( const ImpactAcquireException& e )
{
std::cout << "An error occurred while setting up the sequencer for device " << pTP->pDev->serial.read()
<< "(error code: " << e.getErrorCodeAsString() << ")." << endl;
s_boTerminated = true;
}
}
bool isDeviceSupportedBySample( const Device* const pDev )
{
if( !pDev->interfaceLayout.isValid() &&
!pDev->acquisitionStartStopBehaviour.isValid() )
{
return false;
}
vector<TDeviceInterfaceLayout> availableInterfaceLayouts;
pDev->interfaceLayout.getTranslationDictValues( availableInterfaceLayouts );
return find( availableInterfaceLayouts.begin(), availableInterfaceLayouts.end(),
dilGenICam ) != availableInterfaceLayouts.end();
}
void liveThread( ThreadParameter* pTP )
{
pTP->ac.acquisitionFrameRateEnable.write(
bTrue );
pTP->ac.acquisitionFrameRate.write( 10.0 );
Statistics statistics( pTP->pDev );
FunctionInterface fi( pTP->pDev );
configureSequencer( pTP );
configureSequencerAtRuntime( pTP );
{
};
{
cout << "'FunctionInterface.imageRequestSingle' returned with an unexpected result: " << result
}
manuallyStartAcquisitionIfNeeded( pTP->pDev, fi );
const unsigned int timeout_ms = { 500 };
unsigned int cnt = { 0 };
while( !s_boTerminated )
{
int requestNr = fi.imageRequestWaitFor( timeout_ms );
pRequest = fi.isRequestNrValid( requestNr ) ? fi.getRequest( requestNr ) : nullptr;
if( pRequest != nullptr )
{
{
++cnt;
if( cnt % 100 == 0 )
{
cout << "Info from " << pTP->pDev->serial.read()
<< ": " << statistics.framesPerSecond.name() << ": " << statistics.framesPerSecond.readS()
<< ", " << statistics.errorCount.name() << ": " << statistics.errorCount.readS()
<< ", " << statistics.captureTime_s.name() << ": " << statistics.captureTime_s.readS() << endl;
configureSequencerAtRuntime( pTP );
}
if( pTP->setStepX != pTP->curStepX || pTP->setStepY != pTP->curStepY || pTP->setStepExposure != pTP->curStepExposure || pTP->applyInitialParameters || pTP->setWidth != pTP->curWidth || pTP->setHeight != pTP->curHeight )
{
configureSequencerAtRuntime( pTP );
}
#ifdef USE_DISPLAY
pTP->displayWindow.GetImageDisplay().SetImage( pRequest );
pTP->displayWindow.GetImageDisplay().Update();
#endif
}
if( pPreviousRequest )
{
}
pPreviousRequest = pRequest;
fi.imageRequestSingle();
}
}
manuallyStopAcquisitionIfNeeded( pTP->pDev, fi );
#ifdef USE_DISPLAY
pTP->displayWindow.GetImageDisplay().RemoveImage();
#endif
if( pRequest != nullptr )
{
}
fi.imageRequestReset( 0, 0 );
}
int main( void )
{
DeviceManager devMgr;
Device* pDev = getDeviceFromUserInput( devMgr, isDeviceSupportedBySample );
if( pDev == nullptr )
{
cout << "Could not obtain a valid pointer to a device. Unable to continue!";
cout << "Press [ENTER] to end the application" << endl;
cin.get();
return 1;
}
try
{
cout << "Initialising the device. This might take some time..." << endl << endl;
pDev->open();
}
catch( const ImpactAcquireException& e )
{
cout << "An error occurred while opening device " << pDev->serial.read()
<< "(error code: " << e.getErrorCodeAsString() << ")." << endl
<< "Press [ENTER] to end the application..." << endl;
cin.get();
return 1;
}
try
{
ThreadParameter threadParam( pDev );
configureDevice( pDev, &threadParam );
printHelp();
thread myThread( liveThread, &threadParam );
int c = 0;
while( c != KEY_ENTER_CR && c != KEY_ENTER_LF )
{
c = _getch();
switch( c )
{
case KEY_MINUS:
if( threadParam.curWidth > threadParam.minAllowedWidth && threadParam.curHeight > threadParam.minAllowedHeight )
{
threadParam.curWidth -= threadParam.widthStepWidth;
threadParam.curHeight -= threadParam.heightStepWidth;
}
else
{
cout << "Minimal image size for this test reached!" << endl;
}
break;
case KEY_PLUS:
if( threadParam.curWidth < threadParam.maxAllowedWidth && threadParam.curHeight < threadParam.maxAllowedHeight )
{
threadParam.curWidth += threadParam.widthStepWidth;
threadParam.curHeight += threadParam.heightStepWidth;
}
else
{
cout << "Maximal image size for this test reached!" << endl;
}
break;
case KEY_PAGEDOWN:
if( threadParam.curStepExposure > threadParam.minExpStep + 10 - 1 )
{
threadParam.curStepExposure -= 10;
}
else if( threadParam.curStepExposure > threadParam.minExpStep )
{
threadParam.curStepExposure = threadParam.minExpStep;
}
else
{
cout << "Darkness reached!" << endl;
}
break;
case KEY_PAGEUP:
if( threadParam.curStepExposure < threadParam.maxExpStep - 10 + 1 )
{
threadParam.curStepExposure += 10;
}
else if( threadParam.curStepExposure < threadParam.maxExpStep )
{
threadParam.curStepExposure = threadParam.maxExpStep;
}
else
{
cout << "Light reached!" << endl;
}
break;
case KEY_UP:
if( threadParam.curStepY > 1 )
{
threadParam.curStepY--;
}
else
{
cout << "Top reached!" << endl;
}
break;
case KEY_DOWN:
if( threadParam.curStepY < threadParam.numHeightSteps - 1 )
{
threadParam.curStepY++;
}
else
{
cout << "Bottom reached!" << endl;
}
break;
case KEY_LEFT:
if( threadParam.curStepX > 1 )
{
threadParam.curStepX--;
}
else
{
cout << "Left - End reached!" << endl;
}
break;
case KEY_RIGHT:
if( threadParam.curStepX < threadParam.numWidthSteps - 1 )
{
threadParam.curStepX++;
}
else
{
cout << "Right - End reached!" << endl;
}
break;
case KEY_SPACE:
cout << "Resetting..." << endl;
threadParam.runRandomParameters = false;
threadParam.runLoopAndUserInputMode = false;
threadParam.applyInitialParameters = true;
break;
case KEY_L:
cout << "Looping..." << endl;
threadParam.runRandomParameters = false;
threadParam.runLoopAndUserInputMode = true;
threadParam.applyInitialParameters = true;
break;
case KEY_R:
cout << "Random..." << endl;
threadParam.runRandomParameters = true;
threadParam.runLoopAndUserInputMode = false;
threadParam.applyInitialParameters = true;
break;
case KEY_ENTER_CR:
case KEY_ENTER_LF:
cout << "Ending..." << endl;
break;
case KEY_USELESS_ADDITIONAL_KEY_1:
case KEY_USELESS_ADDITIONAL_KEY_2:
case KEY_USELESS_ADDITIONAL_KEY_3:
break;
default:
cout << "\n\n\n" << endl;
printHelp();
cout << endl << "unknown: -" << c << "-" << endl << endl << endl;
break;
}
}
s_boTerminated = true;
myThread.join();
}
catch( const ImpactAcquireException& e )
{
cout << "An error occurred while setting up device " << pDev->serial.read()
<< "(error code: " << e.getErrorCodeAsString() << ")." << endl
<< "Press [ENTER] to end the application..." << endl;
cin.get();
return 1;
}
return 0;
}
ZYX read(int index=0) const
Reads a value from a property.
Definition: mvIMPACT_acquire.h:3710
ZYX read(int index=0) const
Reads a value from a property.
Definition: mvIMPACT_acquire.h:4761
ZYX read(int index=0) const
Reads a value from a property.
Definition: mvIMPACT_acquire.h:4157
std::string getErrorCodeAsString(void) const
Returns a string representation of the error associated with the exception.
Definition: mvIMPACT_acquire.h:280
Contains information about a captured buffer.
Definition: mvIMPACT_acquire.h:8393
PropertyI64 infoFrameID
A 64 bit integer property (read-only) containing a frame identifier.
Definition: mvIMPACT_acquire.h:9523
PropertyI imageHeight
An integer property (read-only) containing the height of the image in pixels.
Definition: mvIMPACT_acquire.h:10001
bool isOK(void) const
Convenience function to check if a request has been processed successfully.
Definition: mvIMPACT_acquire.h:9182
PropertyI imageWidth
An integer property (read-only) containing the width of the image in pixels.
Definition: mvIMPACT_acquire.h:9990
PropertyF chunkExposureTime
A floating point property (read-only) containing the exposure time used to capture the image as retur...
Definition: mvIMPACT_acquire.h:9758
int unlock(void)
Unlocks the request for the driver again.
Definition: mvIMPACT_acquire.h:9322
PropertyI64 chunkSequencerSetActive
A 64-bit integer property (read-only) containing the index of the active set of the running sequencer...
Definition: mvIMPACT_acquire.h:9778
PropertyI imageOffsetX
An integer property (read-only) containing the X-offset of the image in pixels.
Definition: mvIMPACT_acquire.h:9982
PropertyI imageOffsetY
An integer property (read-only) containing the Y-offset of the image in pixels.
Definition: mvIMPACT_acquire.h:9988
TDMR_ERROR
Errors reported by the device manager.
Definition: mvDriverBaseEnums.h:2265
@ DEV_NO_FREE_REQUEST_AVAILABLE
The user requested a new image, but no free mvIMPACT::acquire::Request object is available to process...
Definition: mvDriverBaseEnums.h:2425
@ DMR_NO_ERROR
The function call was executed successfully.
Definition: mvDriverBaseEnums.h:2270
@ bFalse
Off, false or logical low.
Definition: mvDriverBaseEnums.h:556
@ bTrue
On, true or logical high.
Definition: mvDriverBaseEnums.h:558
@ cpmRaw
No color processing will be performed.
Definition: mvDriverBaseEnums.h:1527
@ sspOffsetX
Requests the OffsetX property to be modified in a user selected sequencer set.
Definition: mvCustomCommandDataTypes.h:136
@ sspOffsetY
Requests the OffsetY property to be modified in a user selected sequencer set.
Definition: mvCustomCommandDataTypes.h:141
@ sspHeight
Requests the Height property to be modified in a user selected sequencer set.
Definition: mvCustomCommandDataTypes.h:151
@ sspWidth
Requests the Width property to be modified in a user selected sequencer set.
Definition: mvCustomCommandDataTypes.h:146
This namespace contains classes and functions that can be used to display images.
This namespace contains classes and functions belonging to the image acquisition module of this SDK.
Definition: mvImageBuffer.h:42