use std::os::raw::{c_char, c_void};
use libc::{ptrdiff_t, size_t};
use crate::{Error, Result, core, sys, types};
use crate::core::{_InputArrayTrait, _OutputArrayTrait};
pub const AKAZE_DESCRIPTOR_KAZE: i32 = 3;
pub const AKAZE_DESCRIPTOR_KAZE_UPRIGHT: i32 = 2;
pub const AKAZE_DESCRIPTOR_MLDB: i32 = 5;
pub const AKAZE_DESCRIPTOR_MLDB_UPRIGHT: i32 = 4;
pub const AgastFeatureDetector_AGAST_5_8: i32 = 0;
pub const AgastFeatureDetector_AGAST_7_12d: i32 = 1;
pub const AgastFeatureDetector_AGAST_7_12s: i32 = 2;
pub const AgastFeatureDetector_OAST_9_16: i32 = 3;
pub const CV_HAL_TYPE_5_8: i32 = 0;
pub const CV_HAL_TYPE_7_12: i32 = 1;
pub const CV_HAL_TYPE_9_16: i32 = 2;
pub const DescriptorMatcher_BRUTEFORCE: i32 = 2;
pub const DescriptorMatcher_BRUTEFORCE_HAMMING: i32 = 4;
pub const DescriptorMatcher_BRUTEFORCE_HAMMINGLUT: i32 = 5;
pub const DescriptorMatcher_BRUTEFORCE_L1: i32 = 3;
pub const DescriptorMatcher_BRUTEFORCE_SL2: i32 = 6;
pub const DescriptorMatcher_FLANNBASED: i32 = 1;
pub const DrawMatchesFlags_DEFAULT: i32 = 0;
pub const DrawMatchesFlags_DRAW_OVER_OUTIMG: i32 = 1;
pub const DrawMatchesFlags_DRAW_RICH_KEYPOINTS: i32 = 4;
pub const DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS: i32 = 2;
pub const FastFeatureDetector_FAST_N: i32 = 10002;
pub const FastFeatureDetector_NONMAX_SUPPRESSION: i32 = 10001;
pub const FastFeatureDetector_THRESHOLD: i32 = 10000;
pub const FastFeatureDetector_TYPE_5_8: i32 = 0;
pub const FastFeatureDetector_TYPE_7_12: i32 = 1;
pub const FastFeatureDetector_TYPE_9_16: i32 = 2;
pub const KAZE_DIFF_CHARBONNIER: i32 = 3;
pub const KAZE_DIFF_PM_G1: i32 = 0;
pub const KAZE_DIFF_PM_G2: i32 = 1;
pub const KAZE_DIFF_WEICKERT: i32 = 2;
pub const ORB_FAST_SCORE: i32 = 1;
pub const ORB_HARRIS_SCORE: i32 = 0;
pub const ORB_kBytes: i32 = 32;
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct SimpleBlobDetector_Params {
pub threshold_step: f32,
pub min_threshold: f32,
pub max_threshold: f32,
pub min_repeatability: size_t,
pub min_dist_between_blobs: f32,
pub filter_by_color: bool,
pub blob_color: u8,
pub filter_by_area: bool,
pub min_area: f32,
pub max_area: f32,
pub filter_by_circularity: bool,
pub min_circularity: f32,
pub max_circularity: f32,
pub filter_by_inertia: bool,
pub min_inertia_ratio: f32,
pub max_inertia_ratio: f32,
pub filter_by_convexity: bool,
pub min_convexity: f32,
pub max_convexity: f32,
}
pub fn AGAST(image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, threshold: i32, nonmax_suppression: bool) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_AGAST__InputArray_VectorOfKeyPoint_int_bool(image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), threshold, nonmax_suppression) }.into_result()
}
pub fn AGAST_with_type(image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, threshold: i32, nonmax_suppression: bool, _type: i32) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_AGAST__InputArray_VectorOfKeyPoint_int_bool_int(image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), threshold, nonmax_suppression, _type) }.into_result()
}
pub fn FAST(image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, threshold: i32, nonmax_suppression: bool) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_FAST__InputArray_VectorOfKeyPoint_int_bool(image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), threshold, nonmax_suppression) }.into_result()
}
pub fn FAST_with_type(image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, threshold: i32, nonmax_suppression: bool, _type: i32) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_FAST__InputArray_VectorOfKeyPoint_int_bool_int(image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), threshold, nonmax_suppression, _type) }.into_result()
}
pub fn compute_recall_precision_curve(matches1to2: &types::VectorOfVectorOfDMatch, correct_matches1to2_mask: &types::VectorOfVectorOfuchar, recall_precision_curve: &mut types::VectorOfPoint2f) -> Result<()> {
unsafe { sys::cv_computeRecallPrecisionCurve_VectorOfVectorOfDMatch_VectorOfVectorOfuchar_VectorOfPoint2f(matches1to2.as_raw_VectorOfVectorOfDMatch(), correct_matches1to2_mask.as_raw_VectorOfVectorOfuchar(), recall_precision_curve.as_raw_VectorOfPoint2f()) }.into_result()
}
pub fn draw_keypoints(image: &dyn core::ToInputArray, keypoints: &types::VectorOfKeyPoint, out_image: &mut dyn core::ToInputOutputArray, color: core::Scalar, flags: i32) -> Result<()> {
input_array_arg!(image);
input_output_array_arg!(out_image);
unsafe { sys::cv_drawKeypoints__InputArray_VectorOfKeyPoint__InputOutputArray_Scalar_int(image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), out_image.as_raw__InputOutputArray(), color, flags) }.into_result()
}
pub fn draw_matches(img1: &dyn core::ToInputArray, keypoints1: &types::VectorOfKeyPoint, img2: &dyn core::ToInputArray, keypoints2: &types::VectorOfKeyPoint, matches1to2: &types::VectorOfDMatch, out_img: &mut dyn core::ToInputOutputArray, match_color: core::Scalar, single_point_color: core::Scalar, matches_mask: &types::VectorOfchar, flags: i32) -> Result<()> {
input_array_arg!(img1);
input_array_arg!(img2);
input_output_array_arg!(out_img);
unsafe { sys::cv_drawMatches__InputArray_VectorOfKeyPoint__InputArray_VectorOfKeyPoint_VectorOfDMatch__InputOutputArray_Scalar_Scalar_VectorOfchar_int(img1.as_raw__InputArray(), keypoints1.as_raw_VectorOfKeyPoint(), img2.as_raw__InputArray(), keypoints2.as_raw_VectorOfKeyPoint(), matches1to2.as_raw_VectorOfDMatch(), out_img.as_raw__InputOutputArray(), match_color, single_point_color, matches_mask.as_raw_VectorOfchar(), flags) }.into_result()
}
pub fn draw_matches_vec(img1: &dyn core::ToInputArray, keypoints1: &types::VectorOfKeyPoint, img2: &dyn core::ToInputArray, keypoints2: &types::VectorOfKeyPoint, matches1to2: &types::VectorOfVectorOfDMatch, out_img: &mut dyn core::ToInputOutputArray, match_color: core::Scalar, single_point_color: core::Scalar, matches_mask: &types::VectorOfVectorOfchar, flags: i32) -> Result<()> {
input_array_arg!(img1);
input_array_arg!(img2);
input_output_array_arg!(out_img);
unsafe { sys::cv_drawMatches__InputArray_VectorOfKeyPoint__InputArray_VectorOfKeyPoint_VectorOfVectorOfDMatch__InputOutputArray_Scalar_Scalar_VectorOfVectorOfchar_int(img1.as_raw__InputArray(), keypoints1.as_raw_VectorOfKeyPoint(), img2.as_raw__InputArray(), keypoints2.as_raw_VectorOfKeyPoint(), matches1to2.as_raw_VectorOfVectorOfDMatch(), out_img.as_raw__InputOutputArray(), match_color, single_point_color, matches_mask.as_raw_VectorOfVectorOfchar(), flags) }.into_result()
}
pub fn evaluate_feature_detector(img1: &core::Mat, img2: &core::Mat, h1to2: &core::Mat, keypoints1: &mut types::VectorOfKeyPoint, keypoints2: &mut types::VectorOfKeyPoint, repeatability: &mut f32, corresp_count: &mut i32, fdetector: &types::PtrOfFeature2D) -> Result<()> {
unsafe { sys::cv_evaluateFeatureDetector_Mat_Mat_Mat_VectorOfKeyPoint_VectorOfKeyPoint_float_int_PtrOfFeature2D(img1.as_raw_Mat(), img2.as_raw_Mat(), h1to2.as_raw_Mat(), keypoints1.as_raw_VectorOfKeyPoint(), keypoints2.as_raw_VectorOfKeyPoint(), repeatability, corresp_count, fdetector.as_raw_PtrOfFeature2D()) }.into_result()
}
pub fn get_nearest_point(recall_precision_curve: &types::VectorOfPoint2f, l_precision: f32) -> Result<i32> {
unsafe { sys::cv_getNearestPoint_VectorOfPoint2f_float(recall_precision_curve.as_raw_VectorOfPoint2f(), l_precision) }.into_result()
}
pub fn get_recall(recall_precision_curve: &types::VectorOfPoint2f, l_precision: f32) -> Result<f32> {
unsafe { sys::cv_getRecall_VectorOfPoint2f_float(recall_precision_curve.as_raw_VectorOfPoint2f(), l_precision) }.into_result()
}
pub trait AKAZE: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_AKAZE(&self) -> *mut c_void;
fn set_descriptor_type(&mut self, dtype: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setDescriptorType_int(self.as_raw_AKAZE(), dtype) }.into_result()
}
fn get_descriptor_type(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getDescriptorType_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_descriptor_size(&mut self, dsize: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setDescriptorSize_int(self.as_raw_AKAZE(), dsize) }.into_result()
}
fn get_descriptor_size(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getDescriptorSize_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_descriptor_channels(&mut self, dch: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setDescriptorChannels_int(self.as_raw_AKAZE(), dch) }.into_result()
}
fn get_descriptor_channels(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getDescriptorChannels_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_threshold(&mut self, threshold: f64) -> Result<()> {
unsafe { sys::cv_AKAZE_setThreshold_double(self.as_raw_AKAZE(), threshold) }.into_result()
}
fn get_threshold(&self) -> Result<f64> {
unsafe { sys::cv_AKAZE_getThreshold_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_n_octaves(&mut self, octaves: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setNOctaves_int(self.as_raw_AKAZE(), octaves) }.into_result()
}
fn get_n_octaves(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getNOctaves_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_n_octave_layers(&mut self, octave_layers: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setNOctaveLayers_int(self.as_raw_AKAZE(), octave_layers) }.into_result()
}
fn get_n_octave_layers(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getNOctaveLayers_const(self.as_raw_AKAZE()) }.into_result()
}
fn set_diffusivity(&mut self, diff: i32) -> Result<()> {
unsafe { sys::cv_AKAZE_setDiffusivity_int(self.as_raw_AKAZE(), diff) }.into_result()
}
fn get_diffusivity(&self) -> Result<i32> {
unsafe { sys::cv_AKAZE_getDiffusivity_const(self.as_raw_AKAZE()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_AKAZE_getDefaultName_const(self.as_raw_AKAZE()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn AKAZE + '_ {
pub fn create(descriptor_type: i32, descriptor_size: i32, descriptor_channels: i32, threshold: f32, n_octaves: i32, n_octave_layers: i32, diffusivity: i32) -> Result<types::PtrOfAKAZE> {
unsafe { sys::cv_AKAZE_create_int_int_int_float_int_int_int(descriptor_type, descriptor_size, descriptor_channels, threshold, n_octaves, n_octave_layers, diffusivity) }.into_result().map(|ptr| types::PtrOfAKAZE { ptr })
}
}
pub trait AgastFeatureDetector: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_AgastFeatureDetector(&self) -> *mut c_void;
fn set_threshold(&mut self, threshold: i32) -> Result<()> {
unsafe { sys::cv_AgastFeatureDetector_setThreshold_int(self.as_raw_AgastFeatureDetector(), threshold) }.into_result()
}
fn get_threshold(&self) -> Result<i32> {
unsafe { sys::cv_AgastFeatureDetector_getThreshold_const(self.as_raw_AgastFeatureDetector()) }.into_result()
}
fn set_nonmax_suppression(&mut self, f: bool) -> Result<()> {
unsafe { sys::cv_AgastFeatureDetector_setNonmaxSuppression_bool(self.as_raw_AgastFeatureDetector(), f) }.into_result()
}
fn get_nonmax_suppression(&self) -> Result<bool> {
unsafe { sys::cv_AgastFeatureDetector_getNonmaxSuppression_const(self.as_raw_AgastFeatureDetector()) }.into_result()
}
fn set_type(&mut self, _type: i32) -> Result<()> {
unsafe { sys::cv_AgastFeatureDetector_setType_int(self.as_raw_AgastFeatureDetector(), _type) }.into_result()
}
fn get_type(&self) -> Result<i32> {
unsafe { sys::cv_AgastFeatureDetector_getType_const(self.as_raw_AgastFeatureDetector()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_AgastFeatureDetector_getDefaultName_const(self.as_raw_AgastFeatureDetector()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn AgastFeatureDetector + '_ {
pub fn create(threshold: i32, nonmax_suppression: bool, _type: i32) -> Result<types::PtrOfAgastFeatureDetector> {
unsafe { sys::cv_AgastFeatureDetector_create_int_bool_int(threshold, nonmax_suppression, _type) }.into_result().map(|ptr| types::PtrOfAgastFeatureDetector { ptr })
}
}
pub struct BFMatcher {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BFMatcher {
fn drop(&mut self) {
unsafe { sys::cv_BFMatcher_delete(self.ptr) };
}
}
impl BFMatcher {
#[inline(always)] pub fn as_raw_BFMatcher(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BFMatcher {}
impl core::AlgorithmTrait for BFMatcher {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::features2d::DescriptorMatcher for BFMatcher {
#[inline(always)] fn as_raw_DescriptorMatcher(&self) -> *mut c_void { self.ptr }
}
impl BFMatcher {
pub fn new(norm_type: i32, cross_check: bool) -> Result<crate::features2d::BFMatcher> {
unsafe { sys::cv_BFMatcher_BFMatcher_int_bool(norm_type, cross_check) }.into_result().map(|ptr| crate::features2d::BFMatcher { ptr })
}
pub fn is_mask_supported(&self) -> Result<bool> {
unsafe { sys::cv_BFMatcher_isMaskSupported_const(self.as_raw_BFMatcher()) }.into_result()
}
pub fn create(norm_type: i32, cross_check: bool) -> Result<types::PtrOfBFMatcher> {
unsafe { sys::cv_BFMatcher_create_int_bool(norm_type, cross_check) }.into_result().map(|ptr| types::PtrOfBFMatcher { ptr })
}
pub fn clone(&self, empty_train_data: bool) -> Result<types::PtrOfDescriptorMatcher> {
unsafe { sys::cv_BFMatcher_clone_const_bool(self.as_raw_BFMatcher(), empty_train_data) }.into_result().map(|ptr| types::PtrOfDescriptorMatcher { ptr })
}
}
pub struct BOWImgDescriptorExtractor {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BOWImgDescriptorExtractor {
fn drop(&mut self) {
unsafe { sys::cv_BOWImgDescriptorExtractor_delete(self.ptr) };
}
}
impl BOWImgDescriptorExtractor {
#[inline(always)] pub fn as_raw_BOWImgDescriptorExtractor(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BOWImgDescriptorExtractor {}
impl BOWImgDescriptorExtractor {
pub fn new_with_dextractor(dextractor: &types::PtrOfFeature2D, dmatcher: &types::PtrOfDescriptorMatcher) -> Result<crate::features2d::BOWImgDescriptorExtractor> {
unsafe { sys::cv_BOWImgDescriptorExtractor_BOWImgDescriptorExtractor_PtrOfFeature2D_PtrOfDescriptorMatcher(dextractor.as_raw_PtrOfFeature2D(), dmatcher.as_raw_PtrOfDescriptorMatcher()) }.into_result().map(|ptr| crate::features2d::BOWImgDescriptorExtractor { ptr })
}
pub fn new(dmatcher: &types::PtrOfDescriptorMatcher) -> Result<crate::features2d::BOWImgDescriptorExtractor> {
unsafe { sys::cv_BOWImgDescriptorExtractor_BOWImgDescriptorExtractor_PtrOfDescriptorMatcher(dmatcher.as_raw_PtrOfDescriptorMatcher()) }.into_result().map(|ptr| crate::features2d::BOWImgDescriptorExtractor { ptr })
}
pub fn set_vocabulary(&mut self, vocabulary: &core::Mat) -> Result<()> {
unsafe { sys::cv_BOWImgDescriptorExtractor_setVocabulary_Mat(self.as_raw_BOWImgDescriptorExtractor(), vocabulary.as_raw_Mat()) }.into_result()
}
pub fn get_vocabulary(&self) -> Result<core::Mat> {
unsafe { sys::cv_BOWImgDescriptorExtractor_getVocabulary_const(self.as_raw_BOWImgDescriptorExtractor()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn compute_desc(&mut self, image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, img_descriptor: &mut dyn core::ToOutputArray, point_idxs_of_clusters: &mut types::VectorOfVectorOfint, descriptors: &mut core::Mat) -> Result<()> {
input_array_arg!(image);
output_array_arg!(img_descriptor);
unsafe { sys::cv_BOWImgDescriptorExtractor_compute__InputArray_VectorOfKeyPoint__OutputArray_VectorOfVectorOfint_Mat(self.as_raw_BOWImgDescriptorExtractor(), image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), img_descriptor.as_raw__OutputArray(), point_idxs_of_clusters.as_raw_VectorOfVectorOfint(), descriptors.as_raw_Mat()) }.into_result()
}
pub fn compute(&mut self, keypoint_descriptors: &dyn core::ToInputArray, img_descriptor: &mut dyn core::ToOutputArray, point_idxs_of_clusters: &mut types::VectorOfVectorOfint) -> Result<()> {
input_array_arg!(keypoint_descriptors);
output_array_arg!(img_descriptor);
unsafe { sys::cv_BOWImgDescriptorExtractor_compute__InputArray__OutputArray_VectorOfVectorOfint(self.as_raw_BOWImgDescriptorExtractor(), keypoint_descriptors.as_raw__InputArray(), img_descriptor.as_raw__OutputArray(), point_idxs_of_clusters.as_raw_VectorOfVectorOfint()) }.into_result()
}
pub fn compute2(&mut self, image: &core::Mat, keypoints: &mut types::VectorOfKeyPoint, img_descriptor: &mut core::Mat) -> Result<()> {
unsafe { sys::cv_BOWImgDescriptorExtractor_compute2_Mat_VectorOfKeyPoint_Mat(self.as_raw_BOWImgDescriptorExtractor(), image.as_raw_Mat(), keypoints.as_raw_VectorOfKeyPoint(), img_descriptor.as_raw_Mat()) }.into_result()
}
pub fn descriptor_size(&self) -> Result<i32> {
unsafe { sys::cv_BOWImgDescriptorExtractor_descriptorSize_const(self.as_raw_BOWImgDescriptorExtractor()) }.into_result()
}
pub fn descriptor_type(&self) -> Result<i32> {
unsafe { sys::cv_BOWImgDescriptorExtractor_descriptorType_const(self.as_raw_BOWImgDescriptorExtractor()) }.into_result()
}
}
pub struct BOWKMeansTrainer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BOWKMeansTrainer {
fn drop(&mut self) {
unsafe { sys::cv_BOWKMeansTrainer_delete(self.ptr) };
}
}
impl BOWKMeansTrainer {
#[inline(always)] pub fn as_raw_BOWKMeansTrainer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BOWKMeansTrainer {}
impl crate::features2d::BOWTrainer for BOWKMeansTrainer {
#[inline(always)] fn as_raw_BOWTrainer(&self) -> *mut c_void { self.ptr }
}
impl BOWKMeansTrainer {
pub fn new_with_criteria(cluster_count: i32, termcrit: &core::TermCriteria, attempts: i32, flags: i32) -> Result<crate::features2d::BOWKMeansTrainer> {
unsafe { sys::cv_BOWKMeansTrainer_BOWKMeansTrainer_int_TermCriteria_int_int(cluster_count, termcrit.as_raw_TermCriteria(), attempts, flags) }.into_result().map(|ptr| crate::features2d::BOWKMeansTrainer { ptr })
}
pub fn cluster(&self) -> Result<core::Mat> {
unsafe { sys::cv_BOWKMeansTrainer_cluster_const(self.as_raw_BOWKMeansTrainer()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn new(&self, descriptors: &core::Mat) -> Result<core::Mat> {
unsafe { sys::cv_BOWKMeansTrainer_cluster_const_Mat(self.as_raw_BOWKMeansTrainer(), descriptors.as_raw_Mat()) }.into_result().map(|ptr| core::Mat { ptr })
}
}
pub trait BOWTrainer {
#[inline(always)] fn as_raw_BOWTrainer(&self) -> *mut c_void;
fn add(&mut self, descriptors: &core::Mat) -> Result<()> {
unsafe { sys::cv_BOWTrainer_add_Mat(self.as_raw_BOWTrainer(), descriptors.as_raw_Mat()) }.into_result()
}
fn get_descriptors(&self) -> Result<types::VectorOfMat> {
unsafe { sys::cv_BOWTrainer_getDescriptors_const(self.as_raw_BOWTrainer()) }.into_result().map(|ptr| types::VectorOfMat { ptr })
}
fn descriptors_count(&self) -> Result<i32> {
unsafe { sys::cv_BOWTrainer_descriptorsCount_const(self.as_raw_BOWTrainer()) }.into_result()
}
fn clear(&mut self) -> Result<()> {
unsafe { sys::cv_BOWTrainer_clear(self.as_raw_BOWTrainer()) }.into_result()
}
fn cluster(&self) -> Result<core::Mat> {
unsafe { sys::cv_BOWTrainer_cluster_const(self.as_raw_BOWTrainer()) }.into_result().map(|ptr| core::Mat { ptr })
}
fn cluster_with_descriptors(&self, descriptors: &core::Mat) -> Result<core::Mat> {
unsafe { sys::cv_BOWTrainer_cluster_const_Mat(self.as_raw_BOWTrainer(), descriptors.as_raw_Mat()) }.into_result().map(|ptr| core::Mat { ptr })
}
}
pub struct BRISK {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BRISK {
fn drop(&mut self) {
unsafe { sys::cv_BRISK_delete(self.ptr) };
}
}
impl BRISK {
#[inline(always)] pub fn as_raw_BRISK(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BRISK {}
impl core::AlgorithmTrait for BRISK {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::features2d::Feature2DTrait for BRISK {
#[inline(always)] fn as_raw_Feature2D(&self) -> *mut c_void { self.ptr }
}
impl BRISK {
pub fn create(thresh: i32, octaves: i32, pattern_scale: f32) -> Result<types::PtrOfBRISK> {
unsafe { sys::cv_BRISK_create_int_int_float(thresh, octaves, pattern_scale) }.into_result().map(|ptr| types::PtrOfBRISK { ptr })
}
pub fn create_with_pattern(radius_list: &types::VectorOffloat, number_list: &types::VectorOfint, d_max: f32, d_min: f32, index_change: &types::VectorOfint) -> Result<types::PtrOfBRISK> {
unsafe { sys::cv_BRISK_create_VectorOffloat_VectorOfint_float_float_VectorOfint(radius_list.as_raw_VectorOffloat(), number_list.as_raw_VectorOfint(), d_max, d_min, index_change.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfBRISK { ptr })
}
pub fn create_with_pattern_threshold_octaves(thresh: i32, octaves: i32, radius_list: &types::VectorOffloat, number_list: &types::VectorOfint, d_max: f32, d_min: f32, index_change: &types::VectorOfint) -> Result<types::PtrOfBRISK> {
unsafe { sys::cv_BRISK_create_int_int_VectorOffloat_VectorOfint_float_float_VectorOfint(thresh, octaves, radius_list.as_raw_VectorOffloat(), number_list.as_raw_VectorOfint(), d_max, d_min, index_change.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfBRISK { ptr })
}
pub fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_BRISK_getDefaultName_const(self.as_raw_BRISK()) }.into_result().map(crate::templ::receive_string_mut)
}
}
pub trait DescriptorMatcher: core::AlgorithmTrait {
#[inline(always)] fn as_raw_DescriptorMatcher(&self) -> *mut c_void;
fn add(&mut self, descriptors: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(descriptors);
unsafe { sys::cv_DescriptorMatcher_add__InputArray(self.as_raw_DescriptorMatcher(), descriptors.as_raw__InputArray()) }.into_result()
}
fn get_train_descriptors(&self) -> Result<types::VectorOfMat> {
unsafe { sys::cv_DescriptorMatcher_getTrainDescriptors_const(self.as_raw_DescriptorMatcher()) }.into_result().map(|ptr| types::VectorOfMat { ptr })
}
fn clear(&mut self) -> Result<()> {
unsafe { sys::cv_DescriptorMatcher_clear(self.as_raw_DescriptorMatcher()) }.into_result()
}
fn empty(&self) -> Result<bool> {
unsafe { sys::cv_DescriptorMatcher_empty_const(self.as_raw_DescriptorMatcher()) }.into_result()
}
fn is_mask_supported(&self) -> Result<bool> {
unsafe { sys::cv_DescriptorMatcher_isMaskSupported_const(self.as_raw_DescriptorMatcher()) }.into_result()
}
fn train(&mut self) -> Result<()> {
unsafe { sys::cv_DescriptorMatcher_train(self.as_raw_DescriptorMatcher()) }.into_result()
}
fn train_matches(&self, query_descriptors: &dyn core::ToInputArray, train_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfDMatch, mask: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(train_descriptors);
input_array_arg!(mask);
unsafe { sys::cv_DescriptorMatcher_match_const__InputArray__InputArray_VectorOfDMatch__InputArray(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), train_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfDMatch(), mask.as_raw__InputArray()) }.into_result()
}
fn knn_train_matches(&self, query_descriptors: &dyn core::ToInputArray, train_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfVectorOfDMatch, k: i32, mask: &dyn core::ToInputArray, compact_result: bool) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(train_descriptors);
input_array_arg!(mask);
unsafe { sys::cv_DescriptorMatcher_knnMatch_const__InputArray__InputArray_VectorOfVectorOfDMatch_int__InputArray_bool(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), train_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfVectorOfDMatch(), k, mask.as_raw__InputArray(), compact_result) }.into_result()
}
fn train_radius_matches(&self, query_descriptors: &dyn core::ToInputArray, train_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfVectorOfDMatch, max_distance: f32, mask: &dyn core::ToInputArray, compact_result: bool) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(train_descriptors);
input_array_arg!(mask);
unsafe { sys::cv_DescriptorMatcher_radiusMatch_const__InputArray__InputArray_VectorOfVectorOfDMatch_float__InputArray_bool(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), train_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfVectorOfDMatch(), max_distance, mask.as_raw__InputArray(), compact_result) }.into_result()
}
fn matches(&mut self, query_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfDMatch, masks: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(masks);
unsafe { sys::cv_DescriptorMatcher_match__InputArray_VectorOfDMatch__InputArray(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfDMatch(), masks.as_raw__InputArray()) }.into_result()
}
fn knn_matches(&mut self, query_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfVectorOfDMatch, k: i32, masks: &dyn core::ToInputArray, compact_result: bool) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(masks);
unsafe { sys::cv_DescriptorMatcher_knnMatch__InputArray_VectorOfVectorOfDMatch_int__InputArray_bool(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfVectorOfDMatch(), k, masks.as_raw__InputArray(), compact_result) }.into_result()
}
fn radius_matches(&mut self, query_descriptors: &dyn core::ToInputArray, matches: &mut types::VectorOfVectorOfDMatch, max_distance: f32, masks: &dyn core::ToInputArray, compact_result: bool) -> Result<()> {
input_array_arg!(query_descriptors);
input_array_arg!(masks);
unsafe { sys::cv_DescriptorMatcher_radiusMatch__InputArray_VectorOfVectorOfDMatch_float__InputArray_bool(self.as_raw_DescriptorMatcher(), query_descriptors.as_raw__InputArray(), matches.as_raw_VectorOfVectorOfDMatch(), max_distance, masks.as_raw__InputArray(), compact_result) }.into_result()
}
fn write(&self, file_name: &str) -> Result<()> {
string_arg!(file_name);
unsafe { sys::cv_DescriptorMatcher_write_const_String(self.as_raw_DescriptorMatcher(), file_name.as_ptr()) }.into_result()
}
fn read(&mut self, file_name: &str) -> Result<()> {
string_arg!(file_name);
unsafe { sys::cv_DescriptorMatcher_read_String(self.as_raw_DescriptorMatcher(), file_name.as_ptr()) }.into_result()
}
fn read_1(&mut self, unnamed_arg: &core::FileNode) -> Result<()> {
unsafe { sys::cv_DescriptorMatcher_read_FileNode(self.as_raw_DescriptorMatcher(), unnamed_arg.as_raw_FileNode()) }.into_result()
}
fn write_1(&self, unnamed_arg: &mut core::FileStorage) -> Result<()> {
unsafe { sys::cv_DescriptorMatcher_write_const_FileStorage(self.as_raw_DescriptorMatcher(), unnamed_arg.as_raw_FileStorage()) }.into_result()
}
fn clone(&self, empty_train_data: bool) -> Result<types::PtrOfDescriptorMatcher> {
unsafe { sys::cv_DescriptorMatcher_clone_const_bool(self.as_raw_DescriptorMatcher(), empty_train_data) }.into_result().map(|ptr| types::PtrOfDescriptorMatcher { ptr })
}
fn write_2(&self, fs: &types::PtrOfFileStorage, name: &str) -> Result<()> {
string_arg!(name);
unsafe { sys::cv_DescriptorMatcher_write_const_PtrOfFileStorage_String(self.as_raw_DescriptorMatcher(), fs.as_raw_PtrOfFileStorage(), name.as_ptr()) }.into_result()
}
}
impl dyn DescriptorMatcher + '_ {
pub fn create(descriptor_matcher_type: &str) -> Result<types::PtrOfDescriptorMatcher> {
string_arg!(descriptor_matcher_type);
unsafe { sys::cv_DescriptorMatcher_create_String(descriptor_matcher_type.as_ptr()) }.into_result().map(|ptr| types::PtrOfDescriptorMatcher { ptr })
}
pub fn create_with_matcher_type(matcher_type: i32) -> Result<types::PtrOfDescriptorMatcher> {
unsafe { sys::cv_DescriptorMatcher_create_int(matcher_type) }.into_result().map(|ptr| types::PtrOfDescriptorMatcher { ptr })
}
}
pub trait FastFeatureDetector: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_FastFeatureDetector(&self) -> *mut c_void;
fn set_threshold(&mut self, threshold: i32) -> Result<()> {
unsafe { sys::cv_FastFeatureDetector_setThreshold_int(self.as_raw_FastFeatureDetector(), threshold) }.into_result()
}
fn get_threshold(&self) -> Result<i32> {
unsafe { sys::cv_FastFeatureDetector_getThreshold_const(self.as_raw_FastFeatureDetector()) }.into_result()
}
fn set_nonmax_suppression(&mut self, f: bool) -> Result<()> {
unsafe { sys::cv_FastFeatureDetector_setNonmaxSuppression_bool(self.as_raw_FastFeatureDetector(), f) }.into_result()
}
fn get_nonmax_suppression(&self) -> Result<bool> {
unsafe { sys::cv_FastFeatureDetector_getNonmaxSuppression_const(self.as_raw_FastFeatureDetector()) }.into_result()
}
fn set_type(&mut self, _type: i32) -> Result<()> {
unsafe { sys::cv_FastFeatureDetector_setType_int(self.as_raw_FastFeatureDetector(), _type) }.into_result()
}
fn get_type(&self) -> Result<i32> {
unsafe { sys::cv_FastFeatureDetector_getType_const(self.as_raw_FastFeatureDetector()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_FastFeatureDetector_getDefaultName_const(self.as_raw_FastFeatureDetector()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn FastFeatureDetector + '_ {
pub fn create(threshold: i32, nonmax_suppression: bool, _type: i32) -> Result<types::PtrOfFastFeatureDetector> {
unsafe { sys::cv_FastFeatureDetector_create_int_bool_int(threshold, nonmax_suppression, _type) }.into_result().map(|ptr| types::PtrOfFastFeatureDetector { ptr })
}
}
pub trait Feature2DTrait: core::AlgorithmTrait {
#[inline(always)] fn as_raw_Feature2D(&self) -> *mut c_void;
fn detect(&mut self, image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, mask: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(image);
input_array_arg!(mask);
unsafe { sys::cv_Feature2D_detect__InputArray_VectorOfKeyPoint__InputArray(self.as_raw_Feature2D(), image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), mask.as_raw__InputArray()) }.into_result()
}
fn detect_multiple(&mut self, images: &dyn core::ToInputArray, keypoints: &mut types::VectorOfVectorOfKeyPoint, masks: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(images);
input_array_arg!(masks);
unsafe { sys::cv_Feature2D_detect__InputArray_VectorOfVectorOfKeyPoint__InputArray(self.as_raw_Feature2D(), images.as_raw__InputArray(), keypoints.as_raw_VectorOfVectorOfKeyPoint(), masks.as_raw__InputArray()) }.into_result()
}
fn compute(&mut self, image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, descriptors: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(image);
output_array_arg!(descriptors);
unsafe { sys::cv_Feature2D_compute__InputArray_VectorOfKeyPoint__OutputArray(self.as_raw_Feature2D(), image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), descriptors.as_raw__OutputArray()) }.into_result()
}
fn compute_multiple(&mut self, images: &dyn core::ToInputArray, keypoints: &mut types::VectorOfVectorOfKeyPoint, descriptors: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(images);
output_array_arg!(descriptors);
unsafe { sys::cv_Feature2D_compute__InputArray_VectorOfVectorOfKeyPoint__OutputArray(self.as_raw_Feature2D(), images.as_raw__InputArray(), keypoints.as_raw_VectorOfVectorOfKeyPoint(), descriptors.as_raw__OutputArray()) }.into_result()
}
fn detect_and_compute(&mut self, image: &dyn core::ToInputArray, mask: &dyn core::ToInputArray, keypoints: &mut types::VectorOfKeyPoint, descriptors: &mut dyn core::ToOutputArray, use_provided_keypoints: bool) -> Result<()> {
input_array_arg!(image);
input_array_arg!(mask);
output_array_arg!(descriptors);
unsafe { sys::cv_Feature2D_detectAndCompute__InputArray__InputArray_VectorOfKeyPoint__OutputArray_bool(self.as_raw_Feature2D(), image.as_raw__InputArray(), mask.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), descriptors.as_raw__OutputArray(), use_provided_keypoints) }.into_result()
}
fn descriptor_size(&self) -> Result<i32> {
unsafe { sys::cv_Feature2D_descriptorSize_const(self.as_raw_Feature2D()) }.into_result()
}
fn descriptor_type(&self) -> Result<i32> {
unsafe { sys::cv_Feature2D_descriptorType_const(self.as_raw_Feature2D()) }.into_result()
}
fn default_norm(&self) -> Result<i32> {
unsafe { sys::cv_Feature2D_defaultNorm_const(self.as_raw_Feature2D()) }.into_result()
}
fn write(&self, file_name: &str) -> Result<()> {
string_arg!(file_name);
unsafe { sys::cv_Feature2D_write_const_String(self.as_raw_Feature2D(), file_name.as_ptr()) }.into_result()
}
fn read(&mut self, file_name: &str) -> Result<()> {
string_arg!(file_name);
unsafe { sys::cv_Feature2D_read_String(self.as_raw_Feature2D(), file_name.as_ptr()) }.into_result()
}
fn write_1(&self, unnamed_arg: &mut core::FileStorage) -> Result<()> {
unsafe { sys::cv_Feature2D_write_const_FileStorage(self.as_raw_Feature2D(), unnamed_arg.as_raw_FileStorage()) }.into_result()
}
fn read_1(&mut self, unnamed_arg: &core::FileNode) -> Result<()> {
unsafe { sys::cv_Feature2D_read_FileNode(self.as_raw_Feature2D(), unnamed_arg.as_raw_FileNode()) }.into_result()
}
fn empty(&self) -> Result<bool> {
unsafe { sys::cv_Feature2D_empty_const(self.as_raw_Feature2D()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_Feature2D_getDefaultName_const(self.as_raw_Feature2D()) }.into_result().map(crate::templ::receive_string_mut)
}
fn write_2(&self, fs: &types::PtrOfFileStorage, name: &str) -> Result<()> {
string_arg!(name);
unsafe { sys::cv_Feature2D_write_const_PtrOfFileStorage_String(self.as_raw_Feature2D(), fs.as_raw_PtrOfFileStorage(), name.as_ptr()) }.into_result()
}
}
pub struct Feature2D {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Feature2D {
fn drop(&mut self) {
unsafe { sys::cv_Feature2D_delete(self.ptr) };
}
}
impl Feature2D {
#[inline(always)] pub fn as_raw_Feature2D(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Feature2D {}
impl core::AlgorithmTrait for Feature2D {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::features2d::Feature2DTrait for Feature2D {
#[inline(always)] fn as_raw_Feature2D(&self) -> *mut c_void { self.ptr }
}
pub struct FlannBasedMatcher {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for FlannBasedMatcher {
fn drop(&mut self) {
unsafe { sys::cv_FlannBasedMatcher_delete(self.ptr) };
}
}
impl FlannBasedMatcher {
#[inline(always)] pub fn as_raw_FlannBasedMatcher(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for FlannBasedMatcher {}
impl core::AlgorithmTrait for FlannBasedMatcher {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::features2d::DescriptorMatcher for FlannBasedMatcher {
#[inline(always)] fn as_raw_DescriptorMatcher(&self) -> *mut c_void { self.ptr }
}
impl FlannBasedMatcher {
pub fn add(&mut self, descriptors: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(descriptors);
unsafe { sys::cv_FlannBasedMatcher_add__InputArray(self.as_raw_FlannBasedMatcher(), descriptors.as_raw__InputArray()) }.into_result()
}
pub fn clear(&mut self) -> Result<()> {
unsafe { sys::cv_FlannBasedMatcher_clear(self.as_raw_FlannBasedMatcher()) }.into_result()
}
pub fn read(&mut self, unnamed_arg: &core::FileNode) -> Result<()> {
unsafe { sys::cv_FlannBasedMatcher_read_FileNode(self.as_raw_FlannBasedMatcher(), unnamed_arg.as_raw_FileNode()) }.into_result()
}
pub fn write(&self, unnamed_arg: &mut core::FileStorage) -> Result<()> {
unsafe { sys::cv_FlannBasedMatcher_write_const_FileStorage(self.as_raw_FlannBasedMatcher(), unnamed_arg.as_raw_FileStorage()) }.into_result()
}
pub fn train(&mut self) -> Result<()> {
unsafe { sys::cv_FlannBasedMatcher_train(self.as_raw_FlannBasedMatcher()) }.into_result()
}
pub fn is_mask_supported(&self) -> Result<bool> {
unsafe { sys::cv_FlannBasedMatcher_isMaskSupported_const(self.as_raw_FlannBasedMatcher()) }.into_result()
}
pub fn create() -> Result<types::PtrOfFlannBasedMatcher> {
unsafe { sys::cv_FlannBasedMatcher_create() }.into_result().map(|ptr| types::PtrOfFlannBasedMatcher { ptr })
}
pub fn clone(&self, empty_train_data: bool) -> Result<types::PtrOfDescriptorMatcher> {
unsafe { sys::cv_FlannBasedMatcher_clone_const_bool(self.as_raw_FlannBasedMatcher(), empty_train_data) }.into_result().map(|ptr| types::PtrOfDescriptorMatcher { ptr })
}
}
pub trait GFTTDetector: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_GFTTDetector(&self) -> *mut c_void;
fn set_max_features(&mut self, max_features: i32) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setMaxFeatures_int(self.as_raw_GFTTDetector(), max_features) }.into_result()
}
fn get_max_features(&self) -> Result<i32> {
unsafe { sys::cv_GFTTDetector_getMaxFeatures_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn set_quality_level(&mut self, qlevel: f64) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setQualityLevel_double(self.as_raw_GFTTDetector(), qlevel) }.into_result()
}
fn get_quality_level(&self) -> Result<f64> {
unsafe { sys::cv_GFTTDetector_getQualityLevel_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn set_min_distance(&mut self, min_distance: f64) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setMinDistance_double(self.as_raw_GFTTDetector(), min_distance) }.into_result()
}
fn get_min_distance(&self) -> Result<f64> {
unsafe { sys::cv_GFTTDetector_getMinDistance_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn set_block_size(&mut self, block_size: i32) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setBlockSize_int(self.as_raw_GFTTDetector(), block_size) }.into_result()
}
fn get_block_size(&self) -> Result<i32> {
unsafe { sys::cv_GFTTDetector_getBlockSize_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn set_harris_detector(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setHarrisDetector_bool(self.as_raw_GFTTDetector(), val) }.into_result()
}
fn get_harris_detector(&self) -> Result<bool> {
unsafe { sys::cv_GFTTDetector_getHarrisDetector_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn set_k(&mut self, k: f64) -> Result<()> {
unsafe { sys::cv_GFTTDetector_setK_double(self.as_raw_GFTTDetector(), k) }.into_result()
}
fn get_k(&self) -> Result<f64> {
unsafe { sys::cv_GFTTDetector_getK_const(self.as_raw_GFTTDetector()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_GFTTDetector_getDefaultName_const(self.as_raw_GFTTDetector()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn GFTTDetector + '_ {
pub fn create(max_corners: i32, quality_level: f64, min_distance: f64, block_size: i32, use_harris_detector: bool, k: f64) -> Result<types::PtrOfGFTTDetector> {
unsafe { sys::cv_GFTTDetector_create_int_double_double_int_bool_double(max_corners, quality_level, min_distance, block_size, use_harris_detector, k) }.into_result().map(|ptr| types::PtrOfGFTTDetector { ptr })
}
pub fn create_with_gradient(max_corners: i32, quality_level: f64, min_distance: f64, block_size: i32, gradiant_size: i32, use_harris_detector: bool, k: f64) -> Result<types::PtrOfGFTTDetector> {
unsafe { sys::cv_GFTTDetector_create_int_double_double_int_int_bool_double(max_corners, quality_level, min_distance, block_size, gradiant_size, use_harris_detector, k) }.into_result().map(|ptr| types::PtrOfGFTTDetector { ptr })
}
}
pub trait KAZE: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_KAZE(&self) -> *mut c_void;
fn set_extended(&mut self, extended: bool) -> Result<()> {
unsafe { sys::cv_KAZE_setExtended_bool(self.as_raw_KAZE(), extended) }.into_result()
}
fn get_extended(&self) -> Result<bool> {
unsafe { sys::cv_KAZE_getExtended_const(self.as_raw_KAZE()) }.into_result()
}
fn set_upright(&mut self, upright: bool) -> Result<()> {
unsafe { sys::cv_KAZE_setUpright_bool(self.as_raw_KAZE(), upright) }.into_result()
}
fn get_upright(&self) -> Result<bool> {
unsafe { sys::cv_KAZE_getUpright_const(self.as_raw_KAZE()) }.into_result()
}
fn set_threshold(&mut self, threshold: f64) -> Result<()> {
unsafe { sys::cv_KAZE_setThreshold_double(self.as_raw_KAZE(), threshold) }.into_result()
}
fn get_threshold(&self) -> Result<f64> {
unsafe { sys::cv_KAZE_getThreshold_const(self.as_raw_KAZE()) }.into_result()
}
fn set_n_octaves(&mut self, octaves: i32) -> Result<()> {
unsafe { sys::cv_KAZE_setNOctaves_int(self.as_raw_KAZE(), octaves) }.into_result()
}
fn get_n_octaves(&self) -> Result<i32> {
unsafe { sys::cv_KAZE_getNOctaves_const(self.as_raw_KAZE()) }.into_result()
}
fn set_n_octave_layers(&mut self, octave_layers: i32) -> Result<()> {
unsafe { sys::cv_KAZE_setNOctaveLayers_int(self.as_raw_KAZE(), octave_layers) }.into_result()
}
fn get_n_octave_layers(&self) -> Result<i32> {
unsafe { sys::cv_KAZE_getNOctaveLayers_const(self.as_raw_KAZE()) }.into_result()
}
fn set_diffusivity(&mut self, diff: i32) -> Result<()> {
unsafe { sys::cv_KAZE_setDiffusivity_int(self.as_raw_KAZE(), diff) }.into_result()
}
fn get_diffusivity(&self) -> Result<i32> {
unsafe { sys::cv_KAZE_getDiffusivity_const(self.as_raw_KAZE()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_KAZE_getDefaultName_const(self.as_raw_KAZE()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn KAZE + '_ {
pub fn create(extended: bool, upright: bool, threshold: f32, n_octaves: i32, n_octave_layers: i32, diffusivity: i32) -> Result<types::PtrOfKAZE> {
unsafe { sys::cv_KAZE_create_bool_bool_float_int_int_int(extended, upright, threshold, n_octaves, n_octave_layers, diffusivity) }.into_result().map(|ptr| types::PtrOfKAZE { ptr })
}
}
pub struct KeyPointsFilter {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for KeyPointsFilter {
fn drop(&mut self) {
unsafe { sys::cv_KeyPointsFilter_delete(self.ptr) };
}
}
impl KeyPointsFilter {
#[inline(always)] pub fn as_raw_KeyPointsFilter(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for KeyPointsFilter {}
impl KeyPointsFilter {
pub fn default() -> Result<crate::features2d::KeyPointsFilter> {
unsafe { sys::cv_KeyPointsFilter_KeyPointsFilter() }.into_result().map(|ptr| crate::features2d::KeyPointsFilter { ptr })
}
pub fn run_by_image_border(keypoints: &mut types::VectorOfKeyPoint, image_size: core::Size, border_size: i32) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_runByImageBorder_VectorOfKeyPoint_Size_int(keypoints.as_raw_VectorOfKeyPoint(), image_size, border_size) }.into_result()
}
pub fn run_by_keypoint_size(keypoints: &mut types::VectorOfKeyPoint, min_size: f32, max_size: f32) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_runByKeypointSize_VectorOfKeyPoint_float_float(keypoints.as_raw_VectorOfKeyPoint(), min_size, max_size) }.into_result()
}
pub fn run_by_pixels_mask(keypoints: &mut types::VectorOfKeyPoint, mask: &core::Mat) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_runByPixelsMask_VectorOfKeyPoint_Mat(keypoints.as_raw_VectorOfKeyPoint(), mask.as_raw_Mat()) }.into_result()
}
pub fn remove_duplicated(keypoints: &mut types::VectorOfKeyPoint) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_removeDuplicated_VectorOfKeyPoint(keypoints.as_raw_VectorOfKeyPoint()) }.into_result()
}
pub fn remove_duplicated_sorted(keypoints: &mut types::VectorOfKeyPoint) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_removeDuplicatedSorted_VectorOfKeyPoint(keypoints.as_raw_VectorOfKeyPoint()) }.into_result()
}
pub fn retain_best(keypoints: &mut types::VectorOfKeyPoint, npoints: i32) -> Result<()> {
unsafe { sys::cv_KeyPointsFilter_retainBest_VectorOfKeyPoint_int(keypoints.as_raw_VectorOfKeyPoint(), npoints) }.into_result()
}
}
pub trait MSER: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_MSER(&self) -> *mut c_void;
fn detect_regions(&mut self, image: &dyn core::ToInputArray, msers: &mut types::VectorOfVectorOfPoint, bboxes: &mut types::VectorOfRect) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_MSER_detectRegions__InputArray_VectorOfVectorOfPoint_VectorOfRect(self.as_raw_MSER(), image.as_raw__InputArray(), msers.as_raw_VectorOfVectorOfPoint(), bboxes.as_raw_VectorOfRect()) }.into_result()
}
fn set_delta(&mut self, delta: i32) -> Result<()> {
unsafe { sys::cv_MSER_setDelta_int(self.as_raw_MSER(), delta) }.into_result()
}
fn get_delta(&self) -> Result<i32> {
unsafe { sys::cv_MSER_getDelta_const(self.as_raw_MSER()) }.into_result()
}
fn set_min_area(&mut self, min_area: i32) -> Result<()> {
unsafe { sys::cv_MSER_setMinArea_int(self.as_raw_MSER(), min_area) }.into_result()
}
fn get_min_area(&self) -> Result<i32> {
unsafe { sys::cv_MSER_getMinArea_const(self.as_raw_MSER()) }.into_result()
}
fn set_max_area(&mut self, max_area: i32) -> Result<()> {
unsafe { sys::cv_MSER_setMaxArea_int(self.as_raw_MSER(), max_area) }.into_result()
}
fn get_max_area(&self) -> Result<i32> {
unsafe { sys::cv_MSER_getMaxArea_const(self.as_raw_MSER()) }.into_result()
}
fn set_pass2_only(&mut self, f: bool) -> Result<()> {
unsafe { sys::cv_MSER_setPass2Only_bool(self.as_raw_MSER(), f) }.into_result()
}
fn get_pass2_only(&self) -> Result<bool> {
unsafe { sys::cv_MSER_getPass2Only_const(self.as_raw_MSER()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_MSER_getDefaultName_const(self.as_raw_MSER()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn MSER + '_ {
pub fn create(_delta: i32, _min_area: i32, _max_area: i32, _max_variation: f64, _min_diversity: f64, _max_evolution: i32, _area_threshold: f64, _min_margin: f64, _edge_blur_size: i32) -> Result<types::PtrOfMSER> {
unsafe { sys::cv_MSER_create_int_int_int_double_double_int_double_double_int(_delta, _min_area, _max_area, _max_variation, _min_diversity, _max_evolution, _area_threshold, _min_margin, _edge_blur_size) }.into_result().map(|ptr| types::PtrOfMSER { ptr })
}
}
pub trait ORB: crate::features2d::Feature2DTrait {
#[inline(always)] fn as_raw_ORB(&self) -> *mut c_void;
fn set_max_features(&mut self, max_features: i32) -> Result<()> {
unsafe { sys::cv_ORB_setMaxFeatures_int(self.as_raw_ORB(), max_features) }.into_result()
}
fn get_max_features(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getMaxFeatures_const(self.as_raw_ORB()) }.into_result()
}
fn set_scale_factor(&mut self, scale_factor: f64) -> Result<()> {
unsafe { sys::cv_ORB_setScaleFactor_double(self.as_raw_ORB(), scale_factor) }.into_result()
}
fn get_scale_factor(&self) -> Result<f64> {
unsafe { sys::cv_ORB_getScaleFactor_const(self.as_raw_ORB()) }.into_result()
}
fn set_n_levels(&mut self, nlevels: i32) -> Result<()> {
unsafe { sys::cv_ORB_setNLevels_int(self.as_raw_ORB(), nlevels) }.into_result()
}
fn get_n_levels(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getNLevels_const(self.as_raw_ORB()) }.into_result()
}
fn set_edge_threshold(&mut self, edge_threshold: i32) -> Result<()> {
unsafe { sys::cv_ORB_setEdgeThreshold_int(self.as_raw_ORB(), edge_threshold) }.into_result()
}
fn get_edge_threshold(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getEdgeThreshold_const(self.as_raw_ORB()) }.into_result()
}
fn set_first_level(&mut self, first_level: i32) -> Result<()> {
unsafe { sys::cv_ORB_setFirstLevel_int(self.as_raw_ORB(), first_level) }.into_result()
}
fn get_first_level(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getFirstLevel_const(self.as_raw_ORB()) }.into_result()
}
fn set_wta_k(&mut self, wta_k: i32) -> Result<()> {
unsafe { sys::cv_ORB_setWTA_K_int(self.as_raw_ORB(), wta_k) }.into_result()
}
fn get_wta_k(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getWTA_K_const(self.as_raw_ORB()) }.into_result()
}
fn set_score_type(&mut self, score_type: i32) -> Result<()> {
unsafe { sys::cv_ORB_setScoreType_int(self.as_raw_ORB(), score_type) }.into_result()
}
fn get_score_type(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getScoreType_const(self.as_raw_ORB()) }.into_result()
}
fn set_patch_size(&mut self, patch_size: i32) -> Result<()> {
unsafe { sys::cv_ORB_setPatchSize_int(self.as_raw_ORB(), patch_size) }.into_result()
}
fn get_patch_size(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getPatchSize_const(self.as_raw_ORB()) }.into_result()
}
fn set_fast_threshold(&mut self, fast_threshold: i32) -> Result<()> {
unsafe { sys::cv_ORB_setFastThreshold_int(self.as_raw_ORB(), fast_threshold) }.into_result()
}
fn get_fast_threshold(&self) -> Result<i32> {
unsafe { sys::cv_ORB_getFastThreshold_const(self.as_raw_ORB()) }.into_result()
}
fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_ORB_getDefaultName_const(self.as_raw_ORB()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl dyn ORB + '_ {
pub fn create(nfeatures: i32, scale_factor: f32, nlevels: i32, edge_threshold: i32, first_level: i32, wta_k: i32, score_type: i32, patch_size: i32, fast_threshold: i32) -> Result<types::PtrOfORB> {
unsafe { sys::cv_ORB_create_int_float_int_int_int_int_int_int_int(nfeatures, scale_factor, nlevels, edge_threshold, first_level, wta_k, score_type, patch_size, fast_threshold) }.into_result().map(|ptr| types::PtrOfORB { ptr })
}
pub fn default() -> Result<types::PtrOfORB> {
unsafe { sys::cv_ORB_create() }.into_result().map(|ptr| types::PtrOfORB { ptr })
}
}
pub struct SimpleBlobDetector {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SimpleBlobDetector {
fn drop(&mut self) {
unsafe { sys::cv_SimpleBlobDetector_delete(self.ptr) };
}
}
impl SimpleBlobDetector {
#[inline(always)] pub fn as_raw_SimpleBlobDetector(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SimpleBlobDetector {}
impl core::AlgorithmTrait for SimpleBlobDetector {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::features2d::Feature2DTrait for SimpleBlobDetector {
#[inline(always)] fn as_raw_Feature2D(&self) -> *mut c_void { self.ptr }
}
impl SimpleBlobDetector {
pub fn create(parameters: crate::features2d::SimpleBlobDetector_Params) -> Result<types::PtrOfSimpleBlobDetector> {
unsafe { sys::cv_SimpleBlobDetector_create_SimpleBlobDetector_Params(parameters) }.into_result().map(|ptr| types::PtrOfSimpleBlobDetector { ptr })
}
pub fn get_default_name(&self) -> Result<String> {
unsafe { sys::cv_SimpleBlobDetector_getDefaultName_const(self.as_raw_SimpleBlobDetector()) }.into_result().map(crate::templ::receive_string_mut)
}
}
impl SimpleBlobDetector_Params {
pub fn default() -> Result<crate::features2d::SimpleBlobDetector_Params> {
unsafe { sys::cv_SimpleBlobDetector_Params_Params() }.into_result()
}
pub fn read(self, _fn: &core::FileNode) -> Result<()> {
unsafe { sys::cv_SimpleBlobDetector_Params_read_FileNode(self, _fn.as_raw_FileNode()) }.into_result()
}
pub fn write(self, fs: &mut core::FileStorage) -> Result<()> {
unsafe { sys::cv_SimpleBlobDetector_Params_write_const_FileStorage(self, fs.as_raw_FileStorage()) }.into_result()
}
}