forked from twistedfall/opencv-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrgbd.rs
6426 lines (5611 loc) · 247 KB
/
rgbd.rs
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
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
pub mod rgbd {
//! # RGB-Depth Processing
//!
//! [kinfu_icp]
use crate::{mod_prelude::*, core, sys, types};
pub mod prelude {
pub use { super::Linemod_TemplateTraitConst, super::Linemod_TemplateTrait, super::Linemod_QuantizedPyramidConst, super::Linemod_QuantizedPyramid, super::Linemod_ModalityConst, super::Linemod_Modality, super::Linemod_ColorGradientTraitConst, super::Linemod_ColorGradientTrait, super::Linemod_DepthNormalTraitConst, super::Linemod_DepthNormalTrait, super::Linemod_MatchTraitConst, super::Linemod_MatchTrait, super::Linemod_DetectorTraitConst, super::Linemod_DetectorTrait, super::RgbdNormalsTraitConst, super::RgbdNormalsTrait, super::DepthCleanerTraitConst, super::DepthCleanerTrait, super::RgbdPlaneTraitConst, super::RgbdPlaneTrait, super::RgbdFrameTraitConst, super::RgbdFrameTrait, super::OdometryFrameTraitConst, super::OdometryFrameTrait, super::OdometryConst, super::Odometry, super::RgbdOdometryTraitConst, super::RgbdOdometryTrait, super::ICPOdometryTraitConst, super::ICPOdometryTrait, super::RgbdICPOdometryTraitConst, super::RgbdICPOdometryTrait, super::FastICPOdometryTraitConst, super::FastICPOdometryTrait, super::Kinfu_VolumeConst, super::Kinfu_Volume, super::Kinfu_VolumeParamsTraitConst, super::Kinfu_VolumeParamsTrait, super::Kinfu_ParamsTraitConst, super::Kinfu_ParamsTrait, super::Kinfu_KinFuConst, super::Kinfu_KinFu, super::Dynafu_DynaFuConst, super::Dynafu_DynaFu, super::ParamsTraitConst, super::ParamsTrait, super::LargeKinfuConst, super::LargeKinfu, super::Kinfu_Detail_PoseGraphConst, super::Kinfu_Detail_PoseGraph, super::ColoredKinfu_ParamsTraitConst, super::ColoredKinfu_ParamsTrait, super::ColoredKinfu_ColoredKinFuConst, super::ColoredKinfu_ColoredKinFu };
}
pub const Kinfu_VolumeType_COLOREDTSDF: i32 = 2;
pub const Kinfu_VolumeType_HASHTSDF: i32 = 1;
pub const Kinfu_VolumeType_TSDF: i32 = 0;
pub const OdometryFrame_CACHE_ALL: i32 = 3;
pub const OdometryFrame_CACHE_DST: i32 = 2;
pub const OdometryFrame_CACHE_SRC: i32 = 1;
pub const Odometry_RIGID_BODY_MOTION: i32 = 4;
pub const Odometry_ROTATION: i32 = 1;
pub const Odometry_TRANSLATION: i32 = 2;
/// NIL method is from
/// ``Modeling Kinect Sensor Noise for Improved 3d Reconstruction and Tracking``
/// by C. Nguyen, S. Izadi, D. Lovel
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum DepthCleaner_DEPTH_CLEANER_METHOD {
DEPTH_CLEANER_NIL = 0,
}
opencv_type_enum! { crate::rgbd::DepthCleaner_DEPTH_CLEANER_METHOD }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Kinfu_VolumeType {
TSDF = 0,
HASHTSDF = 1,
COLOREDTSDF = 2,
}
opencv_type_enum! { crate::rgbd::Kinfu_VolumeType }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum RgbdNormals_RGBD_NORMALS_METHOD {
RGBD_NORMALS_METHOD_FALS = 0,
RGBD_NORMALS_METHOD_LINEMOD = 1,
RGBD_NORMALS_METHOD_SRI = 2,
}
opencv_type_enum! { crate::rgbd::RgbdNormals_RGBD_NORMALS_METHOD }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum RgbdPlane_RGBD_PLANE_METHOD {
RGBD_PLANE_METHOD_DEFAULT = 0,
}
opencv_type_enum! { crate::rgbd::RgbdPlane_RGBD_PLANE_METHOD }
/// Backwards compatibility for old versions
pub type Dynafu_Params = crate::rgbd::Kinfu_Params;
#[inline]
pub fn make_volume(_volume_type: crate::rgbd::Kinfu_VolumeType, _voxel_size: f32, _pose: core::Matx44f, _raycast_step_factor: f32, _trunc_dist: f32, _max_weight: i32, _truncate_threshold: f32, _resolution: core::Vec3i) -> Result<core::Ptr<dyn crate::rgbd::Kinfu_Volume>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_kinfu_makeVolume_VolumeType_float_Matx44f_float_float_int_float_Vec3i(_volume_type, _voxel_size, _pose.opencv_as_extern(), _raycast_step_factor, _trunc_dist, _max_weight, _truncate_threshold, _resolution.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<dyn crate::rgbd::Kinfu_Volume>::opencv_from_extern(ret) };
Ok(ret)
}
/// \brief Debug function to colormap a quantized image for viewing.
#[inline]
pub fn colormap(quantized: &core::Mat, dst: &mut core::Mat) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_linemod_colormap_const_MatR_MatR(quantized.as_raw_Mat(), dst.as_raw_mut_Mat(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// \brief Debug function to draw linemod features
/// ## Parameters
/// * img:
/// * templates: see [Detector::addTemplate]
/// * tl: template bbox top-left offset see [Detector::addTemplate]
/// * size: marker size see [cv::drawMarker]
///
/// ## C++ default parameters
/// * size: 10
#[inline]
pub fn draw_features(img: &mut dyn core::ToInputOutputArray, templates: &core::Vector<crate::rgbd::Linemod_Template>, tl: core::Point2i, size: i32) -> Result<()> {
extern_container_arg!(img);
return_send!(via ocvrs_return);
unsafe { sys::cv_linemod_drawFeatures_const__InputOutputArrayR_const_vectorLTemplateGR_const_Point2iR_int(img.as_raw__InputOutputArray(), templates.as_raw_VectorOfLinemod_Template(), &tl, size, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// \brief Factory function for detector using LINE algorithm with color gradients.
///
/// Default parameter settings suitable for VGA images.
#[inline]
pub fn get_default_line() -> Result<core::Ptr<crate::rgbd::Linemod_Detector>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_linemod_getDefaultLINE(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::rgbd::Linemod_Detector>::opencv_from_extern(ret) };
Ok(ret)
}
/// \brief Factory function for detector using LINE-MOD algorithm with color gradients
/// and depth normals.
///
/// Default parameter settings suitable for VGA images.
#[inline]
pub fn get_default_linemod() -> Result<core::Ptr<crate::rgbd::Linemod_Detector>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_linemod_getDefaultLINEMOD(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::rgbd::Linemod_Detector>::opencv_from_extern(ret) };
Ok(ret)
}
/// ## Parameters
/// * depth: the depth image
/// * in_K:
/// * in_points: the list of xy coordinates
/// * points3d: the resulting 3d points
#[inline]
pub fn depth_to3d_sparse(depth: &dyn core::ToInputArray, in_k: &dyn core::ToInputArray, in_points: &dyn core::ToInputArray, points3d: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(depth);
extern_container_arg!(in_k);
extern_container_arg!(in_points);
extern_container_arg!(points3d);
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_depthTo3dSparse_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__OutputArrayR(depth.as_raw__InputArray(), in_k.as_raw__InputArray(), in_points.as_raw__InputArray(), points3d.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Converts a depth image to an organized set of 3d points.
/// The coordinate system is x pointing left, y down and z away from the camera
/// ## Parameters
/// * depth: the depth image (if given as short int CV_U, it is assumed to be the depth in millimeters
/// (as done with the Microsoft Kinect), otherwise, if given as CV_32F or CV_64F, it is assumed in meters)
/// * K: The calibration matrix
/// * points3d: the resulting 3d points. They are of depth the same as `depth` if it is CV_32F or CV_64F, and the
/// depth of `K` if `depth` is of depth CV_U
/// * mask: the mask of the points to consider (can be empty)
///
/// ## C++ default parameters
/// * mask: noArray()
#[inline]
pub fn depth_to3d(depth: &dyn core::ToInputArray, k: &dyn core::ToInputArray, points3d: &mut dyn core::ToOutputArray, mask: &dyn core::ToInputArray) -> Result<()> {
extern_container_arg!(depth);
extern_container_arg!(k);
extern_container_arg!(points3d);
extern_container_arg!(mask);
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_depthTo3d_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__InputArrayR(depth.as_raw__InputArray(), k.as_raw__InputArray(), points3d.as_raw__OutputArray(), mask.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn is_valid_depth_1(depth: &f64) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_doubleR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Checks if the value is a valid depth. For CV_16U or CV_16S, the convention is to be invalid if it is
/// a limit. For a float/double, we just check if it is a NaN
/// ## Parameters
/// * depth: the depth to check for validity
#[inline]
pub fn is_valid_depth(depth: &f32) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_floatR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn is_valid_depth_4(depth: &i32) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_intR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn is_valid_depth_2(depth: &i16) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_shortR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn is_valid_depth_5(depth: &u32) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_unsigned_intR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn is_valid_depth_3(depth: &u16) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_isValidDepth_const_unsigned_shortR(depth, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Registers depth data to an external camera
/// Registration is performed by creating a depth cloud, transforming the cloud by
/// the rigid body transformation between the cameras, and then projecting the
/// transformed points into the RGB camera.
///
/// uv_rgb = K_rgb * [R | t] * z * inv(K_ir) * uv_ir
///
/// Currently does not check for negative depth values.
///
/// ## Parameters
/// * unregisteredCameraMatrix: the camera matrix of the depth camera
/// * registeredCameraMatrix: the camera matrix of the external camera
/// * registeredDistCoeffs: the distortion coefficients of the external camera
/// * Rt: the rigid body transform between the cameras. Transforms points from depth camera frame to external camera frame.
/// * unregisteredDepth: the input depth data
/// * outputImagePlaneSize: the image plane dimensions of the external camera (width, height)
/// * registeredDepth: the result of transforming the depth into the external camera
/// * depthDilation: whether or not the depth is dilated to avoid holes and occlusion errors (optional)
///
/// ## C++ default parameters
/// * depth_dilation: false
#[inline]
pub fn register_depth(unregistered_camera_matrix: &dyn core::ToInputArray, registered_camera_matrix: &dyn core::ToInputArray, registered_dist_coeffs: &dyn core::ToInputArray, rt: &dyn core::ToInputArray, unregistered_depth: &dyn core::ToInputArray, output_image_plane_size: core::Size, registered_depth: &mut dyn core::ToOutputArray, depth_dilation: bool) -> Result<()> {
extern_container_arg!(unregistered_camera_matrix);
extern_container_arg!(registered_camera_matrix);
extern_container_arg!(registered_dist_coeffs);
extern_container_arg!(rt);
extern_container_arg!(unregistered_depth);
extern_container_arg!(registered_depth);
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_registerDepth_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const_SizeR_const__OutputArrayR_bool(unregistered_camera_matrix.as_raw__InputArray(), registered_camera_matrix.as_raw__InputArray(), registered_dist_coeffs.as_raw__InputArray(), rt.as_raw__InputArray(), unregistered_depth.as_raw__InputArray(), &output_image_plane_size, registered_depth.as_raw__OutputArray(), depth_dilation, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// If the input image is of type CV_16UC1 (like the Kinect one), the image is converted to floats, divided
/// by depth_factor to get a depth in meters, and the values 0 are converted to std::numeric_limits<float>::quiet_NaN()
/// Otherwise, the image is simply converted to floats
/// ## Parameters
/// * in: the depth image (if given as short int CV_U, it is assumed to be the depth in millimeters
/// (as done with the Microsoft Kinect), it is assumed in meters)
/// * depth: the desired output depth (floats or double)
/// * out: The rescaled float depth image
/// * depth_factor: (optional) factor by which depth is converted to distance (by default = 1000.0 for Kinect sensor)
///
/// ## C++ default parameters
/// * depth_factor: 1000.0
#[inline]
pub fn rescale_depth(in_: &dyn core::ToInputArray, depth: i32, out: &mut dyn core::ToOutputArray, depth_factor: f64) -> Result<()> {
extern_container_arg!(in_);
extern_container_arg!(out);
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_rescaleDepth_const__InputArrayR_int_const__OutputArrayR_double(in_.as_raw__InputArray(), depth, out.as_raw__OutputArray(), depth_factor, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Warp the image: compute 3d points from the depth, transform them using given transformation,
/// then project color point cloud to an image plane.
/// This function can be used to visualize results of the Odometry algorithm.
/// ## Parameters
/// * image: The image (of CV_8UC1 or CV_8UC3 type)
/// * depth: The depth (of type used in depthTo3d fuction)
/// * mask: The mask of used pixels (of CV_8UC1), it can be empty
/// * Rt: The transformation that will be applied to the 3d points computed from the depth
/// * cameraMatrix: Camera matrix
/// * distCoeff: Distortion coefficients
/// * warpedImage: The warped image.
/// * warpedDepth: The warped depth.
/// * warpedMask: The warped mask.
///
/// ## C++ default parameters
/// * warped_depth: noArray()
/// * warped_mask: noArray()
#[inline]
pub fn warp_frame(image: &core::Mat, depth: &core::Mat, mask: &core::Mat, rt: &core::Mat, camera_matrix: &core::Mat, dist_coeff: &core::Mat, warped_image: &mut dyn core::ToOutputArray, warped_depth: &mut dyn core::ToOutputArray, warped_mask: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(warped_image);
extern_container_arg!(warped_depth);
extern_container_arg!(warped_mask);
return_send!(via ocvrs_return);
unsafe { sys::cv_rgbd_warpFrame_const_MatR_const_MatR_const_MatR_const_MatR_const_MatR_const_MatR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(image.as_raw_Mat(), depth.as_raw_Mat(), mask.as_raw_Mat(), rt.as_raw_Mat(), camera_matrix.as_raw_Mat(), dist_coeff.as_raw_Mat(), warped_image.as_raw__OutputArray(), warped_depth.as_raw__OutputArray(), warped_mask.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Constant methods for [crate::rgbd::ColoredKinfu_ColoredKinFu]
pub trait ColoredKinfu_ColoredKinFuConst {
fn as_raw_ColoredKinfu_ColoredKinFu(&self) -> *const c_void;
/// Get current parameters
#[inline]
fn get_params(&self) -> Result<crate::rgbd::ColoredKinfu_Params> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_getParams_const(self.as_raw_ColoredKinfu_ColoredKinFu(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::rgbd::ColoredKinfu_Params::opencv_from_extern(ret) };
Ok(ret)
}
/// Renders a volume into an image
///
/// Renders a 0-surface of TSDF using Phong shading into a CV_8UC4 Mat.
/// Light pose is fixed in KinFu params.
///
/// ## Parameters
/// * image: resulting image
#[inline]
fn render(&self, image: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(image);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_render_const_const__OutputArrayR(self.as_raw_ColoredKinfu_ColoredKinFu(), image.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders a volume into an image
///
/// Renders a 0-surface of TSDF using Phong shading into a CV_8UC4 Mat.
/// Light pose is fixed in KinFu params.
///
/// ## Parameters
/// * image: resulting image
/// * cameraPose: pose of camera to render from. If empty then render from current pose
/// which is a last frame camera pose.
#[inline]
fn render_1(&self, image: &mut dyn core::ToOutputArray, camera_pose: core::Matx44f) -> Result<()> {
extern_container_arg!(image);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_render_const_const__OutputArrayR_const_Matx44fR(self.as_raw_ColoredKinfu_ColoredKinFu(), image.as_raw__OutputArray(), &camera_pose, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Gets points, normals and colors of current 3d mesh
///
/// The order of normals corresponds to order of points.
/// The order of points is undefined.
///
/// ## Parameters
/// * points: vector of points which are 4-float vectors
/// * normals: vector of normals which are 4-float vectors
/// * colors: vector of colors which are 4-float vectors
///
/// ## C++ default parameters
/// * colors: noArray()
#[inline]
fn get_cloud(&self, points: &mut dyn core::ToOutputArray, normals: &mut dyn core::ToOutputArray, colors: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(points);
extern_container_arg!(normals);
extern_container_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_getCloud_const_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_ColoredKinfu_ColoredKinFu(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), colors.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Gets points of current 3d mesh
///
/// The order of points is undefined.
///
/// ## Parameters
/// * points: vector of points which are 4-float vectors
#[inline]
fn get_points(&self, points: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(points);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_getPoints_const_const__OutputArrayR(self.as_raw_ColoredKinfu_ColoredKinFu(), points.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculates normals for given points
/// ## Parameters
/// * points: input vector of points which are 4-float vectors
/// * normals: output vector of corresponding normals which are 4-float vectors
#[inline]
fn get_normals(&self, points: &dyn core::ToInputArray, normals: &mut dyn core::ToOutputArray) -> Result<()> {
extern_container_arg!(points);
extern_container_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_getNormals_const_const__InputArrayR_const__OutputArrayR(self.as_raw_ColoredKinfu_ColoredKinFu(), points.as_raw__InputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get current pose in voxel space
#[inline]
fn get_pose(&self) -> Result<core::Affine3f> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_getPose_const(self.as_raw_ColoredKinfu_ColoredKinFu(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// KinectFusion implementation
///
/// This class implements a 3d reconstruction algorithm described in
/// [kinectfusion](https://docs.opencv.org/4.7.0/d0/de3/citelist.html#CITEREF_kinectfusion) paper.
///
/// It takes a sequence of depth images taken from depth sensor
/// (or any depth images source such as stereo camera matching algorithm or even raymarching renderer).
/// The output can be obtained as a vector of points and their normals
/// or can be Phong-rendered from given camera pose.
///
/// An internal representation of a model is a voxel cuboid that keeps TSDF values
/// which are a sort of distances to the surface (for details read the [kinectfusion](https://docs.opencv.org/4.7.0/d0/de3/citelist.html#CITEREF_kinectfusion) article about TSDF).
/// There is no interface to that representation yet.
///
/// KinFu uses OpenCL acceleration automatically if available.
/// To enable or disable it explicitly use cv::setUseOptimized() or cv::ocl::setUseOpenCL().
///
/// This implementation is based on [kinfu-remake](https://github.com/Nerei/kinfu_remake).
///
/// Note that the KinectFusion algorithm was patented and its use may be restricted by
/// the list of patents mentioned in README.md file in this module directory.
///
/// That's why you need to set the OPENCV_ENABLE_NONFREE option in CMake to use KinectFusion.
pub trait ColoredKinfu_ColoredKinFu: crate::rgbd::ColoredKinfu_ColoredKinFuConst {
fn as_raw_mut_ColoredKinfu_ColoredKinFu(&mut self) -> *mut c_void;
/// Resets the algorithm
///
/// Clears current model and resets a pose.
#[inline]
fn reset(&mut self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_reset(self.as_raw_mut_ColoredKinfu_ColoredKinFu(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Process next depth frame
/// ## Parameters
/// * depth: input Mat of depth frame
/// * rgb: input Mat of rgb (colored) frame
///
/// ## Returns
/// true if succeeded to align new frame with current scene, false if opposite
#[inline]
fn update(&mut self, depth: &dyn core::ToInputArray, rgb: &dyn core::ToInputArray) -> Result<bool> {
extern_container_arg!(depth);
extern_container_arg!(rgb);
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_update_const__InputArrayR_const__InputArrayR(self.as_raw_mut_ColoredKinfu_ColoredKinFu(), depth.as_raw__InputArray(), rgb.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl dyn ColoredKinfu_ColoredKinFu + '_ {
#[inline]
pub fn create(_params: &core::Ptr<crate::rgbd::ColoredKinfu_Params>) -> Result<core::Ptr<dyn crate::rgbd::ColoredKinfu_ColoredKinFu>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_ColoredKinFu_create_const_PtrLParamsGR(_params.as_raw_PtrOfColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<dyn crate::rgbd::ColoredKinfu_ColoredKinFu>::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::rgbd::ColoredKinfu_Params]
pub trait ColoredKinfu_ParamsTraitConst {
fn as_raw_ColoredKinfu_Params(&self) -> *const c_void;
/// frame size in pixels
#[inline]
fn frame_size(&self) -> core::Size {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropFrameSize_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// rgb frame size in pixels
#[inline]
fn rgb_frame_size(&self) -> core::Size {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropRgb_frameSize_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
#[inline]
fn volume_type(&self) -> crate::rgbd::Kinfu_VolumeType {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropVolumeType_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// camera intrinsics
#[inline]
fn intr(&self) -> core::Matx33f {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropIntr_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// rgb camera intrinsics
#[inline]
fn rgb_intr(&self) -> core::Matx33f {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropRgb_intr_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// pre-scale per 1 meter for input values
///
/// Typical values are:
/// * 5000 per 1 meter for the 16-bit PNG files of TUM database
/// * 1000 per 1 meter for Kinect 2 device
/// * 1 per 1 meter for the 32-bit float images in the ROS bag files
#[inline]
fn depth_factor(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropDepthFactor_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Depth sigma in meters for bilateral smooth
#[inline]
fn bilateral_sigma_depth(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropBilateral_sigma_depth_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Spatial sigma in pixels for bilateral smooth
#[inline]
fn bilateral_sigma_spatial(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropBilateral_sigma_spatial_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Kernel size in pixels for bilateral smooth
#[inline]
fn bilateral_kernel_size(&self) -> i32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropBilateral_kernel_size_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Number of pyramid levels for ICP
#[inline]
fn pyramid_levels(&self) -> i32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropPyramidLevels_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Resolution of voxel space
///
/// Number of voxels in each dimension.
#[inline]
fn volume_dims(&self) -> core::Vec3i {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropVolumeDims_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// Size of voxel in meters
#[inline]
fn voxel_size(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropVoxelSize_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// Minimal camera movement in meters
///
/// Integrate new depth frame only if camera movement exceeds this value.
#[inline]
fn tsdf_min_camera_movement(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropTsdf_min_camera_movement_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// initial volume pose in meters
#[inline]
fn volume_pose(&self) -> core::Affine3f {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropVolumePose_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// distance to truncate in meters
///
/// Distances to surface that exceed this value will be truncated to 1.0.
#[inline]
fn tsdf_trunc_dist(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropTsdf_trunc_dist_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// max number of frames per voxel
///
/// Each voxel keeps running average of distances no longer than this value.
#[inline]
fn tsdf_max_weight(&self) -> i32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropTsdf_max_weight_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// A length of one raycast step
///
/// How much voxel sizes we skip each raycast step
#[inline]
fn raycast_step_factor(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropRaycast_step_factor_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// light pose for rendering in meters
#[inline]
fn light_pose(&self) -> core::Vec3f {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_getPropLightPose_const(self.as_raw_ColoredKinfu_Params(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
/// distance theshold for ICP in meters
#[inline]
fn icp_dist_thresh(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropIcpDistThresh_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// angle threshold for ICP in radians
#[inline]
fn icp_angle_thresh(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropIcpAngleThresh_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
/// number of ICP iterations for each pyramid level
#[inline]
fn icp_iterations(&self) -> core::Vector<i32> {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropIcpIterations_const(self.as_raw_ColoredKinfu_Params()) };
let ret = unsafe { core::Vector::<i32>::opencv_from_extern(ret) };
ret
}
/// Threshold for depth truncation in meters
///
/// All depth values beyond this threshold will be set to zero
#[inline]
fn truncate_threshold(&self) -> f32 {
let ret = unsafe { sys::cv_colored_kinfu_Params_getPropTruncateThreshold_const(self.as_raw_ColoredKinfu_Params()) };
ret
}
}
/// Mutable methods for [crate::rgbd::ColoredKinfu_Params]
pub trait ColoredKinfu_ParamsTrait: crate::rgbd::ColoredKinfu_ParamsTraitConst {
fn as_raw_mut_ColoredKinfu_Params(&mut self) -> *mut c_void;
/// frame size in pixels
#[inline]
fn set_frame_size(&mut self, val: core::Size) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropFrameSize_Size(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// rgb frame size in pixels
#[inline]
fn set_rgb_frame_size(&mut self, val: core::Size) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropRgb_frameSize_Size(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
#[inline]
fn set_volume_type(&mut self, val: crate::rgbd::Kinfu_VolumeType) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropVolumeType_VolumeType(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// camera intrinsics
#[inline]
fn set_intr(&mut self, val: core::Matx33f) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropIntr_Matx33f(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// rgb camera intrinsics
#[inline]
fn set_rgb_intr(&mut self, val: core::Matx33f) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropRgb_intr_Matx33f(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// pre-scale per 1 meter for input values
///
/// Typical values are:
/// * 5000 per 1 meter for the 16-bit PNG files of TUM database
/// * 1000 per 1 meter for Kinect 2 device
/// * 1 per 1 meter for the 32-bit float images in the ROS bag files
#[inline]
fn set_depth_factor(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropDepthFactor_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Depth sigma in meters for bilateral smooth
#[inline]
fn set_bilateral_sigma_depth(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropBilateral_sigma_depth_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Spatial sigma in pixels for bilateral smooth
#[inline]
fn set_bilateral_sigma_spatial(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropBilateral_sigma_spatial_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Kernel size in pixels for bilateral smooth
#[inline]
fn set_bilateral_kernel_size(&mut self, val: i32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropBilateral_kernel_size_int(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Number of pyramid levels for ICP
#[inline]
fn set_pyramid_levels(&mut self, val: i32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropPyramidLevels_int(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Resolution of voxel space
///
/// Number of voxels in each dimension.
#[inline]
fn set_volume_dims(&mut self, val: core::Vec3i) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropVolumeDims_Vec3i(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// Size of voxel in meters
#[inline]
fn set_voxel_size(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropVoxelSize_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Minimal camera movement in meters
///
/// Integrate new depth frame only if camera movement exceeds this value.
#[inline]
fn set_tsdf_min_camera_movement(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropTsdf_min_camera_movement_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// initial volume pose in meters
#[inline]
fn set_volume_pose(&mut self, val: core::Affine3f) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropVolumePose_Affine3f(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// distance to truncate in meters
///
/// Distances to surface that exceed this value will be truncated to 1.0.
#[inline]
fn set_tsdf_trunc_dist(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropTsdf_trunc_dist_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// max number of frames per voxel
///
/// Each voxel keeps running average of distances no longer than this value.
#[inline]
fn set_tsdf_max_weight(&mut self, val: i32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropTsdf_max_weight_int(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// A length of one raycast step
///
/// How much voxel sizes we skip each raycast step
#[inline]
fn set_raycast_step_factor(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropRaycast_step_factor_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// light pose for rendering in meters
#[inline]
fn set_light_pose(&mut self, val: core::Vec3f) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropLightPose_Vec3f(self.as_raw_mut_ColoredKinfu_Params(), val.opencv_as_extern()) };
ret
}
/// distance theshold for ICP in meters
#[inline]
fn set_icp_dist_thresh(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropIcpDistThresh_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// angle threshold for ICP in radians
#[inline]
fn set_icp_angle_thresh(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropIcpAngleThresh_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// number of ICP iterations for each pyramid level
#[inline]
fn set_icp_iterations(&mut self, mut val: core::Vector<i32>) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropIcpIterations_vectorLintG(self.as_raw_mut_ColoredKinfu_Params(), val.as_raw_mut_VectorOfi32()) };
ret
}
/// Threshold for depth truncation in meters
///
/// All depth values beyond this threshold will be set to zero
#[inline]
fn set_truncate_threshold(&mut self, val: f32) {
let ret = unsafe { sys::cv_colored_kinfu_Params_setPropTruncateThreshold_float(self.as_raw_mut_ColoredKinfu_Params(), val) };
ret
}
/// Set Initial Volume Pose
/// Sets the initial pose of the TSDF volume.
/// ## Parameters
/// * R: rotation matrix
/// * t: translation vector
#[inline]
fn set_initial_volume_pose(&mut self, r: core::Matx33f, t: core::Vec3f) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_setInitialVolumePose_Matx33f_Vec3f(self.as_raw_mut_ColoredKinfu_Params(), r.opencv_as_extern(), t.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Set Initial Volume Pose
/// Sets the initial pose of the TSDF volume.
/// ## Parameters
/// * homogen_tf: 4 by 4 Homogeneous Transform matrix to set the intial pose of TSDF volume
#[inline]
fn set_initial_volume_pose_1(&mut self, homogen_tf: core::Matx44f) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_setInitialVolumePose_Matx44f(self.as_raw_mut_ColoredKinfu_Params(), homogen_tf.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
pub struct ColoredKinfu_Params {
ptr: *mut c_void
}
opencv_type_boxed! { ColoredKinfu_Params }
impl Drop for ColoredKinfu_Params {
fn drop(&mut self) {
extern "C" { fn cv_ColoredKinfu_Params_delete(instance: *mut c_void); }
unsafe { cv_ColoredKinfu_Params_delete(self.as_raw_mut_ColoredKinfu_Params()) };
}
}
unsafe impl Send for ColoredKinfu_Params {}
impl crate::rgbd::ColoredKinfu_ParamsTraitConst for ColoredKinfu_Params {
#[inline] fn as_raw_ColoredKinfu_Params(&self) -> *const c_void { self.as_raw() }
}
impl crate::rgbd::ColoredKinfu_ParamsTrait for ColoredKinfu_Params {
#[inline] fn as_raw_mut_ColoredKinfu_Params(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl ColoredKinfu_Params {
#[inline]
pub fn default() -> Result<crate::rgbd::ColoredKinfu_Params> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_Params(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::rgbd::ColoredKinfu_Params::opencv_from_extern(ret) };
Ok(ret)
}
/// Constructor for Params
/// Sets the initial pose of the TSDF volume.
/// ## Parameters
/// * volumeInitialPoseRot: rotation matrix
/// * volumeInitialPoseTransl: translation vector
#[inline]
pub fn new(volume_initial_pose_rot: core::Matx33f, volume_initial_pose_transl: core::Vec3f) -> Result<crate::rgbd::ColoredKinfu_Params> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_Params_Matx33f_Vec3f(volume_initial_pose_rot.opencv_as_extern(), volume_initial_pose_transl.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::rgbd::ColoredKinfu_Params::opencv_from_extern(ret) };
Ok(ret)
}
/// Constructor for Params
/// Sets the initial pose of the TSDF volume.
/// ## Parameters
/// * volumeInitialPose: 4 by 4 Homogeneous Transform matrix to set the intial pose of TSDF volume
#[inline]
pub fn new_1(volume_initial_pose: core::Matx44f) -> Result<crate::rgbd::ColoredKinfu_Params> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_Params_Matx44f(volume_initial_pose.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::rgbd::ColoredKinfu_Params::opencv_from_extern(ret) };
Ok(ret)
}
/// Default parameters
/// A set of parameters which provides better model quality, can be very slow.
#[inline]
pub fn default_params() -> Result<core::Ptr<crate::rgbd::ColoredKinfu_Params>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_defaultParams(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::rgbd::ColoredKinfu_Params>::opencv_from_extern(ret) };
Ok(ret)
}
/// Coarse parameters
/// A set of parameters which provides better speed, can fail to match frames
/// in case of rapid sensor motion.
#[inline]
pub fn coarse_params() -> Result<core::Ptr<crate::rgbd::ColoredKinfu_Params>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_coarseParams(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::rgbd::ColoredKinfu_Params>::opencv_from_extern(ret) };
Ok(ret)
}
/// HashTSDF parameters
/// A set of parameters suitable for use with HashTSDFVolume
#[inline]
pub fn hash_tsdf_params(is_coarse: bool) -> Result<core::Ptr<crate::rgbd::ColoredKinfu_Params>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_colored_kinfu_Params_hashTSDFParams_bool(is_coarse, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::rgbd::ColoredKinfu_Params>::opencv_from_extern(ret) };
Ok(ret)
}
/// ColoredTSDF parameters
/// A set of parameters suitable for use with HashTSDFVolume