IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
You can save camera parameters on the camera or load them from the camera. For this, you use UserSets.
genericSDK
The available UserSets can be read via the entries of the UserSetSelector.
genericC++
|
try
{
for (auto const& userSetSelectorEntry : nodemapRemoteDevice->FindNode<peak::core::nodes::EnumerationNode>("UserSetSelector")->Entries())
{
if ((peak::core::nodes::NodeAccessStatus::NotAvailable == userSetSelectorEntry ->AccessStatus()) ||
(peak::core::nodes::NodeAccessStatus::NotImplemented == userSetSelectorEntry ->AccessStatus()))
{
// This entry is not accessible because it is not implemented and/or not available at the moment
}
else
{
// The entry is accessable
std::string stringEntry = userSetSelectorEntry->SymbolicValue();
}
}
catch (const std::exception&)
{
// ...
}
|
comfortSDK
The possible ParameterSets are predefined (see also UserSetSelector):
PEAK_PARAMETER_SET_DEFAULT
|
Default settings for Areascan
|
read-only
|
PEAK_PARAMETER_SET_LINESCAN
|
Default settings for line scan (not available for all cameras)
|
read-only
|
PEAK_PARAMETER_SET_LONG_EXPOSURE
|
Settings for long exposure (not available for all cameras)
|
read-only
|
PEAK_PARAMETER_SET_USER_1
|
Custom settings 1
|
read-write
|
PEAK_PARAMETER_SET_USER_2
|
Custom settings 2
|
read-write
|
Use the _GetList function to query the available ParameteSets.
comfortC
|
peak_parameter_set * parameterSetList = NULL;
size_t count = 0;
peak_status status = peak_CameraSettings_ParameterSet_GetList(hCam, NULL, &count);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
parameterSetList = (peak_parameter_set*)calloc(count, sizeof(peak_parameter_set));
status = peak_CameraSettings_ParameterSet_GetList(hCam, parameterSetList, &count);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
for (size_t i = 0; i < count; ++i)
{
peak_parameter_set parameterSet = parameterSetList[i];
switch (parameterSet)
{
case PEAK_PARAMETER_SET_DEFAULT:
printf("PEAK_PARAMETER_SET_DEFAULT: ");
break;
case PEAK_PARAMETER_SET_LINESCAN:
printf("PEAK_PARAMETER_SET_LINESCAN: ");
break;
case PEAK_PARAMETER_SET_LONG_EXPOSURE:
printf("PEAK_PARAMETER_SET_LONG_EXPOSURE: ");
break;
case PEAK_PARAMETER_SET_USER_1:
printf("PEAK_PARAMETER_SET_USER_1: ");
break;
case PEAK_PARAMETER_SET_USER_2:
printf("PEAK_PARAMETER_SET_USER_2: ");
break;
default:
printf("Unknown parameter set: ");
break;
}
peak_access_status accessStatus = peak_CameraSettings_ParameterSet_GetAccessStatus(hCam, parameterSet);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
switch (accessStatus)
{
case PEAK_ACCESS_READWRITE:
// The parameter set can be written and applied, e.g.
// PEAK_PARAMETER_SET_USER_1 or PEAK_PARAMETER_SET_USER_2
// if valid parameters have been stored to that set before
printf("READWRITE\n");
break;
case PEAK_ACCESS_READONLY:
// The parameter set can be applied, e.g.
// PEAK_PARAMETER_SET_DEFAULT or other predefined sets
printf("READONLY\n");
break;
case PEAK_ACCESS_WRITEONLY:
// The parameter set can be written but not applied, e.g.
// PEAK_PARAMETER_SET_USER_1 or PEAK_PARAMETER_SET_USER_2
// if no parameters have been stored yet
printf("WRITEONLY\n");
break;
case PEAK_ACCESS_NOT_SUPPORTED:
// The parameter is not supported, e.g. predefined sets
// for long exposure or line scan, if the camera does not
// support these modes
printf("READWRITE\n");
break;
default:
// Something went wrong when acquiring the access status
printf("UNKNOWN\n");
break;
}
}
|
Loading camera settings from camera
The standard UserSet/ParameterSet is named "Default". Additionally, you can use further UserSets/ParameterSets in which you can save or reload your own parameters. Furthermore, there are special UserSets/ParameterSets for some camera models, e.g. for long time exposure.
peak_parameter_set parameterSet = PEAK_PARAMETER_SET_DEFAULT;
peak_access_status accessStatus = peak_CameraSettings_ParameterSet_GetAccessStatus(hCam, parameterSet);
if(PEAK_IS_READABLE(accessStatus))
{
// The parameter set can be applied
peak_status status = peak_CameraSettings_ParameterSet_Apply(hCam, parameterSet);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
else
{
// ...
}
|
// Load the default user set
try
{
// Set selector to "Default"
nodeMapRemoteDevice->FindNode<peak::core::nodes::EnumerationNode>("UserSetSelector")->SetCurrentEntry("Default");
// Load user set
nodeMapRemoteDevice->FindNode<peak::core::nodes::CommandNode>("UserSetLoad")->Execute();
// Wait until the UserSetLoad command has been finished
nodeMapRemoteDevice->FindNode<peak::core::nodes::CommandNode>("UserSetLoad")->WaitUntilDone();
}
catch (const std::exception&)
{
// ...
}
|
// Load the default user set
try
{
// Set selector to "Default"
nodeMapRemoteDevice.FindNode<peak.core.nodes.EnumerationNode>("UserSetSelector").SetCurrentEntry("Default");
// Load user set
nodeMapRemoteDevice.FindNode<peak.core.nodes.CommandNode>("UserSetLoad").Execute();
// Wait until the UserSetLoad command has been finished
nodeMapRemoteDevice.FindNode<peak.core.nodes.CommandNode>("UserSetLoad").WaitUntilDone();
}
catch (Exception e)
{
// ...
}
|
# Load the default user set
try:
# Set selector to "Default"
node_map_remote_device.FindNode("UserSetSelector").SetCurrentEntry("Default")
# Load user set
node_map_remote_device.FindNode("UserSetLoad").Execute()
# Wait until the UserSetLoad command has been finished
node_map_remote_device.FindNode("UserSetLoad").WaitUntilDone()
except Exception as e:
# ...
|
Saving camera settings into the camera
comfortC
|
peak_parameter_set parameterSet = PEAK_PARAMETER_SET_USER_1;
peak_access_status accessStatus = peak_CameraSettings_ParameterSet_GetAccessStatus(hCam, parameterSet);
if(PEAK_IS_WRITEABLE(accessStatus))
{
// The parameters can be stored to the selected parameter set
peak_status status = peak_CameraSettings_ParameterSet_Store(hCam, parameterSet);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
else
{
// ...
}
|
genericC++
|
// Save parameters into user set 0
try
{
// Set selector to "UserSet0"
nodeMapRemoteDevice->FindNode<peak::core::nodes::EnumerationNode>("UserSetSelector")->SetCurrentEntry("UserSet0");
// Save user set
nodeMapRemoteDevice->FindNode<peak::core::nodes::CommandNode>("UserSetSave")->Execute();
// Wait until the UserSetSave command has been finished
nodeMapRemoteDevice->FindNode<peak::core::nodes::CommandNode>("UserSetSave")->WaitUntilDone();
}
catch (const std::exception&)
{
// ...
}
|
Defining camera parameters at startup
The UserSetDefault/Parameter Startup Set defines which parameter set is to be loaded when the camera starts. The saved parameters are automatically restored each time the camera is opened. This UserSet/ParameterSet is also loaded if the camera has lost power for a short time and is restarted by a reconnect. Therefore, it is recommended to adjust the UserSetDefault/Parameter Startup Set to the present application to reduce the startup time.
comfortC
|
peak_parameter_set parameterSet = PEAK_PARAMETER_SET_USER_1;
peak_access_status accessStatus = peak_CameraSettings_ParameterSet_GetAccessStatus(hCam, parameterSet);
if(PEAK_IS_READABLE(accessStatus))
{
// The parameter set can be applied (precondition to use it as startup set)
accessStatus = peak_CameraSettings_ParameterSet_Startup_GetAccessStatus(hCam);
if(PEAK_IS_WRITEABLE(accessStatus))
{
// The startup set can be written
status = peak_CameraSettings_ParameterSet_Startup_Set(hCam, parameterSet);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
else
{
// This should never happen ...
}
}
else
{
// The parameter set cannot be applied, maybe no parameters have been stored, yet
}
|
genericC++
|
try
{
// Set the default user set that shall be loaded and activated when camera resets to "Default"
nodeMapRemoteDevice->FindNode<peak::core::nodes::EnumerationNode>("UserSetDefault")->SetCurrentEntry("Default");
// Of course you can specify another set, e.g. "UserSet0"
nodeMapRemoteDevice->FindNode<peak::core::nodes::EnumerationNode>("UserSetDefault")->SetCurrentEntry("UserSet0");
}
catch (const std::exception&)
{
// ...
}
|