use std::os::raw::{c_char, c_void};
use libc::{ptrdiff_t, size_t};
use crate::{Error, Result, core, sys, types};
use crate::core::{_InputArray, _OutputArray};
pub const DAISY_NRM_FULL: i32 = 102;
pub const DAISY_NRM_NONE: i32 = 100;
pub const DAISY_NRM_PARTIAL: i32 = 101;
pub const DAISY_NRM_SIFT: i32 = 103;
pub const PCTSignatures_GAUSSIAN: i32 = 1;
pub const PCTSignatures_HEURISTIC: i32 = 2;
pub const PCTSignatures_L0_25: i32 = 0;
pub const PCTSignatures_L0_5: i32 = 1;
pub const PCTSignatures_L1: i32 = 2;
pub const PCTSignatures_L2: i32 = 3;
pub const PCTSignatures_L2SQUARED: i32 = 4;
pub const PCTSignatures_L5: i32 = 5;
pub const PCTSignatures_L_INFINITY: i32 = 6;
pub const PCTSignatures_MINUS: i32 = 0;
pub const PCTSignatures_NORMAL: i32 = 2;
pub const PCTSignatures_REGULAR: i32 = 1;
pub const PCTSignatures_UNIFORM: i32 = 0;
#[repr(C)]
#[derive(Debug)]
pub enum DAISY_NormalizationType {
NRM_NONE = DAISY_NRM_NONE as isize,
NRM_PARTIAL = DAISY_NRM_PARTIAL as isize,
NRM_FULL = DAISY_NRM_FULL as isize,
NRM_SIFT = DAISY_NRM_SIFT as isize,
}
pub fn match_gms(size1: core::Size, size2: core::Size, keypoints1: &types::VectorOfKeyPoint, keypoints2: &types::VectorOfKeyPoint, matches1to2: &types::VectorOfDMatch, matches_gms: &mut types::VectorOfDMatch, with_rotation: bool, with_scale: bool, threshold_factor: f64) -> Result<()> {
unsafe { sys::cv_xfeatures2d_matchGMS_Size_Size_VectorOfKeyPoint_VectorOfKeyPoint_VectorOfDMatch_VectorOfDMatch_bool_bool_double(size1, size2, keypoints1.as_raw_VectorOfKeyPoint(), keypoints2.as_raw_VectorOfKeyPoint(), matches1to2.as_raw_VectorOfDMatch(), matches_gms.as_raw_VectorOfDMatch(), with_rotation, with_scale, threshold_factor) }.into_result()
}
pub trait AffineFeature2D: crate::features2d::Feature2D {
#[inline(always)] fn as_raw_AffineFeature2D(&self) -> *mut c_void;
fn detect(&mut self, image: &dyn core::ToInputArray, keypoints: &mut types::VectorOfElliptic_KeyPoint, mask: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(image);
input_array_arg!(mask);
unsafe { sys::cv_xfeatures2d_AffineFeature2D_detect__InputArray_VectorOfElliptic_KeyPoint__InputArray(self.as_raw_AffineFeature2D(), image.as_raw__InputArray(), keypoints.as_raw_VectorOfElliptic_KeyPoint(), mask.as_raw__InputArray()) }.into_result()
}
fn detect_and_compute(&mut self, image: &dyn core::ToInputArray, mask: &dyn core::ToInputArray, keypoints: &mut types::VectorOfElliptic_KeyPoint, 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_xfeatures2d_AffineFeature2D_detectAndCompute__InputArray__InputArray_VectorOfElliptic_KeyPoint__OutputArray_bool(self.as_raw_AffineFeature2D(), image.as_raw__InputArray(), mask.as_raw__InputArray(), keypoints.as_raw_VectorOfElliptic_KeyPoint(), descriptors.as_raw__OutputArray(), use_provided_keypoints) }.into_result()
}
}
impl dyn AffineFeature2D + '_ {
pub fn create_with_extrator(keypoint_detector: &types::PtrOfFeature2D, descriptor_extractor: &types::PtrOfFeature2D) -> Result<types::PtrOfAffineFeature2D> {
unsafe { sys::cv_xfeatures2d_AffineFeature2D_create_PtrOfFeature2D_PtrOfFeature2D(keypoint_detector.as_raw_PtrOfFeature2D(), descriptor_extractor.as_raw_PtrOfFeature2D()) }.into_result().map(|ptr| types::PtrOfAffineFeature2D { ptr })
}
pub fn create(keypoint_detector: &types::PtrOfFeature2D) -> Result<types::PtrOfAffineFeature2D> {
unsafe { sys::cv_xfeatures2d_AffineFeature2D_create_PtrOfFeature2D(keypoint_detector.as_raw_PtrOfFeature2D()) }.into_result().map(|ptr| types::PtrOfAffineFeature2D { ptr })
}
}
pub trait BoostDesc: crate::features2d::Feature2D {
#[inline(always)] fn as_raw_BoostDesc(&self) -> *mut c_void;
fn set_use_scale_orientation(&mut self, use_scale_orientation: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_BoostDesc_setUseScaleOrientation_bool(self.as_raw_BoostDesc(), use_scale_orientation) }.into_result()
}
fn get_use_scale_orientation(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_BoostDesc_getUseScaleOrientation_const(self.as_raw_BoostDesc()) }.into_result()
}
fn set_scale_factor(&mut self, scale_factor: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_BoostDesc_setScaleFactor_float(self.as_raw_BoostDesc(), scale_factor) }.into_result()
}
fn get_scale_factor(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_BoostDesc_getScaleFactor_const(self.as_raw_BoostDesc()) }.into_result()
}
}
impl dyn BoostDesc + '_ {
pub fn create(desc: i32, use_scale_orientation: bool, scale_factor: f32) -> Result<types::PtrOfBoostDesc> {
unsafe { sys::cv_xfeatures2d_BoostDesc_create_int_bool_float(desc, use_scale_orientation, scale_factor) }.into_result().map(|ptr| types::PtrOfBoostDesc { ptr })
}
}
pub struct BriefDescriptorExtractor {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::BriefDescriptorExtractor {
fn drop(&mut self) {
unsafe { sys::cv_BriefDescriptorExtractor_delete(self.ptr) };
}
}
impl crate::xfeatures2d::BriefDescriptorExtractor {
#[inline(always)] pub fn as_raw_BriefDescriptorExtractor(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BriefDescriptorExtractor {}
impl core::Algorithm for BriefDescriptorExtractor {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl BriefDescriptorExtractor {
pub fn create(bytes: i32, use_orientation: bool) -> Result<types::PtrOfBriefDescriptorExtractor> {
unsafe { sys::cv_xfeatures2d_BriefDescriptorExtractor_create_int_bool(bytes, use_orientation) }.into_result().map(|ptr| types::PtrOfBriefDescriptorExtractor { ptr })
}
}
pub trait DAISY: crate::features2d::Feature2D {
#[inline(always)] fn as_raw_DAISY(&self) -> *mut c_void;
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_xfeatures2d_DAISY_compute__InputArray_VectorOfKeyPoint__OutputArray(self.as_raw_DAISY(), image.as_raw__InputArray(), keypoints.as_raw_VectorOfKeyPoint(), descriptors.as_raw__OutputArray()) }.into_result()
}
fn compute_1(&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_xfeatures2d_DAISY_compute__InputArray_VectorOfVectorOfKeyPoint__OutputArray(self.as_raw_DAISY(), images.as_raw__InputArray(), keypoints.as_raw_VectorOfVectorOfKeyPoint(), descriptors.as_raw__OutputArray()) }.into_result()
}
fn compute_2(&mut self, image: &dyn core::ToInputArray, roi: core::Rect, descriptors: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(image);
output_array_arg!(descriptors);
unsafe { sys::cv_xfeatures2d_DAISY_compute__InputArray_Rect__OutputArray(self.as_raw_DAISY(), image.as_raw__InputArray(), roi, descriptors.as_raw__OutputArray()) }.into_result()
}
fn compute_3(&mut self, image: &dyn core::ToInputArray, descriptors: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(image);
output_array_arg!(descriptors);
unsafe { sys::cv_xfeatures2d_DAISY_compute__InputArray__OutputArray(self.as_raw_DAISY(), image.as_raw__InputArray(), descriptors.as_raw__OutputArray()) }.into_result()
}
fn get_descriptor(&self, y: f64, x: f64, orientation: i32, descriptor: &mut f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_DAISY_GetDescriptor_const_double_double_int_float_X(self.as_raw_DAISY(), y, x, orientation, descriptor) }.into_result()
}
fn get_descriptor_1(&self, y: f64, x: f64, orientation: i32, descriptor: &mut f32, h: &mut f64) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_DAISY_GetDescriptor_const_double_double_int_float_X_double_X(self.as_raw_DAISY(), y, x, orientation, descriptor, h) }.into_result()
}
fn get_unnormalized_descriptor(&self, y: f64, x: f64, orientation: i32, descriptor: &mut f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_DAISY_GetUnnormalizedDescriptor_const_double_double_int_float_X(self.as_raw_DAISY(), y, x, orientation, descriptor) }.into_result()
}
fn get_unnormalized_descriptor_1(&self, y: f64, x: f64, orientation: i32, descriptor: &mut f32, h: &mut f64) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_DAISY_GetUnnormalizedDescriptor_const_double_double_int_float_X_double_X(self.as_raw_DAISY(), y, x, orientation, descriptor, h) }.into_result()
}
}
impl dyn DAISY + '_ {
pub fn create(radius: f32, q_radius: i32, q_theta: i32, q_hist: i32, norm: crate::xfeatures2d::DAISY_NormalizationType, h: &dyn core::ToInputArray, interpolation: bool, use_orientation: bool) -> Result<types::PtrOfDAISY> {
input_array_arg!(h);
unsafe { sys::cv_xfeatures2d_DAISY_create_float_int_int_int_DAISY_NormalizationType__InputArray_bool_bool(radius, q_radius, q_theta, q_hist, norm, h.as_raw__InputArray(), interpolation, use_orientation) }.into_result().map(|ptr| types::PtrOfDAISY { ptr })
}
}
pub struct Elliptic_KeyPoint {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::Elliptic_KeyPoint {
fn drop(&mut self) {
unsafe { sys::cv_Elliptic_KeyPoint_delete(self.ptr) };
}
}
impl crate::xfeatures2d::Elliptic_KeyPoint {
#[inline(always)] pub fn as_raw_Elliptic_KeyPoint(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Elliptic_KeyPoint {}
impl Elliptic_KeyPoint {
pub fn default() -> Result<crate::xfeatures2d::Elliptic_KeyPoint> {
unsafe { sys::cv_xfeatures2d_Elliptic_KeyPoint_Elliptic_KeyPoint() }.into_result().map(|ptr| crate::xfeatures2d::Elliptic_KeyPoint { ptr })
}
pub fn new(pt: core::Point2f, angle: f32, axes: core::Size, size: f32, si: f32) -> Result<crate::xfeatures2d::Elliptic_KeyPoint> {
unsafe { sys::cv_xfeatures2d_Elliptic_KeyPoint_Elliptic_KeyPoint_Point2f_float_Size_float_float(pt, angle, axes, size, si) }.into_result().map(|ptr| crate::xfeatures2d::Elliptic_KeyPoint { ptr })
}
}
pub struct FREAK {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::FREAK {
fn drop(&mut self) {
unsafe { sys::cv_FREAK_delete(self.ptr) };
}
}
impl crate::xfeatures2d::FREAK {
#[inline(always)] pub fn as_raw_FREAK(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for FREAK {}
impl core::Algorithm for FREAK {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl FREAK {
pub fn create(orientation_normalized: bool, scale_normalized: bool, pattern_scale: f32, n_octaves: i32, selected_pairs: &types::VectorOfint) -> Result<types::PtrOfFREAK> {
unsafe { sys::cv_xfeatures2d_FREAK_create_bool_bool_float_int_VectorOfint(orientation_normalized, scale_normalized, pattern_scale, n_octaves, selected_pairs.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfFREAK { ptr })
}
}
pub struct HarrisLaplaceFeatureDetector {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::HarrisLaplaceFeatureDetector {
fn drop(&mut self) {
unsafe { sys::cv_HarrisLaplaceFeatureDetector_delete(self.ptr) };
}
}
impl crate::xfeatures2d::HarrisLaplaceFeatureDetector {
#[inline(always)] pub fn as_raw_HarrisLaplaceFeatureDetector(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for HarrisLaplaceFeatureDetector {}
impl core::Algorithm for HarrisLaplaceFeatureDetector {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl HarrisLaplaceFeatureDetector {
pub fn create(num_octaves: i32, corn_thresh: f32, dog_thresh: f32, max_corners: i32, num_layers: i32) -> Result<types::PtrOfHarrisLaplaceFeatureDetector> {
unsafe { sys::cv_xfeatures2d_HarrisLaplaceFeatureDetector_create_int_float_float_int_int(num_octaves, corn_thresh, dog_thresh, max_corners, num_layers) }.into_result().map(|ptr| types::PtrOfHarrisLaplaceFeatureDetector { ptr })
}
}
pub struct LATCH {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::LATCH {
fn drop(&mut self) {
unsafe { sys::cv_LATCH_delete(self.ptr) };
}
}
impl crate::xfeatures2d::LATCH {
#[inline(always)] pub fn as_raw_LATCH(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for LATCH {}
impl core::Algorithm for LATCH {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl LATCH {
pub fn create(bytes: i32, rotation_invariance: bool, half_ssd_size: i32, sigma: f64) -> Result<types::PtrOfLATCH> {
unsafe { sys::cv_xfeatures2d_LATCH_create_int_bool_int_double(bytes, rotation_invariance, half_ssd_size, sigma) }.into_result().map(|ptr| types::PtrOfLATCH { ptr })
}
}
pub struct LUCID {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::LUCID {
fn drop(&mut self) {
unsafe { sys::cv_LUCID_delete(self.ptr) };
}
}
impl crate::xfeatures2d::LUCID {
#[inline(always)] pub fn as_raw_LUCID(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for LUCID {}
impl core::Algorithm for LUCID {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl LUCID {
pub fn create(lucid_kernel: i32, blur_kernel: i32) -> Result<types::PtrOfLUCID> {
unsafe { sys::cv_xfeatures2d_LUCID_create_int_int(lucid_kernel, blur_kernel) }.into_result().map(|ptr| types::PtrOfLUCID { ptr })
}
}
pub struct MSDDetector {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::MSDDetector {
fn drop(&mut self) {
unsafe { sys::cv_MSDDetector_delete(self.ptr) };
}
}
impl crate::xfeatures2d::MSDDetector {
#[inline(always)] pub fn as_raw_MSDDetector(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for MSDDetector {}
impl core::Algorithm for MSDDetector {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl MSDDetector {
pub fn create(m_patch_radius: i32, m_search_area_radius: i32, m_nms_radius: i32, m_nms_scale_radius: i32, m_th_saliency: f32, m_k_nn: i32, m_scale_factor: f32, m_n_scales: i32, m_compute_orientation: bool) -> Result<types::PtrOfMSDDetector> {
unsafe { sys::cv_xfeatures2d_MSDDetector_create_int_int_int_int_float_int_float_int_bool(m_patch_radius, m_search_area_radius, m_nms_radius, m_nms_scale_radius, m_th_saliency, m_k_nn, m_scale_factor, m_n_scales, m_compute_orientation) }.into_result().map(|ptr| types::PtrOfMSDDetector { ptr })
}
}
pub trait PCTSignatures: core::Algorithm {
#[inline(always)] fn as_raw_PCTSignatures(&self) -> *mut c_void;
fn compute_signature(&self, image: &dyn core::ToInputArray, signature: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(image);
output_array_arg!(signature);
unsafe { sys::cv_xfeatures2d_PCTSignatures_computeSignature_const__InputArray__OutputArray(self.as_raw_PCTSignatures(), image.as_raw__InputArray(), signature.as_raw__OutputArray()) }.into_result()
}
fn compute_signatures(&self, images: &types::VectorOfMat, signatures: &mut types::VectorOfMat) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_computeSignatures_const_VectorOfMat_VectorOfMat(self.as_raw_PCTSignatures(), images.as_raw_VectorOfMat(), signatures.as_raw_VectorOfMat()) }.into_result()
}
fn get_sample_count(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getSampleCount_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn get_grayscale_bits(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getGrayscaleBits_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_grayscale_bits(&mut self, grayscale_bits: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setGrayscaleBits_int(self.as_raw_PCTSignatures(), grayscale_bits) }.into_result()
}
fn get_window_radius(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWindowRadius_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_window_radius(&mut self, radius: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWindowRadius_int(self.as_raw_PCTSignatures(), radius) }.into_result()
}
fn get_weight_x(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightX_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_x(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightX_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_y(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightY_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_y(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightY_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_l(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightL_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_l(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightL_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_a(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightA_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_a(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightA_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_b(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightB_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_b(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightB_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_contrast(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightContrast_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_contrast(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightContrast_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_weight_entropy(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getWeightEntropy_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_weight_entropy(&mut self, weight: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeightEntropy_float(self.as_raw_PCTSignatures(), weight) }.into_result()
}
fn get_sampling_points(&self) -> Result<types::VectorOfPoint2f> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getSamplingPoints_const(self.as_raw_PCTSignatures()) }.into_result().map(|ptr| types::VectorOfPoint2f { ptr })
}
fn set_weight(&mut self, idx: i32, value: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeight_int_float(self.as_raw_PCTSignatures(), idx, value) }.into_result()
}
fn set_weights(&mut self, weights: &types::VectorOffloat) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setWeights_VectorOffloat(self.as_raw_PCTSignatures(), weights.as_raw_VectorOffloat()) }.into_result()
}
fn set_translation(&mut self, idx: i32, value: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setTranslation_int_float(self.as_raw_PCTSignatures(), idx, value) }.into_result()
}
fn set_translations(&mut self, translations: &types::VectorOffloat) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setTranslations_VectorOffloat(self.as_raw_PCTSignatures(), translations.as_raw_VectorOffloat()) }.into_result()
}
fn set_sampling_points(&mut self, sampling_points: &types::VectorOfPoint2f) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setSamplingPoints_VectorOfPoint2f(self.as_raw_PCTSignatures(), sampling_points.as_raw_VectorOfPoint2f()) }.into_result()
}
fn get_init_seed_indexes(&self) -> Result<types::VectorOfint> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getInitSeedIndexes_const(self.as_raw_PCTSignatures()) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
fn set_init_seed_indexes(&mut self, init_seed_indexes: &types::VectorOfint) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setInitSeedIndexes_VectorOfint(self.as_raw_PCTSignatures(), init_seed_indexes.as_raw_VectorOfint()) }.into_result()
}
fn get_init_seed_count(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getInitSeedCount_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn get_iteration_count(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getIterationCount_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_iteration_count(&mut self, iteration_count: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setIterationCount_int(self.as_raw_PCTSignatures(), iteration_count) }.into_result()
}
fn get_max_clusters_count(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getMaxClustersCount_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_max_clusters_count(&mut self, max_clusters_count: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setMaxClustersCount_int(self.as_raw_PCTSignatures(), max_clusters_count) }.into_result()
}
fn get_cluster_min_size(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getClusterMinSize_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_cluster_min_size(&mut self, cluster_min_size: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setClusterMinSize_int(self.as_raw_PCTSignatures(), cluster_min_size) }.into_result()
}
fn get_joining_distance(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getJoiningDistance_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_joining_distance(&mut self, joining_distance: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setJoiningDistance_float(self.as_raw_PCTSignatures(), joining_distance) }.into_result()
}
fn get_drop_threshold(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getDropThreshold_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_drop_threshold(&mut self, drop_threshold: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setDropThreshold_float(self.as_raw_PCTSignatures(), drop_threshold) }.into_result()
}
fn get_distance_function(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_getDistanceFunction_const(self.as_raw_PCTSignatures()) }.into_result()
}
fn set_distance_function(&mut self, distance_function: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_setDistanceFunction_int(self.as_raw_PCTSignatures(), distance_function) }.into_result()
}
}
impl dyn PCTSignatures + '_ {
pub fn create(init_sample_count: i32, init_seed_count: i32, point_distribution: i32) -> Result<types::PtrOfPCTSignatures> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_create_int_int_int(init_sample_count, init_seed_count, point_distribution) }.into_result().map(|ptr| types::PtrOfPCTSignatures { ptr })
}
pub fn create_1(init_sampling_points: &types::VectorOfPoint2f, init_seed_count: i32) -> Result<types::PtrOfPCTSignatures> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_create_VectorOfPoint2f_int(init_sampling_points.as_raw_VectorOfPoint2f(), init_seed_count) }.into_result().map(|ptr| types::PtrOfPCTSignatures { ptr })
}
pub fn create_2(init_sampling_points: &types::VectorOfPoint2f, init_cluster_seed_indexes: &types::VectorOfint) -> Result<types::PtrOfPCTSignatures> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_create_VectorOfPoint2f_VectorOfint(init_sampling_points.as_raw_VectorOfPoint2f(), init_cluster_seed_indexes.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfPCTSignatures { ptr })
}
pub fn draw_signature(source: &dyn core::ToInputArray, signature: &dyn core::ToInputArray, result: &mut dyn core::ToOutputArray, radius_to_shorter_side_ratio: f32, border_thickness: i32) -> Result<()> {
input_array_arg!(source);
input_array_arg!(signature);
output_array_arg!(result);
unsafe { sys::cv_xfeatures2d_PCTSignatures_drawSignature__InputArray__InputArray__OutputArray_float_int(source.as_raw__InputArray(), signature.as_raw__InputArray(), result.as_raw__OutputArray(), radius_to_shorter_side_ratio, border_thickness) }.into_result()
}
pub fn generate_init_points(init_points: &mut types::VectorOfPoint2f, count: i32, point_distribution: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignatures_generateInitPoints_VectorOfPoint2f_int_int(init_points.as_raw_VectorOfPoint2f(), count, point_distribution) }.into_result()
}
}
pub trait PCTSignaturesSQFD: core::Algorithm {
#[inline(always)] fn as_raw_PCTSignaturesSQFD(&self) -> *mut c_void;
fn compute_quadratic_form_distance(&self, _signature0: &dyn core::ToInputArray, _signature1: &dyn core::ToInputArray) -> Result<f32> {
input_array_arg!(_signature0);
input_array_arg!(_signature1);
unsafe { sys::cv_xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistance_const__InputArray__InputArray(self.as_raw_PCTSignaturesSQFD(), _signature0.as_raw__InputArray(), _signature1.as_raw__InputArray()) }.into_result()
}
fn compute_quadratic_form_distances(&self, source_signature: &core::Mat, image_signatures: &types::VectorOfMat, distances: &mut types::VectorOffloat) -> Result<()> {
unsafe { sys::cv_xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistances_const_Mat_VectorOfMat_VectorOffloat(self.as_raw_PCTSignaturesSQFD(), source_signature.as_raw_Mat(), image_signatures.as_raw_VectorOfMat(), distances.as_raw_VectorOffloat()) }.into_result()
}
}
impl dyn PCTSignaturesSQFD + '_ {
pub fn create(distance_function: i32, similarity_function: i32, similarity_parameter: f32) -> Result<types::PtrOfPCTSignaturesSQFD> {
unsafe { sys::cv_xfeatures2d_PCTSignaturesSQFD_create_int_int_float(distance_function, similarity_function, similarity_parameter) }.into_result().map(|ptr| types::PtrOfPCTSignaturesSQFD { ptr })
}
}
pub struct SIFT {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::SIFT {
fn drop(&mut self) {
unsafe { sys::cv_SIFT_delete(self.ptr) };
}
}
impl crate::xfeatures2d::SIFT {
#[inline(always)] pub fn as_raw_SIFT(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SIFT {}
impl core::Algorithm for SIFT {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl SIFT {
pub fn create(nfeatures: i32, n_octave_layers: i32, contrast_threshold: f64, edge_threshold: f64, sigma: f64) -> Result<types::PtrOfSIFT> {
unsafe { sys::cv_xfeatures2d_SIFT_create_int_int_double_double_double(nfeatures, n_octave_layers, contrast_threshold, edge_threshold, sigma) }.into_result().map(|ptr| types::PtrOfSIFT { ptr })
}
}
pub trait SURF: crate::features2d::Feature2D {
#[inline(always)] fn as_raw_SURF(&self) -> *mut c_void;
fn set_hessian_threshold(&mut self, hessian_threshold: f64) -> Result<()> {
unsafe { sys::cv_xfeatures2d_SURF_setHessianThreshold_double(self.as_raw_SURF(), hessian_threshold) }.into_result()
}
fn get_hessian_threshold(&self) -> Result<f64> {
unsafe { sys::cv_xfeatures2d_SURF_getHessianThreshold_const(self.as_raw_SURF()) }.into_result()
}
fn set_n_octaves(&mut self, n_octaves: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_SURF_setNOctaves_int(self.as_raw_SURF(), n_octaves) }.into_result()
}
fn get_n_octaves(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_SURF_getNOctaves_const(self.as_raw_SURF()) }.into_result()
}
fn set_n_octave_layers(&mut self, n_octave_layers: i32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_SURF_setNOctaveLayers_int(self.as_raw_SURF(), n_octave_layers) }.into_result()
}
fn get_n_octave_layers(&self) -> Result<i32> {
unsafe { sys::cv_xfeatures2d_SURF_getNOctaveLayers_const(self.as_raw_SURF()) }.into_result()
}
fn set_extended(&mut self, extended: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_SURF_setExtended_bool(self.as_raw_SURF(), extended) }.into_result()
}
fn get_extended(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_SURF_getExtended_const(self.as_raw_SURF()) }.into_result()
}
fn set_upright(&mut self, upright: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_SURF_setUpright_bool(self.as_raw_SURF(), upright) }.into_result()
}
fn get_upright(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_SURF_getUpright_const(self.as_raw_SURF()) }.into_result()
}
}
impl dyn SURF + '_ {
pub fn create(hessian_threshold: f64, n_octaves: i32, n_octave_layers: i32, extended: bool, upright: bool) -> Result<types::PtrOfSURF> {
unsafe { sys::cv_xfeatures2d_SURF_create_double_int_int_bool_bool(hessian_threshold, n_octaves, n_octave_layers, extended, upright) }.into_result().map(|ptr| types::PtrOfSURF { ptr })
}
}
pub struct StarDetector {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::xfeatures2d::StarDetector {
fn drop(&mut self) {
unsafe { sys::cv_StarDetector_delete(self.ptr) };
}
}
impl crate::xfeatures2d::StarDetector {
#[inline(always)] pub fn as_raw_StarDetector(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for StarDetector {}
impl core::Algorithm for StarDetector {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl StarDetector {
pub fn create(max_size: i32, response_threshold: i32, line_threshold_projected: i32, line_threshold_binarized: i32, suppress_nonmax_size: i32) -> Result<types::PtrOfStarDetector> {
unsafe { sys::cv_xfeatures2d_StarDetector_create_int_int_int_int_int(max_size, response_threshold, line_threshold_projected, line_threshold_binarized, suppress_nonmax_size) }.into_result().map(|ptr| types::PtrOfStarDetector { ptr })
}
}
pub trait VGG: crate::features2d::Feature2D {
#[inline(always)] fn as_raw_VGG(&self) -> *mut c_void;
fn set_sigma(&mut self, isigma: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_VGG_setSigma_float(self.as_raw_VGG(), isigma) }.into_result()
}
fn get_sigma(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_VGG_getSigma_const(self.as_raw_VGG()) }.into_result()
}
fn set_use_normalize_image(&mut self, img_normalize: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_VGG_setUseNormalizeImage_bool(self.as_raw_VGG(), img_normalize) }.into_result()
}
fn get_use_normalize_image(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_VGG_getUseNormalizeImage_const(self.as_raw_VGG()) }.into_result()
}
fn set_use_scale_orientation(&mut self, use_scale_orientation: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_VGG_setUseScaleOrientation_bool(self.as_raw_VGG(), use_scale_orientation) }.into_result()
}
fn get_use_scale_orientation(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_VGG_getUseScaleOrientation_const(self.as_raw_VGG()) }.into_result()
}
fn set_scale_factor(&mut self, scale_factor: f32) -> Result<()> {
unsafe { sys::cv_xfeatures2d_VGG_setScaleFactor_float(self.as_raw_VGG(), scale_factor) }.into_result()
}
fn get_scale_factor(&self) -> Result<f32> {
unsafe { sys::cv_xfeatures2d_VGG_getScaleFactor_const(self.as_raw_VGG()) }.into_result()
}
fn set_use_normalize_descriptor(&mut self, dsc_normalize: bool) -> Result<()> {
unsafe { sys::cv_xfeatures2d_VGG_setUseNormalizeDescriptor_bool(self.as_raw_VGG(), dsc_normalize) }.into_result()
}
fn get_use_normalize_descriptor(&self) -> Result<bool> {
unsafe { sys::cv_xfeatures2d_VGG_getUseNormalizeDescriptor_const(self.as_raw_VGG()) }.into_result()
}
}
impl dyn VGG + '_ {
pub fn create(desc: i32, isigma: f32, img_normalize: bool, use_scale_orientation: bool, scale_factor: f32, dsc_normalize: bool) -> Result<types::PtrOfVGG> {
unsafe { sys::cv_xfeatures2d_VGG_create_int_float_bool_bool_float_bool(desc, isigma, img_normalize, use_scale_orientation, scale_factor, dsc_normalize) }.into_result().map(|ptr| types::PtrOfVGG { ptr })
}
}