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>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam_CustomCommands.h>
#ifdef _WIN32
# include <conio.h>
# include <mvDisplay/Include/mvIMPACT_acquire_display.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
{
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
#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;
}
{
if( result != DMR_NO_ERROR )
{
std::cout <<
"An error was returned while calling function '" << method.
displayName() <<
"' on device " << pDev->
serial.
read()
<<
"(" << pDev->
product.
read() <<
"): " << ImpactAcquireException::getErrorCodeAsString( result ) << endl;
}
}
void configureDevice(
Device* pDev, ThreadParameter* pTP )
{
try
{
conditionalSetEnumPropertyByString( usc.userSetSelector, "Default" );
if( result != DMR_NO_ERROR )
{
std::cout <<
"An error occurred while restoring the factory default for device " << pDev->
serial.
read()
<< "(error code: " << ImpactAcquireException::getErrorCodeAsString( result ) << ")." << endl;
}
conditionalSetEnumPropertyByString( acqc.exposureMode, "Timed" );
conditionalSetEnumPropertyByString( acqc.exposureAuto, "Off" );
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" );
}
cdc.chunkModeActive.write( bTrue );
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 );
}
{
std::cout <<
"An error occurred while configuring the device " << pDev->
serial.
read()
<< "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" );
}
{
std::cout << "An error occurred while setting up the sequencer for device " << pTP->pDev->serial.read()
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();
if( sendCommandBufferResult != DMR_NO_ERROR )
{
cout << "sendCommandBuffer failed(error code: " << sendCommandBufferResult << "(" << ImpactAcquireException::getErrorCodeAsString( sendCommandBufferResult ) << "))!" << endl;
}
pTP->setWidth = pTP->curWidth;
pTP->setHeight = pTP->curHeight;
pTP->setStepX = pTP->curStepX;
pTP->setStepY = pTP->curStepY;
pTP->setStepExposure = pTP->curStepExposure;
pTP->applyInitialParameters = false;
}
{
std::cout << "An error occurred while setting up the sequencer for device " << pTP->pDev->serial.read()
s_boTerminated = true;
}
}
bool isDeviceSupportedBySample(
const Device*
const pDev )
{
{
return false;
}
vector<TDeviceInterfaceLayout> 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 );
configureSequencer( pTP );
configureSequencerAtRuntime( pTP );
while( ( result =
static_cast<TDMR_ERROR>( fi.imageRequestSingle() ) ) == DMR_NO_ERROR )
{
};
if( result != DEV_NO_FREE_REQUEST_AVAILABLE )
{
cout << "'FunctionInterface.imageRequestSingle' returned with an unexpected result: " << result
<< "(" << ImpactAcquireException::getErrorCodeAsString( result ) << ")" << endl;
}
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 )
{
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;
}
{
cout <<
"An error occurred while opening device " << pDev->
serial.
read()
<< "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();
}
{
cout <<
"An error occurred while setting up device " << pDev->
serial.
read()
<< "Press [ENTER] to end the application..." << endl;
cin.get();
return 1;
}
return 0;
}
std::string displayName(void) const
Returns the display name of the component referenced by this object.
Definition mvIMPACT_acquire.h:1217
bool isValid(void) const
Checks if the internal component referenced by this object is still valid.
Definition mvIMPACT_acquire.h:1721
Grants access to devices that can be operated by this software interface.
Definition mvIMPACT_acquire.h:7171
This class and its functions represent an actual device detected by this interface in the current sys...
Definition mvIMPACT_acquire.h:6118
PropertyS product
A string property (read-only) containing the product name of this device.
Definition mvIMPACT_acquire.h:6537
PropertyS serial
A string property (read-only) containing the serial number of this device.
Definition mvIMPACT_acquire.h:6551
void open(void)
Opens a device.
Definition mvIMPACT_acquire.h:6420
PropertyIDeviceInterfaceLayout interfaceLayout
An enumerated integer property which can be used to define which interface layout shall be used when ...
Definition mvIMPACT_acquire.h:6644
PropertyIAcquisitionStartStopBehaviour acquisitionStartStopBehaviour
An enumerated integer property defining the start/stop behaviour during acquisition of this driver in...
Definition mvIMPACT_acquire.h:6800
ZYX read(int index=0) const
Reads a value from a property.
Definition mvIMPACT_acquire.h:3853
ZYX read(int index=0) const
Reads a value from a property.
Definition mvIMPACT_acquire.h:4907
ZYX read(int index=0) const
Reads a value from a property.
Definition mvIMPACT_acquire.h:4300
const EnumPropertyI & getTranslationDictValues(std::vector< ZYX > &sequence) const
This function queries a list of valid values for this property.
Definition mvIMPACT_acquire.h:4266
const EnumPropertyI & write(ZYX value, int index=0) const
Writes one value to the property.
Definition mvIMPACT_acquire.h:4426
The function interface to devices supported by this interface.
Definition mvIMPACT_acquire.h:10758
Category for the acquisition and trigger control features.
Definition mvIMPACT_acquire_GenICam.h:2115
Category that contains the Analog control features.
Definition mvIMPACT_acquire_GenICam.h:3086
Category that contains the Chunk Data control features.
Definition mvIMPACT_acquire_GenICam.h:11823
Contains convenience functions to control features understood by a devices custom command interpreter...
Definition mvIMPACT_acquire_GenICam_CustomCommands.h:439
Category that contains the digital input and output control features.
Definition mvIMPACT_acquire_GenICam.h:3917
Category for the Sequencer Control features.
Definition mvIMPACT_acquire_GenICam.h:9805
Category that contains the User Set control features.
Definition mvIMPACT_acquire_GenICam.h:9632
Base class for image processing related properties.
Definition mvIMPACT_acquire.h:13205
A base class for exceptions generated by Impact Acquire.
Definition mvIMPACT_acquire.h:256
std::string getErrorCodeAsString(void) const
Returns a string representation of the error associated with the exception.
Definition mvIMPACT_acquire.h:288
A class to call arbitrary driver functions.
Definition mvIMPACT_acquire.h:2779
int call(const std::vector< std::string > ¶ms) const
Calls an underlying driver function.
Definition mvIMPACT_acquire.h:2859
std::string read(int index=0) const
Reads a value from a property.
Definition mvIMPACT_acquire.h:5323
Contains information about a captured buffer.
Definition mvIMPACT_acquire.h:8640
PropertyI64 infoFrameID
A 64 bit integer property (read-only) containing a frame identifier.
Definition mvIMPACT_acquire.h:9849
PropertyI imageHeight
An integer property (read-only) containing the height of the image in pixels.
Definition mvIMPACT_acquire.h:10331
bool isOK(void) const
Convenience function to check if a request has been processed successfully.
Definition mvIMPACT_acquire.h:9474
PropertyI imageWidth
An integer property (read-only) containing the width of the image in pixels.
Definition mvIMPACT_acquire.h:10320
PropertyF chunkExposureTime
A floating point property (read-only) containing the exposure time used to capture the image as retur...
Definition mvIMPACT_acquire.h:10084
int unlock(void)
Unlocks the request for the driver again.
Definition mvIMPACT_acquire.h:9614
PropertyI64 chunkSequencerSetActive
A 64-bit integer property (read-only) containing the index of the active set of the running sequencer...
Definition mvIMPACT_acquire.h:10104
PropertyI imageOffsetX
An integer property (read-only) containing the X-offset of the image in pixels.
Definition mvIMPACT_acquire.h:10312
PropertyI imageOffsetY
An integer property (read-only) containing the Y-offset of the image in pixels.
Definition mvIMPACT_acquire.h:10318
Contains basic statistical information.
Definition mvIMPACT_acquire.h:14509
A class that can be used to display images in a window.
Definition mvIMPACT_acquire_display.h:606
TDMR_ERROR
Errors reported by the device manager.
Definition mvDriverBaseEnums.h:2601
@ DMR_NO_ERROR
The function call was executed successfully.
Definition mvDriverBaseEnums.h:2603
@ sspOffsetX
Requests the OffsetX property to be modified in a user selected sequencer set.
Definition mvCustomCommandDataTypes.h:138
@ sspOffsetY
Requests the OffsetY property to be modified in a user selected sequencer set.
Definition mvCustomCommandDataTypes.h:143
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 mvCommonDataTypes.h:34