SDK Calibration Algorithms¶
-
class
Metavision
::
BlinkingDotsGridDetectorAlgorithm
¶ Class that detects a grid of blinking dots with specific frequencies, for example the Prophesee calibration shield.
Public Types
Public Functions
-
BlinkingDotsGridDetectorAlgorithm
(int sensor_width, int sensor_height, const BlinkingDotsGridDetectorAlgorithmConfig &config)¶ Constructor.
- Parameters
sensor_width
: Sensor’s width.sensor_height
: Sensor’s height.config
: Configuration parameters, see BlinkingDotsGridDetectorAlgorithmConfig.
-
~BlinkingDotsGridDetectorAlgorithm
()¶ Destructor.
-
template<typename
InputIt
>
voidprocess_events
(InputIt it_begin, InputIt it_end)¶ Detects a grid of blinking dots from input events. Calls the callback function according to the defined processing step.
- Template Parameters
InputIt
: Input event type. Works for events defining the fields: x, y, p (polarity), t (timestamp).
- Parameters
it_begin
: Iterator to first input event.it_end
: Iterator to past the last input event.
-
void
set_output_callback
(const OutputCb &output_cb)¶ Sets a callback to get the detection results. The callback provides:
Timestamp of grid detection.
Image showing the location of the events used to detect the grid.
std::vector with the points in the grid (empty if the grid was not correctly detected).
- Note
The generated image and the vector will be passed to the callback as non constant references. The user is free to copy or swap them.
- Parameters
output_cb
: Function to be set as callback.
-
-
class
Metavision
::
BlinkingFrameGeneratorAlgorithm
¶ Class that generates a frame from blinking events.
It accumulates events and keeps pixels which were activated with both polarities during the accumulating period, if enough of them are found. Outputs a binary frame representing blinking pixels (0 or 255).
Public Types
Public Functions
-
BlinkingFrameGeneratorAlgorithm
(int sensor_width, int sensor_height, const BlinkingFrameGeneratorAlgorithmConfig &config)¶ Constructor.
- Parameters
sensor_width
: Sensor’s widthsensor_height
: Sensor’s heightconfig
: Blinking detector configuration
-
template<typename
InputIt
>
voidprocess_events
(InputIt it_begin, InputIt it_last)¶ Processes a buffer of events.
- Template Parameters
InputIt
: Input event type
- Parameters
it_begin
: Iterator to first input eventit_last
: Iterator to past the last input event
-
void
set_output_callback
(const OutputCb &output_cb)¶ Sets a callback to get the mask.
- Note
The generated image will be passed to the callback as a non constant reference, meaning that the user is free to copy it or swap it. In case of a swap with a non initialized image, it will be automatically initialized
-
-
class
Metavision
::
DftHighFreqScorerAlgorithm
¶ Class that computes and returns the Discrete Fourier Transform (DFT) of an image in addition to a score depending on the proportion of high frequencies.
Public Functions
-
DftHighFreqScorerAlgorithm
(int width, int height, const DftHighFreqScorerAlgorithmConfig &dft_config)¶ Constructor.
- Parameters
width
: Sensor’s width (in pixels)height
: Sensor’s height (in pixels)dft_config
: Discrete Fourier Transform configuration file
-
bool
process_frame
(const timestamp ts, const cv::Mat &input_frame, float &output_score)¶ Computes the DFT and a high frequency score.
- Parameters
ts
: Timestampinput_frame
: Binary frame of accumulated blinking events (Either 0 or 1)output_score
: Ratio of the average DFT magnitude of high frequencies to the one for all frequencies
-
-
struct
Metavision
::
PinholeMonoCalibratorSettings
¶ Settings used to specify the calibration mode and its stopping criterion.
Public Functions
-
PinholeMonoCalibratorSettings
(bool use_fisheye_lens = false, bool enable_tangential_estimation = false)¶ Constructor.
- Parameters
use_fisheye_lens
: Use fisheye lens in case of strong radial distortionsenable_tangential_estimation
: By default, the tangential parameters and the third radial parameter are not estimated
Public Members
-
size_t
delete_n_best_errors_
= 5¶ Number of frames with the highest error to remove.
-
size_t
max_pts_to_delete_
= 20¶ Maximum number of frames to delete per estimation.
-
size_t
min_frames_to_calibrate_
= 5¶ Minimum number of frames to perform calibration.
-
timestamp
t_interval_us_
= 2e6¶ Minimal time interval between addition of two points (here, 2s by default)
-
double
max_reproj_error_tolerated_
= 0.2¶ If the avg reprojection error is below this threshold, do not remove any more points
-
int
cv_calibration_flags_
¶ OpenCV flags used to configure the camera calibration. By default the tangential parameters and the third radial parameter are not estimated.
-
int
cv_calibration_flags_fish_eye_
¶ Flags used for cv::fisheye::calibrate:
-
bool
use_fisheye_lens_
¶ In case of strong radial distortions.
-
-
struct
Metavision
::
PinholeMonoCalibratorPattern
¶ Structure representing the geometry of the rigid 3D pattern used for calibration.
Public Functions
-
PinholeMonoCalibratorPattern
(int n_cols, int n_rows, float dist_between_rows, float dist_between_cols)¶ Constructor using the physical size of cells.
- Parameters
n_cols
: Number of columns in the pattern (width)n_rows
: Number of rows of the pattern (height)dist_between_rows
: Distance between two consecutive rows of the patterndist_between_cols
: Distance between two consecutive columns of the pattern
-
PinholeMonoCalibratorPattern
(int n_cols, int n_rows, const std::vector<double> &coordinates_3d)¶ Constructor using a flattened vector of 3D coordinates.
- Parameters
n_cols
: Number of columns in the pattern (width)n_rows
: Number of rows of the pattern (height)coordinates_3d
: 3D positions of each point of the pattern, should be n_cols * n_rows * 3 size
-
PinholeMonoCalibratorPattern
(int n_cols, int n_rows, const std::vector<cv::Point3f> &pts_3d)¶ Constructor using a vector of 3D points.
- Parameters
n_cols
: Number of columns in the pattern (width)n_rows
: Number of rows of the pattern (height)pts_3d
: 3D points of the pattern, should be n_cols * n_rows size
-
-
class
Metavision
::
PinholeMonoCalibrator
¶ Class that takes the 2D projection of a rigid 3D pattern to calibrate a camera (its intrinsics parameters) using a Pinhole camera model.
Public Functions
-
PinholeMonoCalibrator
(int width, int height, const PinholeMonoCalibratorPattern &pattern, const PinholeMonoCalibratorSettings &settings)¶ Constructor.
- Parameters
width
: Sensor’s width (in pixels)height
: Sensor’s height (in pixels)pattern
: Geometry of a rigid 3D patternsettings
: Calibration mode and its stopping criterion
-
bool
add_2d_detection
(const timestamp ts, const std::vector<cv::Point2f> &img_points)¶ Adds a 2D detection of the 3D pattern.
- Return
true if the detection has actually been added
- Parameters
ts
: Timestamp at which the 3D pattern was detectedimg_points
: 2D observations in the image of the 3D pattern’s keypoints
-
bool
perform_calibration
()¶ Does the calibration using OpenCV.
- Return
True if the calibration has been successful
-
void
write_full_calibration
(std::string directory)¶ Writes the estimated camera matrix and the distortion coefficients.
- Parameters
directory
: Directory where to save all calibration files
-
bool
add_multiple_detections
(const std::vector<std::vector<cv::Point2f>> &img_points)¶ Adds already dumped detections.
- Return
True if the detections where coherent with what was expected, false otherwise.
- Parameters
img_points
: 2D observations to be added
-