opencv 0.5.3

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
//! <script type="text/javascript" src="http://latex.codecogs.com/latexit.js"></script>
//! Images stitching
//! 
//! # 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 @cite BL07 .
//! 
//! ![stitching pipeline](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
//! 
//! # Features Finding and Images Matching
//! Rotation Estimation
//! 
//! # Rotation Estimation
//! Autocalibration
//! 
//! # Autocalibration
//! Images Warping
//! 
//! # Images Warping
//! Seam Estimation
//! 
//! # Seam Estimation
//! Exposure Compensation
//! 
//! # Exposure Compensation
//! Image Blenders
//! 
//! # Image Blenders
//! @}
use std::os::raw::{c_char, c_void};
use libc::size_t;
use crate::{Error, Result, core, sys, types};

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;

// identifier: cv_createStitcherScans_bool_try_use_gpu
///
/// ## C++ default parameters:
/// * try_use_gpu: false
pub fn create_stitcher_scans(try_use_gpu: bool) -> Result<types::PtrOfStitcher> {
    unsafe { sys::cv_stitching_cv_createStitcherScans_bool_try_use_gpu(try_use_gpu) }.into_result().map(|x| types::PtrOfStitcher { ptr: x })
}

// identifier: cv_createStitcher_bool_try_use_gpu
///
/// ## C++ default parameters:
/// * try_use_gpu: false
pub fn create_stitcher(try_use_gpu: bool) -> Result<types::PtrOfStitcher> {
    unsafe { sys::cv_stitching_cv_createStitcher_bool_try_use_gpu(try_use_gpu) }.into_result().map(|x| types::PtrOfStitcher { ptr: x })
}

// boxed class cv::AffineWarper
/// Affine warper factory class.
/// @sa detail::AffineWarper
#[allow(dead_code)]
pub struct AffineWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::AffineWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_AffineWarper(self.ptr) };
    }
}
impl crate::stitching::AffineWarper {
    #[doc(hidden)] pub fn as_raw_AffineWarper(&self) -> *mut c_void { self.ptr }
}

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

impl AffineWarper {

}

// boxed class cv::CompressedRectilinearPortraitWarper
#[allow(dead_code)]
pub struct CompressedRectilinearPortraitWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::CompressedRectilinearPortraitWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_CompressedRectilinearPortraitWarper(self.ptr) };
    }
}
impl crate::stitching::CompressedRectilinearPortraitWarper {
    #[doc(hidden)] pub fn as_raw_CompressedRectilinearPortraitWarper(&self) -> *mut c_void { self.ptr }
}

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

impl CompressedRectilinearPortraitWarper {

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

// boxed class cv::CompressedRectilinearWarper
#[allow(dead_code)]
pub struct CompressedRectilinearWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::CompressedRectilinearWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_CompressedRectilinearWarper(self.ptr) };
    }
}
impl crate::stitching::CompressedRectilinearWarper {
    #[doc(hidden)] pub fn as_raw_CompressedRectilinearWarper(&self) -> *mut c_void { self.ptr }
}

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

impl CompressedRectilinearWarper {

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

// boxed class cv::CylindricalWarper
/// Cylindrical warper factory class.
/// @sa detail::CylindricalWarper
#[allow(dead_code)]
pub struct CylindricalWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::CylindricalWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_CylindricalWarper(self.ptr) };
    }
}
impl crate::stitching::CylindricalWarper {
    #[doc(hidden)] pub fn as_raw_CylindricalWarper(&self) -> *mut c_void { self.ptr }
}

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

impl CylindricalWarper {

}

// boxed class cv::FisheyeWarper
#[allow(dead_code)]
pub struct FisheyeWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::FisheyeWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_FisheyeWarper(self.ptr) };
    }
}
impl crate::stitching::FisheyeWarper {
    #[doc(hidden)] pub fn as_raw_FisheyeWarper(&self) -> *mut c_void { self.ptr }
}

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

impl FisheyeWarper {

}

// boxed class cv::MercatorWarper
#[allow(dead_code)]
pub struct MercatorWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::MercatorWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_MercatorWarper(self.ptr) };
    }
}
impl crate::stitching::MercatorWarper {
    #[doc(hidden)] pub fn as_raw_MercatorWarper(&self) -> *mut c_void { self.ptr }
}

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

impl MercatorWarper {

}

// boxed class cv::PaniniPortraitWarper
#[allow(dead_code)]
pub struct PaniniPortraitWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::PaniniPortraitWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_PaniniPortraitWarper(self.ptr) };
    }
}
impl crate::stitching::PaniniPortraitWarper {
    #[doc(hidden)] pub fn as_raw_PaniniPortraitWarper(&self) -> *mut c_void { self.ptr }
}

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

impl PaniniPortraitWarper {

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

// boxed class cv::PaniniWarper
#[allow(dead_code)]
pub struct PaniniWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::PaniniWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_PaniniWarper(self.ptr) };
    }
}
impl crate::stitching::PaniniWarper {
    #[doc(hidden)] pub fn as_raw_PaniniWarper(&self) -> *mut c_void { self.ptr }
}

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

impl PaniniWarper {

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

// boxed class cv::PlaneWarper
/// Plane warper factory class.
/// @sa detail::PlaneWarper
#[allow(dead_code)]
pub struct PlaneWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::PlaneWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_PlaneWarper(self.ptr) };
    }
}
impl crate::stitching::PlaneWarper {
    #[doc(hidden)] pub fn as_raw_PlaneWarper(&self) -> *mut c_void { self.ptr }
}

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

impl PlaneWarper {

}

// boxed class cv::SphericalWarper
/// Spherical warper factory class
#[allow(dead_code)]
pub struct SphericalWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::SphericalWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_SphericalWarper(self.ptr) };
    }
}
impl crate::stitching::SphericalWarper {
    #[doc(hidden)] pub fn as_raw_SphericalWarper(&self) -> *mut c_void { self.ptr }
}

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

impl SphericalWarper {

}

// boxed class cv::StereographicWarper
#[allow(dead_code)]
pub struct StereographicWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::StereographicWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_StereographicWarper(self.ptr) };
    }
}
impl crate::stitching::StereographicWarper {
    #[doc(hidden)] pub fn as_raw_StereographicWarper(&self) -> *mut c_void { self.ptr }
}

impl crate::stitching::WarperCreator for StereographicWarper {
    #[doc(hidden)] 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 detailed example on image stitching can be found at
/// opencv_source_code/samples/cpp/stitching_detailed.cpp
#[allow(dead_code)]
pub struct Stitcher {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::Stitcher {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_Stitcher(self.ptr) };
    }
}
impl crate::stitching::Stitcher {
    #[doc(hidden)] pub fn as_raw_Stitcher(&self) -> *mut c_void { self.ptr }
}

impl Stitcher {

    // identifier: cv_Stitcher_createDefault_bool_try_use_gpu
    /// Creates a stitcher with the default parameters.
    /// 
    /// ## Parameters
    /// * try_use_gpu: Flag indicating whether GPU should be used whenever it's possible.
    /// @return 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_stitching_cv_Stitcher_createDefault_bool_try_use_gpu(try_use_gpu) }.into_result().map(|x| crate::stitching::Stitcher { ptr: x })
    }
    
    // identifier: cv_Stitcher_registrationResol_const
    pub fn registration_resol(&self) -> Result<f64> {
        unsafe { sys::cv_stitching_cv_Stitcher_registrationResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    // identifier: cv_Stitcher_setRegistrationResol_double_resol_mpx
    pub fn set_registration_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_stitching_cv_Stitcher_setRegistrationResol_double_resol_mpx(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    // identifier: cv_Stitcher_seamEstimationResol_const
    pub fn seam_estimation_resol(&self) -> Result<f64> {
        unsafe { sys::cv_stitching_cv_Stitcher_seamEstimationResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    // identifier: cv_Stitcher_setSeamEstimationResol_double_resol_mpx
    pub fn set_seam_estimation_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_stitching_cv_Stitcher_setSeamEstimationResol_double_resol_mpx(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    // identifier: cv_Stitcher_compositingResol_const
    pub fn compositing_resol(&self) -> Result<f64> {
        unsafe { sys::cv_stitching_cv_Stitcher_compositingResol_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    // identifier: cv_Stitcher_setCompositingResol_double_resol_mpx
    pub fn set_compositing_resol(&mut self, resol_mpx: f64) -> Result<()> {
        unsafe { sys::cv_stitching_cv_Stitcher_setCompositingResol_double_resol_mpx(self.as_raw_Stitcher(), resol_mpx) }.into_result()
    }
    
    // identifier: cv_Stitcher_panoConfidenceThresh_const
    pub fn pano_confidence_thresh(&self) -> Result<f64> {
        unsafe { sys::cv_stitching_cv_Stitcher_panoConfidenceThresh_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    // identifier: cv_Stitcher_setPanoConfidenceThresh_double_conf_thresh
    pub fn set_pano_confidence_thresh(&mut self, conf_thresh: f64) -> Result<()> {
        unsafe { sys::cv_stitching_cv_Stitcher_setPanoConfidenceThresh_double_conf_thresh(self.as_raw_Stitcher(), conf_thresh) }.into_result()
    }
    
    // identifier: cv_Stitcher_waveCorrection_const
    pub fn wave_correction(&self) -> Result<bool> {
        unsafe { sys::cv_stitching_cv_Stitcher_waveCorrection_const(self.as_raw_Stitcher()) }.into_result()
    }
    
    // identifier: cv_Stitcher_setWaveCorrection_bool_flag
    pub fn set_wave_correction(&mut self, flag: bool) -> Result<()> {
        unsafe { sys::cv_stitching_cv_Stitcher_setWaveCorrection_bool_flag(self.as_raw_Stitcher(), flag) }.into_result()
    }
    
    // identifier: cv_Stitcher_component_const
    pub fn component(&self) -> Result<types::VectorOfint> {
        unsafe { sys::cv_stitching_cv_Stitcher_component_const(self.as_raw_Stitcher()) }.into_result().map(|x| types::VectorOfint { ptr: x })
    }
    
    // identifier: cv_Stitcher_workScale_const
    pub fn work_scale(&self) -> Result<f64> {
        unsafe { sys::cv_stitching_cv_Stitcher_workScale_const(self.as_raw_Stitcher()) }.into_result()
    }
    
}

// boxed class cv::TransverseMercatorWarper
#[allow(dead_code)]
pub struct TransverseMercatorWarper {
    #[doc(hidden)] pub ptr: *mut c_void
}
impl Drop for crate::stitching::TransverseMercatorWarper {
    fn drop(&mut self) {
        unsafe { sys::cv_delete_TransverseMercatorWarper(self.ptr) };
    }
}
impl crate::stitching::TransverseMercatorWarper {
    #[doc(hidden)] pub fn as_raw_TransverseMercatorWarper(&self) -> *mut c_void { self.ptr }
}

impl crate::stitching::WarperCreator for TransverseMercatorWarper {
    #[doc(hidden)] 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 {
    #[doc(hidden)] fn as_raw_WarperCreator(&self) -> *mut c_void;
}

impl<'a> WarperCreator + 'a {

}