Querying the minimum value, maximum value and increment of the exposure time
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
peak_access_status accessStatus = peak_ExposureTime_GetAccessStatus(hCam);
if(PEAK_IS_READABLE(accessStatus))
{
// ExposureTime is readable
double doubleMin = 0.0;
double doubleMax = 0.0;
double doubleInc = 0.0;
// Query the minimum, maximum and increment
status = peak_ExposureTime_GetRange(hCam, &doubleMin, &doubleMax, &doubleInc);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
// Query the minimum
double minExposureTime = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Minimum();
// Query the maximum
double maxExposureTime = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Maximum();
// Query the increment
if (nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->HasConstantIncrement())
{
double incExposureTime = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Increment();
}
|
Querying the current value of the exposure time
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
double exposureTime = 0.0;
peak_access_status accessStatus = peak_ExposureTime_GetAccessStatus(hCam);
if(PEAK_IS_READABLE(accessStatus))
{
// ExposureTime is readable, call the getter function
status = peak_ExposureTime_Get(hCam, &exposureTime);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
double exposureTime = nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Value();
|
Setting the exposure time
comfortC
|
peak_status status = PEAK_STATUS_SUCCESS;
double exposureTime = 10000.0;
peak_access_status accessStatus = peak_ExposureTime_GetAccessStatus(hCam);
if(PEAK_IS_WRITEABLE(accessStatus))
{
status = peak_ExposureTime_Set(hCam, exposureTime);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
}
|
genericC++
|
double exposureTime = 10000;
nodemapRemoteDevice->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->SetValue(exposureTime);
|
Example: Querying the range for the exposure time, 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 exposureTime = 0.0;
peak_access_status accessStatus = peak_ExposureTime_GetAccessStatus(hCam);
if(<%NAME-PREFIX-C%_IS_READABLE(accessStatus))
{
// ExposureTime is readable, call the getter function
status = peak_ExposureTime_Get(hCam, &exposureTime);
if (<%NAME-PREFIX-C%_ERROR(status)) { /* Error handling ... */ }
}
if(<%NAME-PREFIX-C%_IS_WRITEABLE(accessStatus))
{
// ExposureTime is writeable, call the setter function
// Be sure that the new value is within the valid range
double minExposureTime = 0.0;
double maxExposureTime = 0.0;
double incExposureTime = 0.0;
// Query the minimum, maximum and increment
status = peak_ExposureTime_GetRange(hCam, &minExposureTime, &maxExposureTime, &incExposureTime);
if (<%NAME-PREFIX-C%_ERROR(status)) { /* Error handling ... */ }
// Set exposure time to minimum
exposureTime = minExposureTime;
status = peak_ExposureTime_Set(hCam, exposureTime);
if (<%NAME-PREFIX-C%_ERROR(status)) { /* Error handling ... */ }
}
|
try
{
// Get remote device nodemap
auto nodeMapRemoteDevice = device->RemoteDevice()->NodeMaps()[0];
double minExposureTime = 0;
double maxExposureTime = 0;
double incExposureTime = 0;
// Get exposure range. All values in microseconds
minExposureTime = nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Minimum();
maxExposureTime = nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Maximum();
if (nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->HasConstantIncrement())
{
incExposureTime = nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->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)
incExposureTime = 1000;
}
// Get the current exposure time
double exposureTime = nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->Value();
// Set exposure time to minimum
nodeMapRemoteDevice ->FindNode<peak::core::nodes::FloatNode>("ExposureTime")->SetValue(minExposureTime);
}
catch (const std::exception& e)
{
std::string strError = e.what();
// ...
}
|
try
{
// Get remote device nodemap
var nodeMapRemoteDevice = device.RemoteDevice().NodeMaps()[0];
double minExposureTime = 0;
double maxExposureTime = 0;
double incExposureTime = 0;
// Get exposure range. All values in microseconds
minExposureTime = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").Minimum();
maxExposureTime = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").Maximum();
if (nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").HasConstantIncrement())
{
incExposureTime = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").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)
incExposureTime = 1000;
}
// Get the current exposure time
double exposureTime = nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").Value();
// Set exposure time to minimum
nodeMapRemoteDevice.FindNode<peak.core.nodes.FloatNode>("ExposureTime").SetValue(minExposureTime);
}
catch (Exception e)
{
var strError = e.Message;
// ...
}
|
try:
# Get remote device nodemap
node_map_remote_device = device.RemoteDevice().NodeMaps().at(0)
min_exposure_time = 0
max_exposure_time = 0
inc_exposure_time = 0
# Get exposure range. All values in microseconds
min_exposure_time = node_map_remote_device.FindNode("ExposureTime").Minimum()
max_exposure_time = node_map_remote_device.FindNode("ExposureTime").Maximum()
if node_map_remote_device.FindNode("ExposureTime").HasConstantIncrement():
inc_exposure_time = node_map_remote_device.FindNode("ExposureTime").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_exposure_time = 1000
# Get the current exposure time
exposure_time = node_map_remote_device.FindNode("ExposureTime").Value()
# Set exposure time to minimum
node_map_remote_device.FindNode("ExposureTime").SetValue(min_exposure_time)
except Exception as e:
str_error = e.what()
# ...
|