Resonon API
3.12 [Deprecated]
C++ API for controlling Resonon hyperspectral imagers
|
Interface to Pika L and Pika XC2 hyperspectral imagers with USB3 connectivity. More...
#include "resonon_imager_basler.h"
Public Member Functions | |
PikaBasler () | |
Constructor for Pika L and XC2 hyperspectral imagers based on Basler cameras. More... | |
virtual | ~PikaBasler () |
void | connect (const char *camera_serial_number=NULL) |
Connect to camera. More... | |
void | disconnect () |
Disconnect from the camera. More... | |
void | start () |
Begin grabbing frames from the imager. More... | |
void | stop () |
Stop grabbing frames from the imager. More... | |
void | get_imager_type (char *buffer, int buffer_size) |
Get a string identifying the type of imager being controlled by this class, such as Pika L or Pika XC2. More... | |
void | get_serial_number (char *buffer, int buffer_size) |
Get a string identifying the serial number of the connected imager. More... | |
void | get_camera_serial_number (char *buffer, int buffer_size) |
Get a string identifying the serial number of the camera embedded in the imager. More... | |
void | generate_configuration_report (char *buffer, int buffer_size) |
Generates a report on the imager's internal settings. More... | |
float | get_coeff_a () |
Gets the first imager spectral calibration coefficient stored in camera memory. More... | |
float | get_coeff_b () |
Gets the second imager spectral calibration coefficient stored in camera memory. More... | |
float | get_coeff_c () |
Gets the third imager spectral calibration coefficient stored in camera memory. More... | |
double | get_wavelength_at_band (const int band) |
Get the wavelength of the imager at the requested band number. More... | |
int | get_frame_buffer_size_in_bytes () |
Get the size of the buffer required to get a single frame from the imager, in bytes, according to current binning settings. More... | |
unsigned short * | get_frame (unsigned short *buffer) |
Get a single frame from the imager and copy it to the provided buffer. More... | |
std::uint64_t | get_last_timestamp () |
Get the timestamp of the last image returned by PikaBasler::get_frame() in camera ticks (nanoseconds). More... | |
std::uint64_t | ticks_per_second () |
Get the number of camera ticks per second, for converting values returned by PikaBasler::get_last_timestamp() to seconds. More... | |
void | set_spectral_bin (int new_spectral_bin) |
Set the binning in the spectral dimension. More... | |
int | get_spectral_bin () |
Get the current spectral binning setting. More... | |
int | get_min_spectral_bin () |
Get the minimum spectral binning setting. More... | |
int | get_max_spectral_bin () |
Get the maximum spectral binning setting. More... | |
int | get_band_count () |
Get the number of bands (spectral dimension) provided by the current binning settings. More... | |
int | get_start_band () |
Get the start of the user-defined spectral window. More... | |
void | set_start_band (int band) |
Set the first band in the user-defined spectral window. More... | |
int | get_min_start_band () |
Get the minimum band number allowed for the start of the spectral window at current settings. More... | |
int | get_max_start_band () |
Get the maximum band number allowed for the start of the spectral window at current settings. More... | |
int | get_inc_start_band () |
Get the increment for valid value of the start of the spectral window at current settings. More... | |
int | get_end_band () |
Get the end of the user-defined spectral window. More... | |
void | set_end_band (int band) |
Set the end of the user-defined spectral window. More... | |
int | get_min_end_band () |
Get the minimum band number allowed for the end of the user-defined spectral window at current settings. More... | |
int | get_max_end_band () |
Get the maximum band number allowed for the end of the user-defined spectral window at current settings. More... | |
int | get_inc_end_band () |
Get the increment for valid value of the end of the user-defined spectral window at current settings. More... | |
int | get_sample_count () |
Get the number of samples (spatial dimension) provided by the imager. More... | |
int | get_start_sample () |
Get the start of the user-defined spatial window. More... | |
void | set_start_sample (int sample) |
Set the first sample in the user-defined spatial window. More... | |
int | get_min_start_sample () |
Get the minimum sample number allowed for the start of the spatial window at current settings. More... | |
int | get_max_start_sample () |
Get the maximum sample number allowed for the start of the spatial window at current settings. More... | |
int | get_inc_start_sample () |
Get the increment for valid value of the start of the spatial window at current settings. More... | |
int | get_end_sample () |
Get the end of the user-defined spatial window. More... | |
void | set_end_sample (int sample) |
Set the end of the user-defined spatial window. More... | |
int | get_min_end_sample () |
Get the minimum sample number allowed for the end of the user-defined spatial window at current settings. More... | |
int | get_max_end_sample () |
Get the maximum sample number allowed for the end of the user-defined spatial window at current settings. More... | |
int | get_inc_end_sample () |
Get the increment for valid value of the end of the user-defined spatial window at current settings. More... | |
void | set_framerate (const double frames_per_second) |
Get the current requested framerate in frames per second. More... | |
double | get_framerate () |
Get the current requested framerate in frames per second. More... | |
double | get_min_framerate () |
Get the minimum value that the framerate can be set to. More... | |
double | get_max_framerate () |
Get the maximum expected framerate achievable with the current integration time and binning settings. More... | |
double | get_min_integration_time () |
Get the minimum integration time supported by the camera. More... | |
double | get_max_integration_time () |
Get the maximum integration time supported by the camera. More... | |
void | set_integration_time (const double milliseconds) |
Set the integration time in milliseconds. More... | |
double | get_integration_time () |
Get the current integration time in milliseconds. More... | |
void | set_gain (const double gain) |
Set the current gain setting in dB. More... | |
double | get_gain () |
Get the current gain setting in dB. More... | |
double | get_min_gain () |
Get the minimum valid gain setting in dB. More... | |
double | get_max_gain () |
Get the maximum valid gain setting in dB. More... | |
void | set_internal_trigger () |
Set the camera to internally triggered mode. More... | |
void | set_external_trigger (unsigned int signal_line, bool rising_edge=true) |
Set the camera to externally triggered mode. More... | |
bool | is_trigger_external () |
Return true if the camera is in external trigger mode, false if the camera is in internal trigger mode. More... | |
Public Member Functions inherited from Resonon::ResononImagerBase | |
ResononImagerBase () | |
virtual | ~ResononImagerBase () |
int | get_nearest_band_to_wavelength (const double wavelength) |
Return the band number that is closest to the requested wavelength from the current windowing settings. More... | |
Interface to Pika L and Pika XC2 hyperspectral imagers with USB3 connectivity.
PikaBasler::PikaBasler | ( | ) |
Constructor for Pika L and XC2 hyperspectral imagers based on Basler cameras.
PikaBasler::connect() must be called prior to setting or querying camera settings or acquiring camera data.
|
virtual |
|
virtual |
Connect to camera.
PikaBasler::connect() will attempt to connect to the first camera found on the system. Calibration and windowing parameters are read from factory settings stored on-camera and applied.
[in] | camera_serial_number | The serial number of the camera to connect (this is not the imager serial number). If NULL connect to the first camera found. |
std::runtime_error | if camera cannot be initialized. Use std::runtime_error.what() for more details. |
Implements Resonon::ResononImagerBase.
|
virtual |
Disconnect from the camera.
Does nothing if no camera is connected.
Implements Resonon::ResononImagerBase.
|
virtual |
Generates a report on the imager's internal settings.
[in,out] | buffer | A character buffer to receive the report. Recommended size is 1,000 bytes. |
[in] | buffer_size | The size of the passed character buffer, to prevent overruns. |
std::runtime_error | if no imager is connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the number of bands (spectral dimension) provided by the current binning settings.
std::runtime_error | if camera error occurs |
Implements Resonon::ResononImagerBase.
|
virtual |
Get a string identifying the serial number of the camera embedded in the imager.
[in,out] | buffer | A character buffer to receive the serial number cstring. |
[in] | buffer_size | The size of the passed character buffer, to prevent overruns. |
std::runtime_error | if no imager is connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Gets the first imager spectral calibration coefficient stored in camera memory.
std::runtime_error | if the imager is not connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Gets the second imager spectral calibration coefficient stored in camera memory.
std::runtime_error | if the imager is not connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Gets the third imager spectral calibration coefficient stored in camera memory.
std::runtime_error | if the imager is not connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the end of the user-defined spectral window.
This is the first band AFTER the spectral window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the end of the user-defined spatial window.
This is the first sample AFTER the spatial window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get a single frame from the imager and copy it to the provided buffer.
Space for the data must be previously allocated. Use PikaBasler::get_frame_buffer_size_in_bytes() to get the required size of the buffer. Data type is unsigned short. This call retrieves the most recent frame received from the camera. If no frame has been received this call blocks until a frame becomes available. PikaBasler::start() must be called before retrieving frames.
[in,out] | buffer | A pointer to the buffer to which frame data should be copied. |
std::runtime_error | If camera has been improperly configured, frame capture has not been started, or a camera error occurs. Use std::runtime_error.what() to get details. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the size of the buffer required to get a single frame from the imager, in bytes, according to current binning settings.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the current requested framerate in frames per second.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the current gain setting in dB.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get a string identifying the type of imager being controlled by this class, such as Pika L or Pika XC2.
[in,out] | buffer | A character buffer to receive the imager type cstring. |
[in] | buffer_size | The size of the passed character buffer, to prevent overruns. |
std::runtime_error | if no imager is connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the increment for valid value of the end of the user-defined spectral window at current settings.
This is the first band AFTER the spectral window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the increment for valid value of the end of the user-defined spatial window at current settings.
This is the first sample AFTER the spatial window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the increment for valid value of the start of the spectral window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the increment for valid value of the start of the spatial window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the current integration time in milliseconds.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the timestamp of the last image returned by PikaBasler::get_frame() in camera ticks (nanoseconds).
Implements Resonon::ResononImagerBase.
|
virtual |
Get the maximum band number allowed for the end of the user-defined spectral window at current settings.
This is the first band AFTER the spectral window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the maximum sample number allowed for the end of the user-defined spatial window at current settings.
This is the first sample AFTER the spatial window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the maximum expected framerate achievable with the current integration time and binning settings.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the maximum valid gain setting in dB.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the maximum integration time supported by the camera.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the maximum spectral binning setting.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the maximum band number allowed for the start of the spectral window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the maximum sample number allowed for the start of the spatial window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum band number allowed for the end of the user-defined spectral window at current settings.
This is the first band AFTER the spectral window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum sample number allowed for the end of the user-defined spatial window at current settings.
This is the first sample AFTER the spatial window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum value that the framerate can be set to.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the minimum valid gain setting in dB.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum integration time supported by the camera.
See Framerate and Integration Time.
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the minimum spectral binning setting.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum band number allowed for the start of the spectral window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the minimum sample number allowed for the start of the spatial window at current settings.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the number of samples (spatial dimension) provided by the imager.
std::runtime_error | if camera error occurs |
Implements Resonon::ResononImagerBase.
|
virtual |
Get a string identifying the serial number of the connected imager.
[in,out] | buffer | A character buffer to receive the serial number cstring. |
[in] | buffer_size | The size of the passed character buffer, to prevent overruns. |
std::runtime_error | if no imager is connected. |
Implements Resonon::ResononImagerBase.
|
virtual |
Get the current spectral binning setting.
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the start of the user-defined spectral window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the start of the user-defined spatial window.
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the wavelength of the imager at the requested band number.
Band numbers always start at 0 and end at the total number of bands available on the camera at the current spectral bin setting. To get the wavelengths of the bands available at the current binning setting, loop from 0 to PikaBasler::get_band_count() - 1.
[in] | band | The band number for which to calculate wavelength. |
std::runtime_error | if a camera error occurs. |
std::domain_error | if band is invalid (band < 0 or band >= number of bands) |
Implements Resonon::ResononImagerBase.
|
virtual |
Return true if the camera is in external trigger mode, false if the camera is in internal trigger mode.
std::runtime_error | if camera error occurs |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the end of the user-defined spectral window.
This is the first band AFTER the spectral window.
std::domain_error | if band is invalid for current binning settings |
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the end of the user-defined spatial window.
This is the first sample AFTER the spatial window.
std::domain_error | if sample is invalid for current binning settings |
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the camera to externally triggered mode.
signal_line | The signal trigger source. Valid values are 1 for line 1 and 2 for line 2. |
rising_edge | Set to true to trigger on the rising edge or false to trigger on the falling edge. |
std::runtime_error | if camera error occurs or an invalid signal_line is specified. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Get the current requested framerate in frames per second.
For PikaBasler cameras, the exposure time is honored over the framerate. That is, if the exposure time is longer than 1/framerate, the achieved framerate will be less than the requested framerate. See Framerate and Integration Time for additional considerations.
[in] | frames_per_second | The requested framerate in fps. |
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Set the current gain setting in dB.
[in] | gain | Requested gain. |
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the integration time in milliseconds.
For PikaBasler cameras, the integration time is honored over the framerate. That is, if the integration time is longer than 1/framerate, the achieved framerate will be less than the requested framerate. See Framerate and Integration Time for additional considerations.
[in] | milliseconds | Requested integration time in milliseconds. |
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Set the camera to internally triggered mode.
std::runtime_error | if camera error occurs |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the binning in the spectral dimension.
[in] | new_spectral_bin | Desired binning in the spatial dimension. Valid values are commonly integers between 2 and 4, but may vary with imager model. |
std::domain_error | if invalid binning settings are requested. |
std::runtime_error | if a camera error occurs. |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the first band in the user-defined spectral window.
std::domain_error | if band is invalid for current binning settings |
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Set the first sample in the user-defined spatial window.
std::domain_error | if sample is invalid for current binning settings |
std::runtime_error | on error |
Reimplemented from Resonon::ResononImagerBase.
|
virtual |
Begin grabbing frames from the imager.
This method must be called before calling PikaBasler::get_frame().
std::runtime_error | if a camera error occurs. |
Implements Resonon::ResononImagerBase.
|
virtual |
Stop grabbing frames from the imager.
This is safe to call even if the imager is not connected.
Implements Resonon::ResononImagerBase.
|
virtual |
Get the number of camera ticks per second, for converting values returned by PikaBasler::get_last_timestamp() to seconds.
Implements Resonon::ResononImagerBase.