OpenCV
This arrow is a collection of vital algorithms implemented with the OpenCV API
This arrow can be built by enabling the KWIVER_ENABLE_OPENCV CMake flag
This arrow contains the following functionality:
Algorithm Implementations
analyze_tracks
-
class analyze_tracks : public kwiver::vital::algo::analyze_tracks
A class for outputting various debug info about feature tracks.
Public Functions
-
virtual ~analyze_tracks()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s currently configuration is valid.
-
virtual void print_info(vital::track_set_sptr track_set, stream_t &stream = std::cout) const override
Output various information about the tracks stored in the input set.
Output various information about the tracks stored in the input set.
- Parameters:
track_set – [in] the tracks to analyze
stream – [in] an output stream to write data onto
-
virtual ~analyze_tracks()
detect_features
-
class detect_features : public kwiver::vital::algo::detect_features
OCV Specific base definition for algorithms that detect feature points
This extended algorithm_def provides a common implementation for the detect method.
Subclassed by kwiver::arrows::ocv::detect_features_AGAST, kwiver::arrows::ocv::detect_features_BRISK, kwiver::arrows::ocv::detect_features_FAST, kwiver::arrows::ocv::detect_features_GFTT, kwiver::arrows::ocv::detect_features_MSD, kwiver::arrows::ocv::detect_features_MSER, kwiver::arrows::ocv::detect_features_ORB, kwiver::arrows::ocv::detect_features_SIFT, kwiver::arrows::ocv::detect_features_STAR, kwiver::arrows::ocv::detect_features_SURF, kwiver::arrows::ocv::detect_features_simple_blob
Public Functions
-
virtual vital::feature_set_sptr detect(vital::image_container_sptr image_data, vital::image_container_sptr mask = vital::image_container_sptr()) const
Extract a set of image features from the provided image.
Extract a set of image features from the provided image
A given mask image should be one-channel (mask->depth() == 1). If the given mask image has more than one channel, only the first will be considered.
- Parameters:
image_data – contains the image data to process
mask – Mask image where regions of positive values (boolean true) indicate regions to consider. Only the first channel will be considered.
- Returns:
a set of image features
-
virtual vital::feature_set_sptr detect(vital::image_container_sptr image_data, vital::image_container_sptr mask = vital::image_container_sptr()) const
detect_features_AGAST
-
class detect_features_AGAST : public kwiver::arrows::ocv::detect_features
Public Functions
-
virtual ~detect_features_AGAST()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
Public Static Attributes
- static const std::string list_agast_types ="\tAGAST_5_8 = " KWIVER_STRINGIFY(cv::AgastFeatureDetector::AGAST_5_8 ) "\n""\tAGAST_7_12d = "KWIVER_STRINGIFY( cv::AgastFeatureDetector::AGAST_7_12d ) "\n""\tAGAST_7_12s = "KWIVER_STRINGIFY( cv::AgastFeatureDetector::AGAST_7_12s ) "\n""\tOAST_9_16 = "KWIVER_STRINGIFY( cv::AgastFeatureDetector::OAST_9_16 )
Return multi-line, tabbed list string of available enum types and their values
-
virtual ~detect_features_AGAST()
detect_features_FAST
-
class detect_features_FAST : public kwiver::arrows::ocv::detect_features
Public Functions
-
virtual ~detect_features_FAST()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
-
virtual vital::feature_set_sptr detect(vital::image_container_sptr image_data, vital::image_container_sptr mask = vital::image_container_sptr()) const override
Extract a set of image features from the provided image.
Extract a set of image features from the provided image
A given mask image should be one-channel (mask->depth() == 1). If the given mask image has more than one channel, only the first will be considered. This method overrides the base detect method and adds dynamic threshold adaptation. It adjusts the detector’s feature strength threshold to try and extract a target number of features in each frame. Because scene content varies between images, different feature strength thresholds may be necessary to get the same number of feautres in different images.
- Parameters:
image_data – contains the image data to process
mask – Mask image where regions of positive values (boolean true) indicate regions to consider. Only the first channel will be considered.
- Returns:
a set of image features
-
class priv
Public Functions
-
inline priv(detect_features_FAST &parent)
Constructor.
-
inline cv::Ptr<cv::FastFeatureDetector> create() const
Create a new FAST detector instance with the current parameter values.
-
inline void update(cv::Ptr<cv::FeatureDetector> detector) const
Update the parameters of the given detector with the currently set values.
-
inline bool check_config(vital::config_block_sptr const &config, logger_handle_t const &logger) const
Check config parameter values.
-
inline priv(detect_features_FAST &parent)
-
virtual ~detect_features_FAST()
detect_features_GFTT
-
class detect_features_GFTT : public kwiver::arrows::ocv::detect_features
detect_features_MSD
-
class detect_features_MSD : public kwiver::arrows::ocv::detect_features
Public Functions
- PLUGGABLE_IMPL (detect_features_MSD, "OpenCV feature detection via the MSD algorithm", PARAM_DEFAULT(patch_radius, int, "patch_radius", 3), PARAM_DEFAULT(search_area_radius, int, "search_area_radius", 5), PARAM_DEFAULT(nms_radius, int, "nms_radius", 5), PARAM_DEFAULT(nms_scale_radius, int, "nms_scale_radius", 0), PARAM_DEFAULT(th_saliency, float, "th_saliency", 250.0f), PARAM_DEFAULT(knn, int, "knn", 4), PARAM_DEFAULT(scale_factor, float, "scale_factor", 1.25f), PARAM_DEFAULT(n_scales, int, "n_scales", -1), PARAM_DEFAULT(compute_orientation, bool, "compute_orientation", false)) virtual ~detect_features_MSD()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
detect_features_MSER
-
class detect_features_MSER : public kwiver::arrows::ocv::detect_features
detect_features_simple_blob
-
class detect_features_simple_blob : public kwiver::arrows::ocv::detect_features
detect_features_STAR
-
class detect_features_STAR : public kwiver::arrows::ocv::detect_features
detect_heat_map
-
class detect_heat_map : public kwiver::vital::algo::image_object_detector
Generate bounding boxes from a heat map.
This object detector algorithm implementation extracts a detected object set from a heat map image. There are a number of different modes of operation. If “threshold” is set to a positive value, the heat map is first thresholded to a binary image, and the detected objects correspond to bounding boxes around clusters of connected pixels. These detected objects can further be filtered based on the cluster region properties (e.g., area, fill fraction, etc.). If threshold is set to -1, the heat map will be processed using the full pixel-value range.
If a threshold is provided and force_bbox_width and force_bbox_height are not set, then the thresholded binary image will be clustered into connected- component regions, each becoming a detection with a bounding box.
If force_bbox_width and force_bbox_height are set, a greedy algorithm will attempt to put down bounding boxes of fixed size. The first bounding box is chosen to cover the greatest sum-intensity in the heat map. This region is masked out, and the next bounding box tries to captures the maximum remaining intensity, and this process is repeated. The end result is not necassarily a global optimum, as map cover problems are np hard.
Public Functions
-
virtual ~detect_heat_map() noexcept
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
-
virtual kwiver::vital::detected_object_set_sptr detect(kwiver::vital::image_container_sptr image_data) const override
Return homography to stabilize the image_src relative to the key frame.
Find all objects on the provided image
This method analyzes the supplied image and along with any saved context, returns a vector of detected image objects.
- Parameters:
image_data – the image pixels
- Returns:
vector of image objects found
-
class priv
Private implementation class.
Public Functions
-
inline priv(detect_heat_map &parent)
Constructor.
-
inline detected_object_set_sptr get_bbox_fixed_size_dense(cv::Mat const &heat_map)
Consider windows on a dense, fixed grid, removing empty ones.
-
inline detected_object_set_sptr get_bbox_fixed_size(cv::Mat const &heat_map0)
Find optimal tiling of bounding boxes with fixed size.
-
inline detected_object_set_sptr get_bbox_ccomponents(cv::Mat const &heat_map)
Threshold image and find connected components of binary image.
-
inline priv(detect_heat_map &parent)
-
virtual ~detect_heat_map() noexcept
detect_motion_3frame_differencing
-
class detect_motion_3frame_differencing : public kwiver::vital::algo::detect_motion
OCV implementation of detect_motion using three-frame differencing.
Public Functions
-
virtual ~detect_motion_3frame_differencing() noexcept
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
-
virtual kwiver::vital::image_container_sptr process_image(const kwiver::vital::timestamp &ts, const kwiver::vital::image_container_sptr image, bool reset_model) override
Detect motion from a sequence of images.
Detect motion from a sequence of images
This method detects motion of foreground objects within a sequence of images in which the background remains stationary. Sequential images are passed one at a time. Motion estimates are returned for each image as a heat map with higher values indicating greater confidence.
- Parameters:
ts – Timestamp for the input image
image – Image from a sequence
reset_model – Indicates that the model should be reset, for example, due to changes in lighting condition or camera pose
- Returns:
A heat map image is returned indicating the confidence that motion occurred at each pixel. Heat map image is single channel and has the same width and height dimensions as the input image.
-
class priv
Private implementation class.
Public Functions
-
inline std::string m_debug_dir() const
Parameters.
-
inline priv(detect_motion_3frame_differencing &parent)
Constructor.
-
inline void reset()
Flush the image queue.
-
inline void image_difference(const cv::Mat &img1, const cv::Mat &img2, cv::Mat &img_diff)
Calculates a jittered difference img1 and img2.
For each pixel in img1, the minimum absolute difference ||img1-b|| is calculated, where b is drawn from a neighborhood (defined by m_jitter_radius) around the equivalent pixel in img2.
- Parameters:
img1 – first image
img2 – second image
img_diff – difference image
-
inline void setup_debug_dir()
Set up debug directory.
-
inline std::string m_debug_dir() const
-
virtual ~detect_motion_3frame_differencing() noexcept
detect_motion_mog2
-
class detect_motion_mog2 : public kwiver::vital::algo::detect_motion
OCV implementation of detect_motion_using cv::BackgroundSubtractormog2.
Public Functions
- PLUGGABLE_IMPL (detect_motion_mog2, "OCV implementation of detect_motion using cv::BackgroundSubtractormog2", PARAM_DEFAULT(var_threshold, double, "Threshold on the squared Mahalanobis distance between " "the pixel and the model to decide whether a pixel is " "well described by the background model. This parameter " "does not affect the background update.", 36.0), PARAM_DEFAULT(history, int, "Length of the history.", 100), PARAM_DEFAULT(learning_rate, double, "determines how quickly features are “forgotten” from " "histograms (range 0-1).", 0.01), PARAM_DEFAULT(blur_kernel_size, int, "Diameter of the normalized box filter blurring " "kernel (positive integer).", 3), PARAM_DEFAULT(min_frames, int, "Minimum frames that need to be included in the " "background model before detections are emmited.", 1), PARAM_DEFAULT(max_foreground_fract, double, "Specifies the maximum expected fraction of the scene " "that may contain foreground movers at any time. When the " "fraction of pixels determined to be in motion exceeds " "this value, the background model is assumed to be " "invalid (e.g., due to excessive camera motion) and is " "reset. The default value of 1 indicates that no checking " "is done.", 1)) virtual ~detect_motion_mog2() noexcept
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
-
virtual kwiver::vital::image_container_sptr process_image(const kwiver::vital::timestamp &ts, const kwiver::vital::image_container_sptr image, bool reset_model) override
Detect motion from a sequence of images.
Detect motion from a sequence of images
This method detects motion of foreground objects within a sequence of images in which the background remains stationary. Sequential images are passed one at a time. Motion estimates are returned for each image as a heat map with higher values indicating greater confidence.
- Parameters:
ts – Timestamp for the input image
image – Image from a sequence
reset_model – Indicates that the background model should be reset, for example, due to changes in lighting condition or camera pose
- Returns:
A heat map image is returned indicating the confidence that motion occurred at each pixel. Heat map image is single channel and has the same width and height dimensions as the input image.
-
class priv
Private implementation class.
Public Functions
-
inline priv(detect_motion_mog2 &parent)
Constructor.
-
inline void reset()
Create new impl instance based on current parameters.
Public Members
-
int m_frame_count
Parameters.
-
inline priv(detect_motion_mog2 &parent)
draw_detected_object_set
-
class draw_detected_object_set : public kwiver::vital::algo::draw_detected_object_set
An abstract base class for algorithms which draw tracks on top of images in various ways, for analyzing results.
Public Functions
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual kwiver::vital::image_container_sptr draw(kwiver::vital::detected_object_set_sptr detected_set, kwiver::vital::image_container_sptr image) override
Draw detected object boxes om image.
- Parameters:
detected_set – Set of detected objects
image – Boxes are drawn in this image
- Returns:
Image with boxes and other annotations added.
-
class priv
Public Functions
-
inline void draw_box(cv::Mat &image, const vital::detected_object_sptr dos, std::string label, double prob, bool just_text = false, int offset_index = 0) const
Draw a box on an image.
This method draws a box on an image for the bounding box from a detected object.
When drawing a box with multiple class names, draw the first class_name with the
just_textparameter false and all subsequent calls with it set to true. Also theoffsetparameter must be incremented so the labels do not overwrite.- Parameters:
image – [inout] Input image updated with drawn box
dos – [in] detected object with bounding box
label – [in] Text label to use for box
prob – [in] Probability value to add to label text
just_text – [in] Set to true if only draw text, not the bounding box. This is used when there are multiple labels for the same detection.
offset – [in] How much to offset text fill box from text baseline. This is used to offset labels when there are more than one label for a detection.
-
inline vital::image_container_sptr draw_detections(vital::image_container_sptr image_data, vital::detected_object_set_sptr in_set) const
Draw detected object on image.
This method draws the detections on a copy of the supplied image. The detections are drawn in confidence order up to the threshold. For each detection, the most likely class_name is optionally displayed below the box.
- Parameters:
image_data – The image to draw on.
input_set – List of detections to draw.
- Returns:
New image with boxes drawn.
-
inline bool name_selected(std::string const &name) const
See if name has been selected for display.
- Parameters:
name – Name to check.
- Returns:
true if name should be rendered
-
struct Bound_Box_Params
-
inline void draw_box(cv::Mat &image, const vital::detected_object_sptr dos, std::string label, double prob, bool just_text = false, int offset_index = 0) const
-
virtual bool check_configuration(vital::config_block_sptr config) const override
draw_tracks
-
class draw_tracks : public kwiver::vital::algo::draw_tracks
A class for drawing various information about feature tracks.
Public Functions
-
virtual ~draw_tracks()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s currently configuration is valid.
-
virtual vital::image_container_sptr draw(vital::track_set_sptr display_set, vital::image_container_sptr_list image_data, vital::track_set_sptr comparison_set = vital::track_set_sptr()) override
Output images with tracked features drawn on them.
Draw features tracks on top of the input images.
This process can either be called in an offline fashion, where all tracks and images are provided to the function on the first call, or in an online fashion where only new images are provided on sequential calls. This function can additionally consumes a second track set for which can optionally be used to display additional information to provide a comparison between the two track sets.
- Parameters:
display_set – [in] the main track set to draw
image_data – [in] a list of images the tracks were computed over
comparison_set – [in] optional comparison track set
- Returns:
a pointer to the last image generated
-
virtual ~draw_tracks()
estimate_fundamental_matrix
-
class estimate_fundamental_matrix : public kwiver::vital::algo::estimate_fundamental_matrix
A class that using OpenCV to estimate a fundamental matrix from matching 2D points
Public Functions
-
virtual ~estimate_fundamental_matrix()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid.
-
vital::fundamental_matrix_sptr estimate(const std::vector<vital::vector_2d> &pts1, const std::vector<vital::vector_2d> &pts2, std::vector<bool> &inliers, double inlier_scale = 3.0) const override
Estimate a fundamental matrix from corresponding points
If estimation fails, a NULL-containing sptr is returned
- Parameters:
pts1 – [in] the vector or corresponding points from the source image
pts2 – [in] the vector of corresponding points from the destination image
inliers – [out] for each point pair, the value is true if this pair is an inlier to the fundamental matrix estimate
inlier_scale – [in] error distance tolerated for matches to be inliers
-
virtual ~estimate_fundamental_matrix()
estimate_homography
-
class estimate_homography : public kwiver::vital::algo::estimate_homography
A class that using OpenCV to estimate a homography from matching 2D points.
estimate_pnp
-
class estimate_pnp : public kwiver::vital::algo::estimate_pnp
A class that uses OpenCV to estimate a camera’s pose from 3D feature and point projection pairs.
Public Functions
-
virtual ~estimate_pnp()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid.
Check that the algorithm’s configuration vital::config_block is valid.
-
kwiver::vital::camera_perspective_sptr estimate(const std::vector<vital::vector_2d> &pts2d, const std::vector<vital::vector_3d> &pts3d, const kwiver::vital::camera_intrinsics_sptr cal, std::vector<bool> &inliers) const override
Estimate a camera pose from corresponding points.
Estimate the camera’s pose from the 3D points and their corresponding projections
- Parameters:
pts2d – [in] 2d projections of pts3d in the same order as pts3d
pts3d – [in] 3d landmarks in the same order as pts2d. Both must be same size.
cal – [in] the intrinsic parameters of the camera
inliers – [out] for each point, the value is true if this pair is an inlier to the estimate
-
virtual ~estimate_pnp()
extract_descriptors_BRIEF
-
class extract_descriptors_BRIEF : public kwiver::arrows::ocv::extract_descriptors
Public Functions
-
virtual ~extract_descriptors_BRIEF()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual ~extract_descriptors_BRIEF()
extract_descriptors_DAISY
-
class extract_descriptors_DAISY : public kwiver::arrows::ocv::extract_descriptors
extract_descriptors_FREAK
-
class extract_descriptors_FREAK : public kwiver::arrows::ocv::extract_descriptors
extract_descriptors_LATCH
-
class extract_descriptors_LATCH : public kwiver::arrows::ocv::extract_descriptors
extract_descriptors_LUCID
-
class extract_descriptors_LUCID : public kwiver::arrows::ocv::extract_descriptors
detect_features_BRISK
-
class detect_features_BRISK : public kwiver::arrows::ocv::detect_features
detect_features_ORB
-
class detect_features_ORB : public kwiver::arrows::ocv::detect_features
detect_features_SIFT
-
class detect_features_SIFT : public kwiver::arrows::ocv::detect_features
Public Functions
-
virtual ~detect_features_SIFT()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual ~detect_features_SIFT()
detect_features_SURF
-
class detect_features_SURF : public kwiver::arrows::ocv::detect_features
hough_circle_detector
-
class hough_circle_detector : public kwiver::vital::algo::image_object_detector
Public Functions
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual vital::detected_object_set_sptr detect(vital::image_container_sptr image_data) const override
Find all objects on the provided image
This method analyzes the supplied image and along with any saved context, returns a vector of detected image objects.
- Parameters:
image_data – the image pixels
- Returns:
vector of image objects found
-
virtual bool check_configuration(vital::config_block_sptr config) const override
image_io
-
class image_io : public kwiver::vital::algo::image_io
A class for using OpenCV to read and write images.
Public Functions
-
virtual kwiver::vital::metadata_sptr load_metadata_(std::string const &filename) const
Implementation specific metadata functionality.
Load image metadata from the file
- Parameters:
filename – the path to the file to read
filename – the path to the file to read
- Returns:
pointer to the loaded metadata
- Returns:
pointer to the loaded metadata
-
virtual kwiver::vital::metadata_sptr load_metadata_(std::string const &filename) const
inpaint
-
class inpaint : public kwiver::vital::algo::merge_images
OCV image inpainting process.
Replace pixels in the image specified by non-zero elements in the mask with inpainted values estimated from surrounding pixels.
Public Functions
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s currently configuration is valid.
-
virtual kwiver::vital::image_container_sptr merge(kwiver::vital::image_container_sptr image, kwiver::vital::image_container_sptr mask) const override
Inpaint image based on locations specied in mask.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
match_features_bruteforce
-
class match_features_bruteforce : public kwiver::arrows::ocv::match_features
Feature matcher implementation using OpenCV’s brute-force feature matcher.
match_features_flannbased
-
class match_features_flannbased : public kwiver::arrows::ocv::match_features
Feature matcher implementation using OpenCV’s FLANN-based feature matcher.
Public Functions
-
virtual ~match_features_flannbased()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration vital::config_block is valid.
-
class priv
Public Functions
-
inline priv(match_features_flannbased &parent)
Constructor.
-
inline void create()
Create a new flann-based matcher instance and set our matcher param to it.
-
inline void cross_check_match(const cv::Mat &descriptors1, const cv::Mat &descriptors2, std::vector<cv::DMatch> &filtered_matches12) const
Compute descriptor matching from 1 to 2 and from 2 to 1.
Only return descriptor matches if the one of the top N matches from 1 to 2 is also a top N match from 2 to 1. Here N is defined by parameter cross_check_knn
-
inline bool cross_check() const
Parameters.
-
inline priv(match_features_flannbased &parent)
-
virtual ~match_features_flannbased()
merge_images
-
class merge_images : public kwiver::vital::algo::merge_images
Public Functions
- PLUGGABLE_IMPL (merge_images, "Merge two images into one using opencv functions.\n\n" "The channels from the first image are added to the " "output image first, followed by the channels from the " "second image. This implementation takes no configuration " "parameters.") virtual ~merge_images()=default
Destructor.
-
virtual kwiver::vital::image_container_sptr merge(kwiver::vital::image_container_sptr image1, kwiver::vital::image_container_sptr image2) const override
Merge images.
refine_detections_write_to_disk
-
class refine_detections_write_to_disk : public kwiver::vital::algo::refine_detections
A class for drawing various information about feature tracks.
Public Functions
-
virtual ~refine_detections_write_to_disk()
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s currently configuration is valid.
-
virtual vital::detected_object_set_sptr refine(vital::image_container_sptr image_data, vital::detected_object_set_sptr detections) const override
Refine all object detections on the provided image
This method analyzes the supplied image and and detections on it, returning a refined set of detections.
- Parameters:
image_data – the image pixels
detections – detected objects
- Returns:
vector of image objects refined
-
virtual ~refine_detections_write_to_disk()
split_image
-
class split_image : public kwiver::vital::algo::split_image
A class for writing out image chips around detections, useful as a debugging process for ensuring that the refine detections process is running on desired ROIs.
Public Functions
- PLUGGABLE_IMPL (split_image, "Split an image into multiple smaller images using opencv functions") virtual ~split_image()
Destructor.
-
virtual std::vector<kwiver::vital::image_container_sptr> split(kwiver::vital::image_container_sptr img) const override
Split image.
track_features_klt
-
class track_features_klt : public kwiver::vital::algo::track_features
A basic feature tracker.
Public Functions
- PLUGGABLE_IMPL (track_features_klt, "OpenCV Lucas Kanade feature tracker", PARAM_DEFAULT(redetect_frac_lost_threshold, float, "redetect if fraction of features tracked from last " "detection drops below this level", 0.7f), PARAM_DEFAULT(grid_rows, int, "rows in feature distribution enforcing grid", 0), PARAM_DEFAULT(grid_cols, int, "colums in feature distribution enforcing grid", 0), PARAM_DEFAULT(new_feat_exclusionary_radius_image_fraction, float, "do not place new features any closer than this fraction of image min " "dimension to existing features", 0.01f), PARAM_DEFAULT(win_size, int, "klt image patch side length (it's a square)", 41), PARAM_DEFAULT(max_pyramid_level, int, "maximum pyramid level used in klt feature tracking", 3), PARAM_DEFAULT(target_number_of_features, int, "number of features that detector tries to find. May be " "more or less depending on image content. The algorithm " "attempts to distribute this many features evenly across " "the image. If texture is locally weak few feautres may be " "extracted in a local area reducing the total detected " "feature count.", 2048), PARAM_DEFAULT(klt_path_l1_difference_thresh, int, "patches with average l1 difference greater than this threshold " "will be discarded.", 10), PARAM(feature_detector, vital::algo::detect_features_sptr, "feature_detector configuration")) virtual ~track_features_klt() noexcept
Destructor.
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s currently configuration is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritence reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual vital::feature_track_set_sptr track(vital::feature_track_set_sptr prev_tracks, vital::frame_id_t frame_number, vital::image_container_sptr image_data, vital::image_container_sptr mask = {}) const override
Extend a previous set of feature tracks using the current frame.
Extend a previous set of feature tracks using the current frame
- Throws:
image_size_mismatch_exception – When the given non-zero mask image does not match the size of the dimensions of the given image data.
- Parameters:
prev_tracks – [in] the feature tracks from previous tracking steps
frame_number – [in] the frame number of the current frame
image_data – [in] the image pixels for the current frame
mask – [in] Optional mask image that uses positive values to denote regions of the input image to consider for feature tracking. An empty sptr indicates no mask (default value).
- Returns:
an updated set of feature tracks including the current frame