opencv 0.22.0

Rust bindings for OpenCV
Documentation
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
//! # Images stitching
//!
//! This figure illustrates the stitching module pipeline implemented in the Stitcher class. Using that
//! class it's possible to configure/remove some steps, i.e. adjust the stitching pipeline according to
//! the particular needs. All building blocks from the pipeline are available in the detail namespace,
//! one can combine and use them separately.
//!
//! The implemented stitching pipeline is very similar to the one proposed in [BL07](https://docs.opencv.org/4.1.1/d0/de3/citelist.html#CITEREF_BL07) .
//!
//! ![stitching pipeline](https://docs.opencv.org/4.1.1/StitchingPipeline.jpg)
//!
//! Camera models
//! -------------
//!
//! There are currently 2 camera models implemented in stitching pipeline.
//!
//! - _Homography model_ expecting perspective transformations between images
//! implemented in @ref cv::detail::BestOf2NearestMatcher cv::detail::HomographyBasedEstimator
//! cv::detail::BundleAdjusterReproj cv::detail::BundleAdjusterRay
//! - _Affine model_ expecting affine transformation with 6 DOF or 4 DOF implemented in
//! @ref cv::detail::AffineBestOf2NearestMatcher cv::detail::AffineBasedEstimator
//! cv::detail::BundleAdjusterAffine cv::detail::BundleAdjusterAffinePartial cv::AffineWarper
//!
//! Homography model is useful for creating photo panoramas captured by camera,
//! while affine-based model can be used to stitch scans and object captured by
//! specialized devices. Use @ref cv::Stitcher::create to get preconfigured pipeline for one
//! of those models.
//!
//!
//! Note:
//! Certain detailed settings of @ref cv::Stitcher might not make sense. Especially
//! you should not mix classes implementing affine model and classes implementing
//! Homography model, as they work with different transformations.
//! # Features Finding and Images Matching
//! # Rotation Estimation
//! # Autocalibration
//! # Images Warping
//! # Seam Estimation
//! # Exposure Compensation
//! # Image Blenders
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 Stitcher_ERR_CAMERA_PARAMS_ADJUST_FAIL: i32 = 3;
pub const Stitcher_ERR_HOMOGRAPHY_EST_FAIL: i32 = 2;
pub const Stitcher_ERR_NEED_MORE_IMGS: i32 = 1;
pub const Stitcher_OK: i32 = 0;
pub const Stitcher_PANORAMA: i32 = 0;
pub const Stitcher_SCANS: i32 = 1;

#[repr(C)]
#[derive(Debug)]
pub enum Stitcher_Mode {
    PANORAMA = Stitcher_PANORAMA as isize,
    SCANS = Stitcher_SCANS as isize,
}

#[repr(C)]
#[derive(Debug)]
pub enum Stitcher_Status {
    OK = Stitcher_OK as isize,
    ERR_NEED_MORE_IMGS = Stitcher_ERR_NEED_MORE_IMGS as isize,
    ERR_HOMOGRAPHY_EST_FAIL = Stitcher_ERR_HOMOGRAPHY_EST_FAIL as isize,
    ERR_CAMERA_PARAMS_ADJUST_FAIL = Stitcher_ERR_CAMERA_PARAMS_ADJUST_FAIL as isize,
}

/// **Deprecated**: use Stitcher::create
///
/// ## C++ default parameters
/// * try_use_gpu: false
#[deprecated = "use Stitcher::create"]
pub fn create_stitcher_scans(try_use_gpu: bool) -> Result<types::PtrOfStitcher> {
    unsafe { sys::cv_createStitcherScans_bool(try_use_gpu) }.into_result().map(|ptr| types::PtrOfStitcher { ptr })
}

/// **Deprecated**: use Stitcher::create
///
/// ## C++ default parameters
/// * try_use_gpu: false
#[deprecated = "use Stitcher::create"]
pub fn create_stitcher(try_use_gpu: bool) -> Result<types::PtrOfStitcher> {
    unsafe { sys::cv_createStitcher_bool(try_use_gpu) }.into_result().map(|ptr| types::PtrOfStitcher { ptr })
}

// boxed class cv::AffineWarper
/// Affine warper factory class.
/// ## See also
/// detail::AffineWarper
pub struct AffineWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::AffineWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_AffineWarper_delete(self.ptr) };
    }
}
impl crate::stitching::AffineWarper {
    #[inline(always)] pub fn as_raw_AffineWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for AffineWarper {}

impl crate::stitching::WarperCreator for AffineWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl AffineWarper {

}

// boxed class cv::CompressedRectilinearPortraitWarper
pub struct CompressedRectilinearPortraitWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::CompressedRectilinearPortraitWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_CompressedRectilinearPortraitWarper_delete(self.ptr) };
    }
}
impl crate::stitching::CompressedRectilinearPortraitWarper {
    #[inline(always)] pub fn as_raw_CompressedRectilinearPortraitWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for CompressedRectilinearPortraitWarper {}

impl crate::stitching::WarperCreator for CompressedRectilinearPortraitWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl CompressedRectilinearPortraitWarper {

    ///
    /// ## C++ default parameters
    /// * a: 1
    /// * b: 1
    pub fn new(a: f32, b: f32) -> Result<crate::stitching::CompressedRectilinearPortraitWarper> {
        unsafe { sys::cv_CompressedRectilinearPortraitWarper_CompressedRectilinearPortraitWarper_float_float(a, b) }.into_result().map(|ptr| crate::stitching::CompressedRectilinearPortraitWarper { ptr })
    }
    
}

// boxed class cv::CompressedRectilinearWarper
pub struct CompressedRectilinearWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::CompressedRectilinearWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_CompressedRectilinearWarper_delete(self.ptr) };
    }
}
impl crate::stitching::CompressedRectilinearWarper {
    #[inline(always)] pub fn as_raw_CompressedRectilinearWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for CompressedRectilinearWarper {}

impl crate::stitching::WarperCreator for CompressedRectilinearWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl CompressedRectilinearWarper {

    ///
    /// ## C++ default parameters
    /// * a: 1
    /// * b: 1
    pub fn new(a: f32, b: f32) -> Result<crate::stitching::CompressedRectilinearWarper> {
        unsafe { sys::cv_CompressedRectilinearWarper_CompressedRectilinearWarper_float_float(a, b) }.into_result().map(|ptr| crate::stitching::CompressedRectilinearWarper { ptr })
    }
    
}

// boxed class cv::CylindricalWarper
/// Cylindrical warper factory class.
/// ## See also
/// detail::CylindricalWarper
pub struct CylindricalWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::CylindricalWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_CylindricalWarper_delete(self.ptr) };
    }
}
impl crate::stitching::CylindricalWarper {
    #[inline(always)] pub fn as_raw_CylindricalWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for CylindricalWarper {}

impl crate::stitching::WarperCreator for CylindricalWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl CylindricalWarper {

}

// boxed class cv::FisheyeWarper
pub struct FisheyeWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::FisheyeWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_FisheyeWarper_delete(self.ptr) };
    }
}
impl crate::stitching::FisheyeWarper {
    #[inline(always)] pub fn as_raw_FisheyeWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for FisheyeWarper {}

impl crate::stitching::WarperCreator for FisheyeWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl FisheyeWarper {

}

// boxed class cv::MercatorWarper
pub struct MercatorWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::MercatorWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_MercatorWarper_delete(self.ptr) };
    }
}
impl crate::stitching::MercatorWarper {
    #[inline(always)] pub fn as_raw_MercatorWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for MercatorWarper {}

impl crate::stitching::WarperCreator for MercatorWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl MercatorWarper {

}

// boxed class cv::PaniniPortraitWarper
pub struct PaniniPortraitWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::PaniniPortraitWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PaniniPortraitWarper_delete(self.ptr) };
    }
}
impl crate::stitching::PaniniPortraitWarper {
    #[inline(always)] pub fn as_raw_PaniniPortraitWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for PaniniPortraitWarper {}

impl crate::stitching::WarperCreator for PaniniPortraitWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl PaniniPortraitWarper {

    ///
    /// ## C++ default parameters
    /// * a: 1
    /// * b: 1
    pub fn new(a: f32, b: f32) -> Result<crate::stitching::PaniniPortraitWarper> {
        unsafe { sys::cv_PaniniPortraitWarper_PaniniPortraitWarper_float_float(a, b) }.into_result().map(|ptr| crate::stitching::PaniniPortraitWarper { ptr })
    }
    
}

// boxed class cv::PaniniWarper
pub struct PaniniWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::PaniniWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PaniniWarper_delete(self.ptr) };
    }
}
impl crate::stitching::PaniniWarper {
    #[inline(always)] pub fn as_raw_PaniniWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for PaniniWarper {}

impl crate::stitching::WarperCreator for PaniniWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl PaniniWarper {

    ///
    /// ## C++ default parameters
    /// * a: 1
    /// * b: 1
    pub fn new(a: f32, b: f32) -> Result<crate::stitching::PaniniWarper> {
        unsafe { sys::cv_PaniniWarper_PaniniWarper_float_float(a, b) }.into_result().map(|ptr| crate::stitching::PaniniWarper { ptr })
    }
    
}

// boxed class cv::PlaneWarper
/// Plane warper factory class.
/// ## See also
/// detail::PlaneWarper
pub struct PlaneWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::PlaneWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PlaneWarper_delete(self.ptr) };
    }
}
impl crate::stitching::PlaneWarper {
    #[inline(always)] pub fn as_raw_PlaneWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for PlaneWarper {}

impl crate::stitching::WarperCreator for PlaneWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl PlaneWarper {

}

// boxed class cv::PyRotationWarper
pub struct PyRotationWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::PyRotationWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PyRotationWarper_delete(self.ptr) };
    }
}
impl crate::stitching::PyRotationWarper {
    #[inline(always)] pub fn as_raw_PyRotationWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for PyRotationWarper {}

impl PyRotationWarper {

    pub fn new(_type: &str, scale: f32) -> Result<crate::stitching::PyRotationWarper> {
        string_arg!(mut _type);
        unsafe { sys::cv_PyRotationWarper_PyRotationWarper_String_float(_type.as_ptr() as _, scale) }.into_result().map(|ptr| crate::stitching::PyRotationWarper { ptr })
    }
    
    pub fn default() -> Result<crate::stitching::PyRotationWarper> {
        unsafe { sys::cv_PyRotationWarper_PyRotationWarper() }.into_result().map(|ptr| crate::stitching::PyRotationWarper { ptr })
    }
    
    /// Projects the image point.
    ///
    /// ## Parameters
    /// * pt: Source point
    /// * K: Camera intrinsic parameters
    /// * R: Camera rotation matrix
    /// ## Returns
    /// Projected point
    pub fn warp_point(&mut self, pt: core::Point2f, k: &dyn core::ToInputArray, r: &dyn core::ToInputArray) -> Result<core::Point2f> {
        input_array_arg!(k);
        input_array_arg!(r);
        unsafe { sys::cv_PyRotationWarper_warpPoint_Point2f__InputArray__InputArray(self.as_raw_PyRotationWarper(), pt, k.as_raw__InputArray(), r.as_raw__InputArray()) }.into_result()
    }
    
    /// Builds the projection maps according to the given camera data.
    ///
    /// ## Parameters
    /// * src_size: Source image size
    /// * K: Camera intrinsic parameters
    /// * R: Camera rotation matrix
    /// * xmap: Projection map for the x axis
    /// * ymap: Projection map for the y axis
    /// ## Returns
    /// Projected image minimum bounding box
    pub fn build_maps(&mut self, src_size: core::Size, k: &dyn core::ToInputArray, r: &dyn core::ToInputArray, xmap: &mut dyn core::ToOutputArray, ymap: &mut dyn core::ToOutputArray) -> Result<core::Rect> {
        input_array_arg!(k);
        input_array_arg!(r);
        output_array_arg!(xmap);
        output_array_arg!(ymap);
        unsafe { sys::cv_PyRotationWarper_buildMaps_Size__InputArray__InputArray__OutputArray__OutputArray(self.as_raw_PyRotationWarper(), src_size, k.as_raw__InputArray(), r.as_raw__InputArray(), xmap.as_raw__OutputArray(), ymap.as_raw__OutputArray()) }.into_result()
    }
    
    /// Projects the image.
    ///
    /// ## Parameters
    /// * src: Source image
    /// * K: Camera intrinsic parameters
    /// * R: Camera rotation matrix
    /// * interp_mode: Interpolation mode
    /// * border_mode: Border extrapolation mode
    /// * dst: Projected image
    /// ## Returns
    /// Project image top-left corner
    pub fn warp(&mut self, src: &dyn core::ToInputArray, k: &dyn core::ToInputArray, r: &dyn core::ToInputArray, interp_mode: i32, border_mode: i32, dst: &mut dyn core::ToOutputArray) -> Result<core::Point> {
        input_array_arg!(src);
        input_array_arg!(k);
        input_array_arg!(r);
        output_array_arg!(dst);
        unsafe { sys::cv_PyRotationWarper_warp__InputArray__InputArray__InputArray_int_int__OutputArray(self.as_raw_PyRotationWarper(), src.as_raw__InputArray(), k.as_raw__InputArray(), r.as_raw__InputArray(), interp_mode, border_mode, dst.as_raw__OutputArray()) }.into_result()
    }
    
    /// Projects the image backward.
    ///
    /// ## Parameters
    /// * src: Projected image
    /// * K: Camera intrinsic parameters
    /// * R: Camera rotation matrix
    /// * interp_mode: Interpolation mode
    /// * border_mode: Border extrapolation mode
    /// * dst_size: Backward-projected image size
    /// * dst: Backward-projected image
    pub fn warp_backward(&mut self, src: &dyn core::ToInputArray, k: &dyn core::ToInputArray, r: &dyn core::ToInputArray, interp_mode: i32, border_mode: i32, dst_size: core::Size, dst: &mut dyn core::ToOutputArray) -> Result<()> {
        input_array_arg!(src);
        input_array_arg!(k);
        input_array_arg!(r);
        output_array_arg!(dst);
        unsafe { sys::cv_PyRotationWarper_warpBackward__InputArray__InputArray__InputArray_int_int_Size__OutputArray(self.as_raw_PyRotationWarper(), src.as_raw__InputArray(), k.as_raw__InputArray(), r.as_raw__InputArray(), interp_mode, border_mode, dst_size, dst.as_raw__OutputArray()) }.into_result()
    }
    
    /// ## Parameters
    /// * src_size: Source image bounding box
    /// * K: Camera intrinsic parameters
    /// * R: Camera rotation matrix
    /// ## Returns
    /// Projected image minimum bounding box
    pub fn warp_roi(&mut self, src_size: core::Size, k: &dyn core::ToInputArray, r: &dyn core::ToInputArray) -> Result<core::Rect> {
        input_array_arg!(k);
        input_array_arg!(r);
        unsafe { sys::cv_PyRotationWarper_warpRoi_Size__InputArray__InputArray(self.as_raw_PyRotationWarper(), src_size, k.as_raw__InputArray(), r.as_raw__InputArray()) }.into_result()
    }
    
    pub fn get_scale(&self) -> Result<f32> {
        unsafe { sys::cv_PyRotationWarper_getScale_const(self.as_raw_PyRotationWarper()) }.into_result()
    }
    
    pub fn set_scale(&mut self, unnamed_arg: f32) -> Result<()> {
        unsafe { sys::cv_PyRotationWarper_setScale_float(self.as_raw_PyRotationWarper(), unnamed_arg) }.into_result()
    }
    
}

// boxed class cv::SphericalWarper
/// Spherical warper factory class
pub struct SphericalWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::SphericalWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_SphericalWarper_delete(self.ptr) };
    }
}
impl crate::stitching::SphericalWarper {
    #[inline(always)] pub fn as_raw_SphericalWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for SphericalWarper {}

impl crate::stitching::WarperCreator for SphericalWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl SphericalWarper {

}

// boxed class cv::StereographicWarper
pub struct StereographicWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::StereographicWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_StereographicWarper_delete(self.ptr) };
    }
}
impl crate::stitching::StereographicWarper {
    #[inline(always)] pub fn as_raw_StereographicWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for StereographicWarper {}

impl crate::stitching::WarperCreator for StereographicWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl StereographicWarper {

}

// boxed class cv::Stitcher
/// High level image stitcher.
///
/// It's possible to use this class without being aware of the entire stitching pipeline. However, to
/// be able to achieve higher stitching stability and quality of the final images at least being
/// familiar with the theory is recommended.
///
///
/// Note:
/// *   A basic example on image stitching can be found at
/// opencv_source_code/samples/cpp/stitching.cpp
/// *   A basic example on image stitching in Python can be found at
/// opencv_source_code/samples/python/stitching.py
/// *   A detailed example on image stitching can be found at
/// opencv_source_code/samples/cpp/stitching_detailed.cpp
pub struct Stitcher {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::Stitcher {
    fn drop(&mut self) {
        unsafe { sys::cv_Stitcher_delete(self.ptr) };
    }
}
impl crate::stitching::Stitcher {
    #[inline(always)] pub fn as_raw_Stitcher(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for Stitcher {}

impl Stitcher {

    /// Creates a Stitcher configured in one of the stitching modes.
    ///
    /// ## Parameters
    /// * mode: Scenario for stitcher operation. This is usually determined by source of images
    /// to stitch and their transformation. Default parameters will be chosen for operation in given
    /// scenario.
    /// ## Returns
    /// Stitcher class instance.
    ///
    /// ## C++ default parameters
    /// * mode: Stitcher::PANORAMA
    pub fn create(mode: crate::stitching::Stitcher_Mode) -> Result<types::PtrOfStitcher> {
        unsafe { sys::cv_Stitcher_create_Stitcher_Mode(mode) }.into_result().map(|ptr| types::PtrOfStitcher { ptr })
    }
    
    pub fn registration_resol(&self) -> Result<f64> {
        unsafe { sys::cv_Stitcher_registrationResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_registration_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_Stitcher_setRegistrationResol_double(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    pub fn seam_estimation_resol(&self) -> Result<f64> {
        unsafe { sys::cv_Stitcher_seamEstimationResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_seam_estimation_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_Stitcher_setSeamEstimationResol_double(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    pub fn compositing_resol(&self) -> Result<f64> {
        unsafe { sys::cv_Stitcher_compositingResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_compositing_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_Stitcher_setCompositingResol_double(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    pub fn pano_confidence_thresh(&self) -> Result<f64> {
        unsafe { sys::cv_Stitcher_panoConfidenceThresh_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_pano_confidence_thresh(&mut self, conf_thresh: f64) -> Result<()> {
        unsafe { sys::cv_Stitcher_setPanoConfidenceThresh_double(self.as_raw_Stitcher(), conf_thresh) }.into_result()
    }
    
    pub fn wave_correction(&self) -> Result<bool> {
        unsafe { sys::cv_Stitcher_waveCorrection_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_wave_correction(&mut self, flag: bool) -> Result<()> {
        unsafe { sys::cv_Stitcher_setWaveCorrection_bool(self.as_raw_Stitcher(), flag) }.into_result()
    }
    
    pub fn interpolation_flags(&self) -> Result<crate::imgproc::InterpolationFlags> {
        unsafe { sys::cv_Stitcher_interpolationFlags_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn set_interpolation_flags(&mut self, interp_flags: crate::imgproc::InterpolationFlags) -> Result<()> {
        unsafe { sys::cv_Stitcher_setInterpolationFlags_InterpolationFlags(self.as_raw_Stitcher(), interp_flags) }.into_result()
    }
    
    pub fn features_finder(&mut self) -> Result<types::PtrOfFeature2D> {
        unsafe { sys::cv_Stitcher_featuresFinder(self.as_raw_Stitcher()) }.into_result().map(|ptr| types::PtrOfFeature2D { ptr })
    }
    
    pub fn features_finder_1(&self) -> Result<types::PtrOfFeature2D> {
        unsafe { sys::cv_Stitcher_featuresFinder_const(self.as_raw_Stitcher()) }.into_result().map(|ptr| types::PtrOfFeature2D { ptr })
    }
    
    pub fn set_features_finder(&mut self, features_finder: &types::PtrOfFeature2D) -> Result<()> {
        unsafe { sys::cv_Stitcher_setFeaturesFinder_PtrOfFeature2D(self.as_raw_Stitcher(), features_finder.as_raw_PtrOfFeature2D()) }.into_result()
    }
    
    pub fn matching_mask(&self) -> Result<core::UMat> {
        unsafe { sys::cv_Stitcher_matchingMask_const(self.as_raw_Stitcher()) }.into_result().map(|ptr| core::UMat { ptr })
    }
    
    pub fn set_matching_mask(&mut self, mask: &core::UMat) -> Result<()> {
        unsafe { sys::cv_Stitcher_setMatchingMask_UMat(self.as_raw_Stitcher(), mask.as_raw_UMat()) }.into_result()
    }
    
    /// These functions try to match the given images and to estimate rotations of each camera.
    ///
    ///
    /// Note: Use the functions only if you're aware of the stitching pipeline, otherwise use
    /// Stitcher::stitch.
    ///
    /// ## Parameters
    /// * images: Input images.
    /// * masks: Masks for each input image specifying where to look for keypoints (optional).
    /// ## Returns
    /// Status code.
    ///
    /// ## C++ default parameters
    /// * masks: noArray()
    pub fn estimate_transform(&mut self, images: &dyn core::ToInputArray, masks: &dyn core::ToInputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        input_array_arg!(masks);
        unsafe { sys::cv_Stitcher_estimateTransform__InputArray__InputArray(self.as_raw_Stitcher(), images.as_raw__InputArray(), masks.as_raw__InputArray()) }.into_result()
    }
    
    pub fn compose_panorama(&mut self, pano: &mut dyn core::ToOutputArray) -> Result<crate::stitching::Stitcher_Status> {
        output_array_arg!(pano);
        unsafe { sys::cv_Stitcher_composePanorama__OutputArray(self.as_raw_Stitcher(), pano.as_raw__OutputArray()) }.into_result()
    }
    
    /// These functions try to compose the given images (or images stored internally from the other function
    /// calls) into the final pano under the assumption that the image transformations were estimated
    /// before.
    ///
    ///
    /// Note: Use the functions only if you're aware of the stitching pipeline, otherwise use
    /// Stitcher::stitch.
    ///
    /// ## Parameters
    /// * images: Input images.
    /// * pano: Final pano.
    /// ## Returns
    /// Status code.
    pub fn compose_panorama_images(&mut self, images: &dyn core::ToInputArray, pano: &mut dyn core::ToOutputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        output_array_arg!(pano);
        unsafe { sys::cv_Stitcher_composePanorama__InputArray__OutputArray(self.as_raw_Stitcher(), images.as_raw__InputArray(), pano.as_raw__OutputArray()) }.into_result()
    }
    
    pub fn stitch(&mut self, images: &dyn core::ToInputArray, pano: &mut dyn core::ToOutputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        output_array_arg!(pano);
        unsafe { sys::cv_Stitcher_stitch__InputArray__OutputArray(self.as_raw_Stitcher(), images.as_raw__InputArray(), pano.as_raw__OutputArray()) }.into_result()
    }
    
    /// These functions try to stitch the given images.
    ///
    /// ## Parameters
    /// * images: Input images.
    /// * masks: Masks for each input image specifying where to look for keypoints (optional).
    /// * pano: Final pano.
    /// ## Returns
    /// Status code.
    pub fn stitch_mask(&mut self, images: &dyn core::ToInputArray, masks: &dyn core::ToInputArray, pano: &mut dyn core::ToOutputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        input_array_arg!(masks);
        output_array_arg!(pano);
        unsafe { sys::cv_Stitcher_stitch__InputArray__InputArray__OutputArray(self.as_raw_Stitcher(), images.as_raw__InputArray(), masks.as_raw__InputArray(), pano.as_raw__OutputArray()) }.into_result()
    }
    
    pub fn component(&self) -> Result<types::VectorOfint> {
        unsafe { sys::cv_Stitcher_component_const(self.as_raw_Stitcher()) }.into_result().map(|ptr| types::VectorOfint { ptr })
    }
    
    pub fn work_scale(&self) -> Result<f64> {
        unsafe { sys::cv_Stitcher_workScale_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    pub fn result_mask(&self) -> Result<core::UMat> {
        unsafe { sys::cv_Stitcher_resultMask_const(self.as_raw_Stitcher()) }.into_result().map(|ptr| core::UMat { ptr })
    }
    
}

// boxed class cv::TransverseMercatorWarper
pub struct TransverseMercatorWarper {
    #[doc(hidden)] pub(crate) ptr: *mut c_void
}

impl Drop for crate::stitching::TransverseMercatorWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_TransverseMercatorWarper_delete(self.ptr) };
    }
}
impl crate::stitching::TransverseMercatorWarper {
    #[inline(always)] pub fn as_raw_TransverseMercatorWarper(&self) -> *mut c_void { self.ptr }

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

unsafe impl Send for TransverseMercatorWarper {}

impl crate::stitching::WarperCreator for TransverseMercatorWarper {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void { self.ptr }
}

impl TransverseMercatorWarper {

}

// Generating impl for trait cv::WarperCreator (trait)
/// Image warper factories base class.
pub trait WarperCreator {
    #[inline(always)] fn as_raw_WarperCreator(&self) -> *mut c_void;
}