IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
Querying the minimum and maximum value of the frame rate
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
peak_access_status accessStatus = peak_ExposureTime_GetAccessStatus(hCam);
if(PEAK_IS_READABLE(accessStatus))
{
// FrameRate is readable
double minFrameRate = 0.0;
double maxFrameRate = 0.0;
double incFrameRate = 0.0;
// Query the minimum, maximum and increment
status = peak_FrameRate_GetRange(hCam, &minFrameRate, &maxFrameRate, &incFrameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
// Query the minimum value
double minFrameRate = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Minimum();
// Query the maximum value
double maxFrameRate = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Maximum();
|
Querying the current value of the frame rate (unit Hz or frames/s)
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
double frameRate = 0.0;
peak_access_status accessStatus = peak_FrameRate_GetAccessStatus(hCam);
if (PEAK_IS_READABLE(accessStatus))
{
// FrameRate is readable, call the getter function
status = peak_FrameRate_Get(hCam, &frameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
double frameRate = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Value();
|
Setting the frame rate
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
double frameRate = 25.0;
peak_access_status accessStatus = peak_FrameRate_GetAccessStatus(hCam);
if (PEAK_IS_WRITEABLE(accessStatus))
{
status = peak_FrameRate_Set(hCam, frameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
double frameRate = 25;
nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->SetValue(frameRate);
|
Complete example: Querying the range for the frame rate, 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)
peak_status status = PEAK_STATUS_SUCCESS;
double frameRate = 0.0;
peak_access_status accessStatus = peak_FrameRate_GetAccessStatus(hCam);
if (PEAK_IS_READABLE(accessStatus))
{
// FrameRate is readable, call the getter function
status = peak_FrameRate_Get(hCam, &frameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
if (PEAK_IS_WRITEABLE(accessStatus))
{
// FrameRate is writeable, call the setter function
// Be sure that the new value is within the valid range
double minFrameRate = 0.0;
double maxFrameRate = 0.0;
double incFrameRate = 0.0;
// Query the minimum, maximum and increment
status = peak_FrameRate_GetRange(hCam, &minFrameRate, &maxFrameRate, &incFrameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
// Set frame rate to maximum
frameRate = maxFrameRate;
status = peak_FrameRate_Set(hCam, frameRate);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
try
{
// Get the NodeMap of the RemoteDevice
auto nodeMapRemoteDevice = device->RemoteDevice()->NodeMaps().at(0);
double minFrameRate = 0;
double maxFrameRate = 0;
double incFrameRate = 0;
// Get frame rate range. All values in fps.
minFrameRate = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Minimum();
maxFrameRate = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Maximum();
if (nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->HasConstantIncrement())
{
incFrameRate = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Increment();
}
else
{
// If there is no increment, it might be useful to choose a suitable increment for a GUI control element (e.g. a slider)
incFrameRate = 0.1;
}
// Get the current frame rate
double frameRate = nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->Value();
// Set frame rate to maximum
nodeMapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("AcquisitionFrameRate")->SetValue(maxFrameRate);
}
catch (const std::exception& e)
{
std::string strError = e.what();
// ...
}
|
try
{
// Get the NodeMap of the RemoteDevice
var nodeMapRemoteDevice = device.RemoteDevice().NodeMaps()[0];
double minFrameRate = 0;
double maxFrameRate = 0;
double incFrameRate = 0;
// Get frame rate range. All values in fps.
minFrameRate = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").Minimum();
maxFrameRate = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").Maximum();
if (nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").HasConstantIncrement())
{
incFrameRate = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").Increment();
}
else
{
// If there is no increment, it might be useful to choose a suitable increment for a GUI control element (e.g. a slider)
incFrameRate = 0.1;
}
// Get the current frame rate
double frameRate = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").Value();
// Set frame rate to maximum
nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("AcquisitionFrameRate").SetValue(maxFrameRate);
}
catch (Exception e)
{
var strError = e.Message;
// ...
}
|
try:
# Get the NodeMap of the RemoteDevice
node_map_remote_device = device.RemoteDevice().NodeMaps()[0]
min_frame_rate = 0
max_frame_rate = 0
inc_frame_rate = 0
# Get frame rate range. All values in fps.
min_frame_rate = node_map_remote_device.FindNode("AcquisitionFrameRate").Minimum()
max_frame_rate = node_map_remote_device.FindNode("AcquisitionFrameRate").Maximum()
if node_map_remote_device.FindNode("AcquisitionFrameRate").HasConstantIncrement():
inc_frame_rate = node_map_remote_device.FindNode("AcquisitionFrameRate").Increment()
else:
# If there is no increment, it might be useful to choose a suitable increment for a GUI control element (e.g. a slider)
inc_frame_rate = 0.1
# Get the current frame rate
frame_rate = node_map_remote_device.FindNode("AcquisitionFrameRate").Value()
# Set frame rate to maximum
node_map_remote_device.FindNode("AcquisitionFrameRate").SetValue(max_frame_rate)
except Exception as e:
str_error = str(e)
# ...
|