Please enable JavaScript to view this site.

IDS peak 2.8.0 / uEye+ firmware 3.33

The camera parameters are accessible in the NodeMap of the RemoteDevice.

Exceptions

Generally, you should enclose all calls to the IDS peak API with a try/catch block (see Error handling with try/catch). In case of an error, IDS peak API throws various exceptions. If such an exception is not handled, it will cause the program to terminate. This is illustrated by the following complete example.

hint_info

Note: If an exception occurs, the program execution is interrupted in the try block at the location of the error and the program immediately jumps to the catch block. In this case, all subsequent calls will not be executed.  To avoid this, you must enclose all calls of IDS peak API with try/catch blocks individually.

genericC++

try
{
  // Here are the function calls
}
// This exception type catches all kinds of peak exceptions
catch (const std::exception& e)
{
  // e.what() contains the error message string as a null terminated const char*
}

The exceptions can be treated by their specific type to allow different error handling. The default exception handler should take effect last.

genericC++

try
{
  ...
}
catch (const peak::core::OutOfRangeException& e)
{
  // The value is out of range, e.g. higher than Maximum or lower than Minimum
}
catch (const peak::core::BadAccessException& e)
{
  // The NodeAccess was not suitable for the intended task, e.g. the node was ReadOnly
}
catch (const peak::core::NotAvailableException& e)
{
  // The node is not available, camera configuration could block current availability
}
catch (const peak::core::NotFoundException& e)
{
  // The node could not be found, check misspelling of the node name
}
catch (const peak::core::NotImplemented& e)
{
  // The node is not implemented
}
catch (const std::exception& e)
{
  // all other exceptions
}

Finding a parameter

The camera parameters can be found in the NodeMap using the FindNode() function. To set the value, execute the SetValue() function. A complete list of available camera parameters is provided in the Camera feature reference.

genericC++

nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->SetValue(1000.0);

You can get the currently set value using the Value() function.

genericC++

double exposureTime = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Value();

You can get the range (minimum, maximum and increment) as follows.

genericC++

double min = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Minimum();
double max = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Maximum();
double inc = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Increment();

Some parameters do not have an increment. In this case, calling the Increment() function throws an exception. To avoid this, you can extend the increment query with the following check.

genericC++

if (nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->HasConstantIncrement())
{
  double inc = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Increment();
}

Complete example: Getting the range for the exposure time and the current value and setting a new, valid value

Prerequisite: The IDS peak API and a camera was opened (Device). See also Opening a camera (API)

© 2024 IDS Imaging Development Systems GmbH