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
//! # 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/3.4.8/d0/de3/citelist.html#CITEREF_BL07) .
//!
//! ![stitching pipeline](https://docs.opencv.org/3.4.8/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::{_InputArrayTrait, _OutputArrayTrait};

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_ORIG_RESOL: i32 = -1;
pub const Stitcher_PANORAMA: i32 = 0;
pub const Stitcher_SCANS: i32 = 1;

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

#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
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,
}

///
/// ## C++ default parameters
/// * try_use_gpu: false
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 })
}

///
/// ## C++ default parameters
/// * try_use_gpu: false
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 AffineWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_AffineWarper_delete(self.ptr) };
    }
}

impl 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 }
}

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

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

impl 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 CompressedRectilinearWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_CompressedRectilinearWarper_delete(self.ptr) };
    }
}

impl 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 CylindricalWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_CylindricalWarper_delete(self.ptr) };
    }
}

impl 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 }
}

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

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

impl 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 }
}

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

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

impl 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 }
}

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

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

impl 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 PaniniWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PaniniWarper_delete(self.ptr) };
    }
}

impl 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 PlaneWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_PlaneWarper_delete(self.ptr) };
    }
}

impl 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 }
}

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

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

impl 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 }
}

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

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

impl 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 }
}

// 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 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 Stitcher {
    fn drop(&mut self) {
        unsafe { sys::cv_Stitcher_delete(self.ptr) };
    }
}

impl 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 with the default parameters.
    ///
    /// ## Parameters
    /// * try_use_gpu: Flag indicating whether GPU should be used whenever it's possible.
    /// ## Returns
    /// Stitcher class instance.
    ///
    /// ## C++ default parameters
    /// * try_use_gpu: false
    pub fn create_default(try_use_gpu: bool) -> Result<crate::stitching::Stitcher> {
        unsafe { sys::cv_Stitcher_createDefault_bool(try_use_gpu) }.into_result().map(|ptr| crate::stitching::Stitcher { ptr })
    }
    
    /// 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.
    /// * try_use_gpu: Flag indicating whether GPU should be used whenever it's possible.
    /// ## Returns
    /// Stitcher class instance.
    ///
    /// ## C++ default parameters
    /// * mode: PANORAMA
    /// * try_use_gpu: false
    pub fn create(mode: crate::stitching::Stitcher_Mode, try_use_gpu: bool) -> Result<types::PtrOfStitcher> {
        unsafe { sys::cv_Stitcher_create_Stitcher_Mode_bool(mode, try_use_gpu) }.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 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()
    }
    
    pub fn estimate_transform(&mut self, images: &dyn core::ToInputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        unsafe { sys::cv_Stitcher_estimateTransform__InputArray(self.as_raw_Stitcher(), images.as_raw__InputArray()) }.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.
    /// * rois: Region of interest rectangles.
    /// ## Returns
    /// Status code.
    pub fn estimate_transform_1(&mut self, images: &dyn core::ToInputArray, rois: &types::VectorOfVectorOfRect) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        unsafe { sys::cv_Stitcher_estimateTransform__InputArray_VectorOfVectorOfRect(self.as_raw_Stitcher(), images.as_raw__InputArray(), rois.as_raw_VectorOfVectorOfRect()) }.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.
    /// * rois: Region of interest rectangles.
    /// * pano: Final pano.
    /// ## Returns
    /// Status code.
    pub fn stitch_rois(&mut self, images: &dyn core::ToInputArray, rois: &types::VectorOfVectorOfRect, pano: &mut dyn core::ToOutputArray) -> Result<crate::stitching::Stitcher_Status> {
        input_array_arg!(images);
        output_array_arg!(pano);
        unsafe { sys::cv_Stitcher_stitch__InputArray_VectorOfVectorOfRect__OutputArray(self.as_raw_Stitcher(), images.as_raw__InputArray(), rois.as_raw_VectorOfVectorOfRect(), 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()
    }
    
}

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

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

impl 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 }
}

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