1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
//! # Shape Distance and Matching
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};


/// Computes the "minimal work" distance between two weighted point configurations base on the papers
/// "EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin
/// Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from
/// Statistics", by Elizaveta Levina and Peter Bickel.
///
/// ## Parameters
/// * signature1: First signature, a single column floating-point matrix. Each row is the value of
/// the histogram in each bin.
/// * signature2: Second signature of the same format and size as signature1.
pub fn emdl1(signature1: &dyn core::ToInputArray, signature2: &dyn core::ToInputArray) -> Result<f32> {
    input_array_arg!(signature1);
    input_array_arg!(signature2);
    unsafe { sys::cv_EMDL1__InputArray__InputArray(signature1.as_raw__InputArray(), signature2.as_raw__InputArray()) }.into_result()
}

/// Complete constructor
pub fn create_affine_transformer(full_affine: bool) -> Result<types::PtrOfAffineTransformer> {
    unsafe { sys::cv_createAffineTransformer_bool(full_affine) }.into_result().map(|ptr| types::PtrOfAffineTransformer { ptr })
}

///
/// ## C++ default parameters
/// * n_dummies: 25
/// * default_cost: 0.2f
pub fn create_chi_histogram_cost_extractor(n_dummies: i32, default_cost: f32) -> Result<types::PtrOfHistogramCostExtractor> {
    unsafe { sys::cv_createChiHistogramCostExtractor_int_float(n_dummies, default_cost) }.into_result().map(|ptr| types::PtrOfHistogramCostExtractor { ptr })
}

///
/// ## C++ default parameters
/// * flag: DIST_L2
/// * n_dummies: 25
/// * default_cost: 0.2f
pub fn create_emd_histogram_cost_extractor(flag: i32, n_dummies: i32, default_cost: f32) -> Result<types::PtrOfHistogramCostExtractor> {
    unsafe { sys::cv_createEMDHistogramCostExtractor_int_int_float(flag, n_dummies, default_cost) }.into_result().map(|ptr| types::PtrOfHistogramCostExtractor { ptr })
}

///
/// ## C++ default parameters
/// * n_dummies: 25
/// * default_cost: 0.2f
pub fn create_emdl1_histogram_cost_extractor(n_dummies: i32, default_cost: f32) -> Result<types::PtrOfHistogramCostExtractor> {
    unsafe { sys::cv_createEMDL1HistogramCostExtractor_int_float(n_dummies, default_cost) }.into_result().map(|ptr| types::PtrOfHistogramCostExtractor { ptr })
}

///
/// ## C++ default parameters
/// * distance_flag: cv::NORM_L2
/// * rank_prop: 0.6f
pub fn create_hausdorff_distance_extractor(distance_flag: i32, rank_prop: f32) -> Result<types::PtrOfHausdorffDistanceExtractor> {
    unsafe { sys::cv_createHausdorffDistanceExtractor_int_float(distance_flag, rank_prop) }.into_result().map(|ptr| types::PtrOfHausdorffDistanceExtractor { ptr })
}

///
/// ## C++ default parameters
/// * flag: DIST_L2
/// * n_dummies: 25
/// * default_cost: 0.2f
pub fn create_norm_histogram_cost_extractor(flag: i32, n_dummies: i32, default_cost: f32) -> Result<types::PtrOfHistogramCostExtractor> {
    unsafe { sys::cv_createNormHistogramCostExtractor_int_int_float(flag, n_dummies, default_cost) }.into_result().map(|ptr| types::PtrOfHistogramCostExtractor { ptr })
}

/// Complete constructor
///
/// ## C++ default parameters
/// * regularization_parameter: 0
pub fn create_thin_plate_spline_shape_transformer(regularization_parameter: f64) -> Result<types::PtrOfThinPlateSplineShapeTransformer> {
    unsafe { sys::cv_createThinPlateSplineShapeTransformer_double(regularization_parameter) }.into_result().map(|ptr| types::PtrOfThinPlateSplineShapeTransformer { ptr })
}

// Generating impl for trait crate::shape::AffineTransformer
/// Wrapper class for the OpenCV Affine Transformation algorithm. :
pub trait AffineTransformer: crate::shape::ShapeTransformer {
    #[inline(always)] fn as_raw_AffineTransformer(&self) -> *mut c_void;
    fn set_full_affine(&mut self, full_affine: bool) -> Result<()> {
        unsafe { sys::cv_AffineTransformer_setFullAffine_bool(self.as_raw_AffineTransformer(), full_affine) }.into_result()
    }
    
    fn get_full_affine(&self) -> Result<bool> {
        unsafe { sys::cv_AffineTransformer_getFullAffine_const(self.as_raw_AffineTransformer()) }.into_result()
    }
    
}

// boxed class cv::ChiHistogramCostExtractor
/// An Chi based cost extraction. :
pub struct ChiHistogramCostExtractor {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for ChiHistogramCostExtractor {
    fn drop(&mut self) {
        unsafe { sys::cv_ChiHistogramCostExtractor_delete(self.ptr) };
    }
}

impl ChiHistogramCostExtractor {
    #[inline(always)] pub fn as_raw_ChiHistogramCostExtractor(&self) -> *mut c_void { self.ptr }

    pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
        Self { ptr }
    }
}

unsafe impl Send for ChiHistogramCostExtractor {}

impl core::AlgorithmTrait for ChiHistogramCostExtractor {
    #[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}

impl crate::shape::HistogramCostExtractor for ChiHistogramCostExtractor {
    #[inline(always)] fn as_raw_HistogramCostExtractor(&self) -> *mut c_void { self.ptr }
}

// Generating impl for trait crate::shape::EMDHistogramCostExtractor
/// An EMD based cost extraction. :
pub trait EMDHistogramCostExtractor: crate::shape::HistogramCostExtractor {
    #[inline(always)] fn as_raw_EMDHistogramCostExtractor(&self) -> *mut c_void;
    fn set_norm_flag(&mut self, flag: i32) -> Result<()> {
        unsafe { sys::cv_EMDHistogramCostExtractor_setNormFlag_int(self.as_raw_EMDHistogramCostExtractor(), flag) }.into_result()
    }
    
    fn get_norm_flag(&self) -> Result<i32> {
        unsafe { sys::cv_EMDHistogramCostExtractor_getNormFlag_const(self.as_raw_EMDHistogramCostExtractor()) }.into_result()
    }
    
}

// boxed class cv::EMDL1HistogramCostExtractor
/// An EMD-L1 based cost extraction. :
pub struct EMDL1HistogramCostExtractor {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for EMDL1HistogramCostExtractor {
    fn drop(&mut self) {
        unsafe { sys::cv_EMDL1HistogramCostExtractor_delete(self.ptr) };
    }
}

impl EMDL1HistogramCostExtractor {
    #[inline(always)] pub fn as_raw_EMDL1HistogramCostExtractor(&self) -> *mut c_void { self.ptr }

    pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
        Self { ptr }
    }
}

unsafe impl Send for EMDL1HistogramCostExtractor {}

impl core::AlgorithmTrait for EMDL1HistogramCostExtractor {
    #[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}

impl crate::shape::HistogramCostExtractor for EMDL1HistogramCostExtractor {
    #[inline(always)] fn as_raw_HistogramCostExtractor(&self) -> *mut c_void { self.ptr }
}

// Generating impl for trait crate::shape::HausdorffDistanceExtractor
/// A simple Hausdorff distance measure between shapes defined by contours
///
/// according to the paper "Comparing Images using the Hausdorff distance." by D.P. Huttenlocher, G.A.
/// Klanderman, and W.J. Rucklidge. (PAMI 1993). :
pub trait HausdorffDistanceExtractor: crate::shape::ShapeDistanceExtractor {
    #[inline(always)] fn as_raw_HausdorffDistanceExtractor(&self) -> *mut c_void;
    /// Set the norm used to compute the Hausdorff value between two shapes. It can be L1 or L2 norm.
    ///
    /// ## Parameters
    /// * distanceFlag: Flag indicating which norm is used to compute the Hausdorff distance
    /// (NORM_L1, NORM_L2).
    fn set_distance_flag(&mut self, distance_flag: i32) -> Result<()> {
        unsafe { sys::cv_HausdorffDistanceExtractor_setDistanceFlag_int(self.as_raw_HausdorffDistanceExtractor(), distance_flag) }.into_result()
    }
    
    fn get_distance_flag(&self) -> Result<i32> {
        unsafe { sys::cv_HausdorffDistanceExtractor_getDistanceFlag_const(self.as_raw_HausdorffDistanceExtractor()) }.into_result()
    }
    
    /// This method sets the rank proportion (or fractional value) that establish the Kth ranked value of
    /// the partial Hausdorff distance. Experimentally had been shown that 0.6 is a good value to compare
    /// shapes.
    ///
    /// ## Parameters
    /// * rankProportion: fractional value (between 0 and 1).
    fn set_rank_proportion(&mut self, rank_proportion: f32) -> Result<()> {
        unsafe { sys::cv_HausdorffDistanceExtractor_setRankProportion_float(self.as_raw_HausdorffDistanceExtractor(), rank_proportion) }.into_result()
    }
    
    fn get_rank_proportion(&self) -> Result<f32> {
        unsafe { sys::cv_HausdorffDistanceExtractor_getRankProportion_const(self.as_raw_HausdorffDistanceExtractor()) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::HistogramCostExtractor
/// Abstract base class for histogram cost algorithms.
pub trait HistogramCostExtractor: core::AlgorithmTrait {
    #[inline(always)] fn as_raw_HistogramCostExtractor(&self) -> *mut c_void;
    fn build_cost_matrix(&mut self, descriptors1: &dyn core::ToInputArray, descriptors2: &dyn core::ToInputArray, cost_matrix: &mut dyn core::ToOutputArray) -> Result<()> {
        input_array_arg!(descriptors1);
        input_array_arg!(descriptors2);
        output_array_arg!(cost_matrix);
        unsafe { sys::cv_HistogramCostExtractor_buildCostMatrix__InputArray__InputArray__OutputArray(self.as_raw_HistogramCostExtractor(), descriptors1.as_raw__InputArray(), descriptors2.as_raw__InputArray(), cost_matrix.as_raw__OutputArray()) }.into_result()
    }
    
    fn set_n_dummies(&mut self, n_dummies: i32) -> Result<()> {
        unsafe { sys::cv_HistogramCostExtractor_setNDummies_int(self.as_raw_HistogramCostExtractor(), n_dummies) }.into_result()
    }
    
    fn get_n_dummies(&self) -> Result<i32> {
        unsafe { sys::cv_HistogramCostExtractor_getNDummies_const(self.as_raw_HistogramCostExtractor()) }.into_result()
    }
    
    fn set_default_cost(&mut self, default_cost: f32) -> Result<()> {
        unsafe { sys::cv_HistogramCostExtractor_setDefaultCost_float(self.as_raw_HistogramCostExtractor(), default_cost) }.into_result()
    }
    
    fn get_default_cost(&self) -> Result<f32> {
        unsafe { sys::cv_HistogramCostExtractor_getDefaultCost_const(self.as_raw_HistogramCostExtractor()) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::NormHistogramCostExtractor
/// A norm based cost extraction. :
pub trait NormHistogramCostExtractor: crate::shape::HistogramCostExtractor {
    #[inline(always)] fn as_raw_NormHistogramCostExtractor(&self) -> *mut c_void;
    fn set_norm_flag(&mut self, flag: i32) -> Result<()> {
        unsafe { sys::cv_NormHistogramCostExtractor_setNormFlag_int(self.as_raw_NormHistogramCostExtractor(), flag) }.into_result()
    }
    
    fn get_norm_flag(&self) -> Result<i32> {
        unsafe { sys::cv_NormHistogramCostExtractor_getNormFlag_const(self.as_raw_NormHistogramCostExtractor()) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::ShapeContextDistanceExtractor
/// Implementation of the Shape Context descriptor and matching algorithm
///
/// proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" (PAMI
/// 2002). This implementation is packaged in a generic scheme, in order to allow you the
/// implementation of the common variations of the original pipeline.
pub trait ShapeContextDistanceExtractor: crate::shape::ShapeDistanceExtractor {
    #[inline(always)] fn as_raw_ShapeContextDistanceExtractor(&self) -> *mut c_void;
    /// Establish the number of angular bins for the Shape Context Descriptor used in the shape matching
    /// pipeline.
    ///
    /// ## Parameters
    /// * nAngularBins: The number of angular bins in the shape context descriptor.
    fn set_angular_bins(&mut self, n_angular_bins: i32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setAngularBins_int(self.as_raw_ShapeContextDistanceExtractor(), n_angular_bins) }.into_result()
    }
    
    fn get_angular_bins(&self) -> Result<i32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getAngularBins_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Establish the number of radial bins for the Shape Context Descriptor used in the shape matching
    /// pipeline.
    ///
    /// ## Parameters
    /// * nRadialBins: The number of radial bins in the shape context descriptor.
    fn set_radial_bins(&mut self, n_radial_bins: i32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setRadialBins_int(self.as_raw_ShapeContextDistanceExtractor(), n_radial_bins) }.into_result()
    }
    
    fn get_radial_bins(&self) -> Result<i32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getRadialBins_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the inner radius of the shape context descriptor.
    ///
    /// ## Parameters
    /// * innerRadius: The value of the inner radius.
    fn set_inner_radius(&mut self, inner_radius: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setInnerRadius_float(self.as_raw_ShapeContextDistanceExtractor(), inner_radius) }.into_result()
    }
    
    fn get_inner_radius(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getInnerRadius_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the outer radius of the shape context descriptor.
    ///
    /// ## Parameters
    /// * outerRadius: The value of the outer radius.
    fn set_outer_radius(&mut self, outer_radius: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setOuterRadius_float(self.as_raw_ShapeContextDistanceExtractor(), outer_radius) }.into_result()
    }
    
    fn get_outer_radius(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getOuterRadius_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    fn set_rotation_invariant(&mut self, rotation_invariant: bool) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setRotationInvariant_bool(self.as_raw_ShapeContextDistanceExtractor(), rotation_invariant) }.into_result()
    }
    
    fn get_rotation_invariant(&self) -> Result<bool> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getRotationInvariant_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the weight of the shape context distance in the final value of the shape distance. The shape
    /// context distance between two shapes is defined as the symmetric sum of shape context matching costs
    /// over best matching points. The final value of the shape distance is a user-defined linear
    /// combination of the shape context distance, an image appearance distance, and a bending energy.
    ///
    /// ## Parameters
    /// * shapeContextWeight: The weight of the shape context distance in the final distance value.
    fn set_shape_context_weight(&mut self, shape_context_weight: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setShapeContextWeight_float(self.as_raw_ShapeContextDistanceExtractor(), shape_context_weight) }.into_result()
    }
    
    fn get_shape_context_weight(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getShapeContextWeight_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the weight of the Image Appearance cost in the final value of the shape distance. The image
    /// appearance cost is defined as the sum of squared brightness differences in Gaussian windows around
    /// corresponding image points. The final value of the shape distance is a user-defined linear
    /// combination of the shape context distance, an image appearance distance, and a bending energy. If
    /// this value is set to a number different from 0, is mandatory to set the images that correspond to
    /// each shape.
    ///
    /// ## Parameters
    /// * imageAppearanceWeight: The weight of the appearance cost in the final distance value.
    fn set_image_appearance_weight(&mut self, image_appearance_weight: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setImageAppearanceWeight_float(self.as_raw_ShapeContextDistanceExtractor(), image_appearance_weight) }.into_result()
    }
    
    fn get_image_appearance_weight(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getImageAppearanceWeight_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the weight of the Bending Energy in the final value of the shape distance. The bending energy
    /// definition depends on what transformation is being used to align the shapes. The final value of the
    /// shape distance is a user-defined linear combination of the shape context distance, an image
    /// appearance distance, and a bending energy.
    ///
    /// ## Parameters
    /// * bendingEnergyWeight: The weight of the Bending Energy in the final distance value.
    fn set_bending_energy_weight(&mut self, bending_energy_weight: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setBendingEnergyWeight_float(self.as_raw_ShapeContextDistanceExtractor(), bending_energy_weight) }.into_result()
    }
    
    fn get_bending_energy_weight(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getBendingEnergyWeight_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the images that correspond to each shape. This images are used in the calculation of the Image
    /// Appearance cost.
    ///
    /// ## Parameters
    /// * image1: Image corresponding to the shape defined by contours1.
    /// * image2: Image corresponding to the shape defined by contours2.
    fn set_images(&mut self, image1: &dyn core::ToInputArray, image2: &dyn core::ToInputArray) -> Result<()> {
        input_array_arg!(image1);
        input_array_arg!(image2);
        unsafe { sys::cv_ShapeContextDistanceExtractor_setImages__InputArray__InputArray(self.as_raw_ShapeContextDistanceExtractor(), image1.as_raw__InputArray(), image2.as_raw__InputArray()) }.into_result()
    }
    
    fn get_images(&self, image1: &mut dyn core::ToOutputArray, image2: &mut dyn core::ToOutputArray) -> Result<()> {
        output_array_arg!(image1);
        output_array_arg!(image2);
        unsafe { sys::cv_ShapeContextDistanceExtractor_getImages_const__OutputArray__OutputArray(self.as_raw_ShapeContextDistanceExtractor(), image1.as_raw__OutputArray(), image2.as_raw__OutputArray()) }.into_result()
    }
    
    fn set_iterations(&mut self, iterations: i32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setIterations_int(self.as_raw_ShapeContextDistanceExtractor(), iterations) }.into_result()
    }
    
    fn get_iterations(&self) -> Result<i32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getIterations_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
    /// Set the algorithm used for building the shape context descriptor cost matrix.
    ///
    /// ## Parameters
    /// * comparer: Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost
    /// matrix between descriptors.
    fn set_cost_extractor(&mut self, comparer: &types::PtrOfHistogramCostExtractor) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setCostExtractor_PtrOfHistogramCostExtractor(self.as_raw_ShapeContextDistanceExtractor(), comparer.as_raw_PtrOfHistogramCostExtractor()) }.into_result()
    }
    
    fn get_cost_extractor(&self) -> Result<types::PtrOfHistogramCostExtractor> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getCostExtractor_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result().map(|ptr| types::PtrOfHistogramCostExtractor { ptr })
    }
    
    /// Set the value of the standard deviation for the Gaussian window for the image appearance cost.
    ///
    /// ## Parameters
    /// * sigma: Standard Deviation.
    fn set_std_dev(&mut self, sigma: f32) -> Result<()> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_setStdDev_float(self.as_raw_ShapeContextDistanceExtractor(), sigma) }.into_result()
    }
    
    fn get_std_dev(&self) -> Result<f32> {
        unsafe { sys::cv_ShapeContextDistanceExtractor_getStdDev_const(self.as_raw_ShapeContextDistanceExtractor()) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::ShapeDistanceExtractor
/// Abstract base class for shape distance algorithms.
pub trait ShapeDistanceExtractor: core::AlgorithmTrait {
    #[inline(always)] fn as_raw_ShapeDistanceExtractor(&self) -> *mut c_void;
    /// Compute the shape distance between two shapes defined by its contours.
    ///
    /// ## Parameters
    /// * contour1: Contour defining first shape.
    /// * contour2: Contour defining second shape.
    fn compute_distance(&mut self, contour1: &dyn core::ToInputArray, contour2: &dyn core::ToInputArray) -> Result<f32> {
        input_array_arg!(contour1);
        input_array_arg!(contour2);
        unsafe { sys::cv_ShapeDistanceExtractor_computeDistance__InputArray__InputArray(self.as_raw_ShapeDistanceExtractor(), contour1.as_raw__InputArray(), contour2.as_raw__InputArray()) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::ShapeTransformer
/// Abstract base class for shape transformation algorithms.
pub trait ShapeTransformer: core::AlgorithmTrait {
    #[inline(always)] fn as_raw_ShapeTransformer(&self) -> *mut c_void;
    /// Estimate the transformation parameters of the current transformer algorithm, based on point matches.
    ///
    /// ## Parameters
    /// * transformingShape: Contour defining first shape.
    /// * targetShape: Contour defining second shape (Target).
    /// * matches: Standard vector of Matches between points.
    fn estimate_transformation(&mut self, transforming_shape: &dyn core::ToInputArray, target_shape: &dyn core::ToInputArray, matches: &mut types::VectorOfDMatch) -> Result<()> {
        input_array_arg!(transforming_shape);
        input_array_arg!(target_shape);
        unsafe { sys::cv_ShapeTransformer_estimateTransformation__InputArray__InputArray_VectorOfDMatch(self.as_raw_ShapeTransformer(), transforming_shape.as_raw__InputArray(), target_shape.as_raw__InputArray(), matches.as_raw_VectorOfDMatch()) }.into_result()
    }
    
    /// Apply a transformation, given a pre-estimated transformation parameters.
    ///
    /// ## Parameters
    /// * input: Contour (set of points) to apply the transformation.
    /// * output: Output contour.
    ///
    /// ## C++ default parameters
    /// * output: noArray()
    fn apply_transformation(&mut self, input: &dyn core::ToInputArray, output: &mut dyn core::ToOutputArray) -> Result<f32> {
        input_array_arg!(input);
        output_array_arg!(output);
        unsafe { sys::cv_ShapeTransformer_applyTransformation__InputArray__OutputArray(self.as_raw_ShapeTransformer(), input.as_raw__InputArray(), output.as_raw__OutputArray()) }.into_result()
    }
    
    /// Apply a transformation, given a pre-estimated transformation parameters, to an Image.
    ///
    /// ## Parameters
    /// * transformingImage: Input image.
    /// * output: Output image.
    /// * flags: Image interpolation method.
    /// * borderMode: border style.
    /// * borderValue: border value.
    ///
    /// ## C++ default parameters
    /// * flags: INTER_LINEAR
    /// * border_mode: BORDER_CONSTANT
    /// * border_value: Scalar()
    fn warp_image(&self, transforming_image: &dyn core::ToInputArray, output: &mut dyn core::ToOutputArray, flags: i32, border_mode: i32, border_value: core::Scalar) -> Result<()> {
        input_array_arg!(transforming_image);
        output_array_arg!(output);
        unsafe { sys::cv_ShapeTransformer_warpImage_const__InputArray__OutputArray_int_int_Scalar(self.as_raw_ShapeTransformer(), transforming_image.as_raw__InputArray(), output.as_raw__OutputArray(), flags, border_mode, border_value) }.into_result()
    }
    
}

// Generating impl for trait crate::shape::ThinPlateSplineShapeTransformer
/// Definition of the transformation
///
/// occupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by
/// F.L. Bookstein (PAMI 1989). :
pub trait ThinPlateSplineShapeTransformer: crate::shape::ShapeTransformer {
    #[inline(always)] fn as_raw_ThinPlateSplineShapeTransformer(&self) -> *mut c_void;
    /// Set the regularization parameter for relaxing the exact interpolation requirements of the TPS
    /// algorithm.
    ///
    /// ## Parameters
    /// * beta: value of the regularization parameter.
    fn set_regularization_parameter(&mut self, beta: f64) -> Result<()> {
        unsafe { sys::cv_ThinPlateSplineShapeTransformer_setRegularizationParameter_double(self.as_raw_ThinPlateSplineShapeTransformer(), beta) }.into_result()
    }
    
    fn get_regularization_parameter(&self) -> Result<f64> {
        unsafe { sys::cv_ThinPlateSplineShapeTransformer_getRegularizationParameter_const(self.as_raw_ThinPlateSplineShapeTransformer()) }.into_result()
    }
    
}