opencv 0.99.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
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
pub mod stereo {
	//! # Stereo Correspondence
	use crate::mod_prelude::*;
	use crate::{core, sys, types};
	pub mod prelude {
		pub use super::{StereoBMTrait, StereoBMTraitConst, StereoMatcherTrait, StereoMatcherTraitConst, StereoSGBMTrait, StereoSGBMTraitConst};
	}

	pub const STEREO_ZERO_DISPARITY: i32 = 1024;
	pub const StereoBM_PREFILTER_NORMALIZED_RESPONSE: i32 = 0;
	pub const StereoBM_PREFILTER_XSOBEL: i32 = 1;
	pub const StereoMatcher_DISP_SCALE: i32 = 16;
	pub const StereoMatcher_DISP_SHIFT: i32 = 4;
	pub const StereoSGBM_MODE_HH: i32 = 1;
	pub const StereoSGBM_MODE_HH4: i32 = 3;
	pub const StereoSGBM_MODE_SGBM: i32 = 0;
	pub const StereoSGBM_MODE_SGBM_3WAY: i32 = 2;
	/// Filters off small noise blobs (speckles) in the disparity map
	///
	/// ## Parameters
	/// * img: The input 16-bit signed disparity image
	/// * newVal: The disparity value used to paint-off the speckles
	/// * maxSpeckleSize: The maximum speckle size to consider it a speckle. Larger blobs are not
	/// affected by the algorithm
	/// * maxDiff: Maximum difference between neighbor disparity pixels to put them into the same
	/// blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
	/// disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
	/// account when specifying this parameter value.
	/// * buf: The optional temporary buffer to avoid memory allocation within the function.
	///
	/// ## Note
	/// This alternative version of [filter_speckles] function uses the following default values for its arguments:
	/// * buf: noArray()
	#[inline]
	pub fn filter_speckles_def(img: &mut impl ToInputOutputArray, new_val: f64, max_speckle_size: i32, max_diff: f64) -> Result<()> {
		input_output_array_arg!(img);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_filterSpeckles_const__InputOutputArrayR_double_int_double(img.as_raw__InputOutputArray(), new_val, max_speckle_size, max_diff, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Filters off small noise blobs (speckles) in the disparity map
	///
	/// ## Parameters
	/// * img: The input 16-bit signed disparity image
	/// * newVal: The disparity value used to paint-off the speckles
	/// * maxSpeckleSize: The maximum speckle size to consider it a speckle. Larger blobs are not
	/// affected by the algorithm
	/// * maxDiff: Maximum difference between neighbor disparity pixels to put them into the same
	/// blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
	/// disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
	/// account when specifying this parameter value.
	/// * buf: The optional temporary buffer to avoid memory allocation within the function.
	///
	/// ## C++ default parameters
	/// * buf: noArray()
	#[inline]
	pub fn filter_speckles(img: &mut impl ToInputOutputArray, new_val: f64, max_speckle_size: i32, max_diff: f64, buf: &mut impl ToInputOutputArray) -> Result<()> {
		input_output_array_arg!(img);
		input_output_array_arg!(buf);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_filterSpeckles_const__InputOutputArrayR_double_int_double_const__InputOutputArrayR(img.as_raw__InputOutputArray(), new_val, max_speckle_size, max_diff, buf.as_raw__InputOutputArray(), ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Stereo rectification for fisheye camera model
	///
	/// ## Parameters
	/// * K1: First camera intrinsic matrix.
	/// * D1: First camera distortion parameters.
	/// * K2: Second camera intrinsic matrix.
	/// * D2: Second camera distortion parameters.
	/// * imageSize: Size of the image used for stereo calibration.
	/// * R: Rotation matrix between the coordinate systems of the first and the second
	/// cameras.
	/// * tvec: Translation vector between coordinate systems of the cameras.
	/// * R1: Output 3x3 rectification transform (rotation matrix) for the first camera.
	/// * R2: Output 3x3 rectification transform (rotation matrix) for the second camera.
	/// * P1: Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
	/// camera.
	/// * P2: Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
	/// camera.
	/// * Q: Output ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
	/// * flags: Operation flags that may be zero or [cv::CALIB_ZERO_DISPARITY] . If the flag is set,
	/// the function makes the principal points of each camera have the same pixel coordinates in the
	/// rectified views. And if the flag is not set, the function may still shift the images in the
	/// horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
	/// useful image area.
	/// * newImageSize: New image resolution after rectification. The same size should be passed to
	/// [init_undistort_rectify_map] (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
	/// is passed (default), it is set to the original imageSize . Setting it to larger value can help you
	/// preserve details in the original image, especially when there is a big radial distortion.
	/// * balance: Sets the new focal length in range between the min focal length and the max focal
	/// length. Balance is in range of [0, 1].
	/// * fov_scale: Divisor for new focal length.
	///
	/// ## Note
	/// This alternative version of [stereo_rectify_1] function uses the following default values for its arguments:
	/// * new_image_size: Size()
	/// * balance: 0.0
	/// * fov_scale: 1.0
	#[inline]
	pub fn stereo_rectify_1_def(k1: &impl ToInputArray, d1: &impl ToInputArray, k2: &impl ToInputArray, d2: &impl ToInputArray, image_size: core::Size, r: &impl ToInputArray, tvec: &impl ToInputArray, r1: &mut impl ToOutputArray, r2: &mut impl ToOutputArray, p1: &mut impl ToOutputArray, p2: &mut impl ToOutputArray, q: &mut impl ToOutputArray, flags: i32) -> Result<()> {
		input_array_arg!(k1);
		input_array_arg!(d1);
		input_array_arg!(k2);
		input_array_arg!(d2);
		input_array_arg!(r);
		input_array_arg!(tvec);
		output_array_arg!(r1);
		output_array_arg!(r2);
		output_array_arg!(p1);
		output_array_arg!(p2);
		output_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_fisheye_stereoRectify_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const_SizeR_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_int(k1.as_raw__InputArray(), d1.as_raw__InputArray(), k2.as_raw__InputArray(), d2.as_raw__InputArray(), &image_size, r.as_raw__InputArray(), tvec.as_raw__InputArray(), r1.as_raw__OutputArray(), r2.as_raw__OutputArray(), p1.as_raw__OutputArray(), p2.as_raw__OutputArray(), q.as_raw__OutputArray(), flags, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Stereo rectification for fisheye camera model
	///
	/// ## Parameters
	/// * K1: First camera intrinsic matrix.
	/// * D1: First camera distortion parameters.
	/// * K2: Second camera intrinsic matrix.
	/// * D2: Second camera distortion parameters.
	/// * imageSize: Size of the image used for stereo calibration.
	/// * R: Rotation matrix between the coordinate systems of the first and the second
	/// cameras.
	/// * tvec: Translation vector between coordinate systems of the cameras.
	/// * R1: Output 3x3 rectification transform (rotation matrix) for the first camera.
	/// * R2: Output 3x3 rectification transform (rotation matrix) for the second camera.
	/// * P1: Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
	/// camera.
	/// * P2: Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
	/// camera.
	/// * Q: Output ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) disparity-to-depth mapping matrix (see reprojectImageTo3D ).
	/// * flags: Operation flags that may be zero or [cv::CALIB_ZERO_DISPARITY] . If the flag is set,
	/// the function makes the principal points of each camera have the same pixel coordinates in the
	/// rectified views. And if the flag is not set, the function may still shift the images in the
	/// horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
	/// useful image area.
	/// * newImageSize: New image resolution after rectification. The same size should be passed to
	/// [init_undistort_rectify_map] (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
	/// is passed (default), it is set to the original imageSize . Setting it to larger value can help you
	/// preserve details in the original image, especially when there is a big radial distortion.
	/// * balance: Sets the new focal length in range between the min focal length and the max focal
	/// length. Balance is in range of [0, 1].
	/// * fov_scale: Divisor for new focal length.
	///
	/// ## C++ default parameters
	/// * new_image_size: Size()
	/// * balance: 0.0
	/// * fov_scale: 1.0
	#[inline]
	pub fn stereo_rectify_1(k1: &impl ToInputArray, d1: &impl ToInputArray, k2: &impl ToInputArray, d2: &impl ToInputArray, image_size: core::Size, r: &impl ToInputArray, tvec: &impl ToInputArray, r1: &mut impl ToOutputArray, r2: &mut impl ToOutputArray, p1: &mut impl ToOutputArray, p2: &mut impl ToOutputArray, q: &mut impl ToOutputArray, flags: i32, new_image_size: core::Size, balance: f64, fov_scale: f64) -> Result<()> {
		input_array_arg!(k1);
		input_array_arg!(d1);
		input_array_arg!(k2);
		input_array_arg!(d2);
		input_array_arg!(r);
		input_array_arg!(tvec);
		output_array_arg!(r1);
		output_array_arg!(r2);
		output_array_arg!(p1);
		output_array_arg!(p2);
		output_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_fisheye_stereoRectify_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const_SizeR_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_int_const_SizeR_double_double(k1.as_raw__InputArray(), d1.as_raw__InputArray(), k2.as_raw__InputArray(), d2.as_raw__InputArray(), &image_size, r.as_raw__InputArray(), tvec.as_raw__InputArray(), r1.as_raw__OutputArray(), r2.as_raw__OutputArray(), p1.as_raw__OutputArray(), p2.as_raw__OutputArray(), q.as_raw__OutputArray(), flags, &new_image_size, balance, fov_scale, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by #stereoRectify)
	#[inline]
	pub fn get_valid_disparity_roi(roi1: core::Rect, roi2: core::Rect, min_disparity: i32, number_of_disparities: i32, block_size: i32) -> Result<core::Rect> {
		return_send!(via ocvrs_return);
		unsafe { sys::cv_getValidDisparityROI_Rect_Rect_int_int_int(&roi1, &roi2, min_disparity, number_of_disparities, block_size, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	#[inline]
	pub fn rectify3_collinear(_camera_matrix1: &impl ToInputArray, _dist_coeffs1: &impl ToInputArray, _camera_matrix2: &impl ToInputArray, _dist_coeffs2: &impl ToInputArray, _camera_matrix3: &impl ToInputArray, _dist_coeffs3: &impl ToInputArray, _imgpt1: &impl ToInputArray, _imgpt3: &impl ToInputArray, image_size: core::Size, _rmat12: &impl ToInputArray, _tmat12: &impl ToInputArray, _rmat13: &impl ToInputArray, _tmat13: &impl ToInputArray, _rmat1: &mut impl ToOutputArray, _rmat2: &mut impl ToOutputArray, _rmat3: &mut impl ToOutputArray, _pmat1: &mut impl ToOutputArray, _pmat2: &mut impl ToOutputArray, _pmat3: &mut impl ToOutputArray, _qmat: &mut impl ToOutputArray, alpha: f64, new_img_size: core::Size, roi1: &mut core::Rect, roi2: &mut core::Rect, flags: i32) -> Result<f32> {
		input_array_arg!(_camera_matrix1);
		input_array_arg!(_dist_coeffs1);
		input_array_arg!(_camera_matrix2);
		input_array_arg!(_dist_coeffs2);
		input_array_arg!(_camera_matrix3);
		input_array_arg!(_dist_coeffs3);
		input_array_arg!(_imgpt1);
		input_array_arg!(_imgpt3);
		input_array_arg!(_rmat12);
		input_array_arg!(_tmat12);
		input_array_arg!(_rmat13);
		input_array_arg!(_tmat13);
		output_array_arg!(_rmat1);
		output_array_arg!(_rmat2);
		output_array_arg!(_rmat3);
		output_array_arg!(_pmat1);
		output_array_arg!(_pmat2);
		output_array_arg!(_pmat3);
		output_array_arg!(_qmat);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_rectify3Collinear_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_Size_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_double_Size_RectX_RectX_int(_camera_matrix1.as_raw__InputArray(), _dist_coeffs1.as_raw__InputArray(), _camera_matrix2.as_raw__InputArray(), _dist_coeffs2.as_raw__InputArray(), _camera_matrix3.as_raw__InputArray(), _dist_coeffs3.as_raw__InputArray(), _imgpt1.as_raw__InputArray(), _imgpt3.as_raw__InputArray(), &image_size, _rmat12.as_raw__InputArray(), _tmat12.as_raw__InputArray(), _rmat13.as_raw__InputArray(), _tmat13.as_raw__InputArray(), _rmat1.as_raw__OutputArray(), _rmat2.as_raw__OutputArray(), _rmat3.as_raw__OutputArray(), _pmat1.as_raw__OutputArray(), _pmat2.as_raw__OutputArray(), _pmat3.as_raw__OutputArray(), _qmat.as_raw__OutputArray(), alpha, &new_img_size, roi1, roi2, flags, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Reprojects a disparity image to 3D space.
	///
	/// ## Parameters
	/// * disparity: Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
	/// floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
	/// fractional bits. If the disparity is 16-bit signed format, as computed by [StereoBM] or
	/// [StereoSGBM] and maybe other algorithms, it should be divided by 16 (and scaled to float) before
	/// being used here.
	/// * _3dImage: Output 3-channel floating-point image of the same size as disparity. Each element of
	/// _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
	/// uses Q obtained by [stereoRectify], then the returned points are represented in the first
	/// camera's rectified coordinate system.
	/// * Q: ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) perspective transformation matrix that can be obtained with
	/// [stereoRectify].
	/// * handleMissingValues: Indicates, whether the function should handle missing values (i.e.
	/// points where the disparity was not computed). If handleMissingValues=true, then pixels with the
	/// minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
	/// to 3D points with a very large Z value (currently set to 10000).
	/// * ddepth: The optional output array depth. If it is -1, the output image will have CV_32F
	/// depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
	///
	/// The function transforms a single-channel disparity map to a 3-channel image representing a 3D
	/// surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
	/// computes:
	///
	/// ![block formula](https://latex.codecogs.com/png.latex?%5Cbegin%7Bbmatrix%7D%0AX%20%5C%5C%0AY%20%5C%5C%0AZ%20%5C%5C%0AW%0A%5Cend%7Bbmatrix%7D%20%3D%20Q%20%5Cbegin%7Bbmatrix%7D%0Ax%20%5C%5C%0Ay%20%5C%5C%0A%5Ctexttt%7Bdisparity%7D%20%28x%2Cy%29%20%5C%5C%0A1%0A%5Cend%7Bbmatrix%7D%2E)
	/// ## See also
	/// To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
	///
	/// ## Note
	/// This alternative version of [reproject_image_to_3d] function uses the following default values for its arguments:
	/// * handle_missing_values: false
	/// * ddepth: -1
	#[inline]
	pub fn reproject_image_to_3d_def(disparity: &impl ToInputArray, _3d_image: &mut impl ToOutputArray, q: &impl ToInputArray) -> Result<()> {
		input_array_arg!(disparity);
		output_array_arg!(_3d_image);
		input_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_reprojectImageTo3D_const__InputArrayR_const__OutputArrayR_const__InputArrayR(disparity.as_raw__InputArray(), _3d_image.as_raw__OutputArray(), q.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Reprojects a disparity image to 3D space.
	///
	/// ## Parameters
	/// * disparity: Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
	/// floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
	/// fractional bits. If the disparity is 16-bit signed format, as computed by [StereoBM] or
	/// [StereoSGBM] and maybe other algorithms, it should be divided by 16 (and scaled to float) before
	/// being used here.
	/// * _3dImage: Output 3-channel floating-point image of the same size as disparity. Each element of
	/// _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
	/// uses Q obtained by [stereoRectify], then the returned points are represented in the first
	/// camera's rectified coordinate system.
	/// * Q: ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) perspective transformation matrix that can be obtained with
	/// [stereoRectify].
	/// * handleMissingValues: Indicates, whether the function should handle missing values (i.e.
	/// points where the disparity was not computed). If handleMissingValues=true, then pixels with the
	/// minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
	/// to 3D points with a very large Z value (currently set to 10000).
	/// * ddepth: The optional output array depth. If it is -1, the output image will have CV_32F
	/// depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
	///
	/// The function transforms a single-channel disparity map to a 3-channel image representing a 3D
	/// surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
	/// computes:
	///
	/// ![block formula](https://latex.codecogs.com/png.latex?%5Cbegin%7Bbmatrix%7D%0AX%20%5C%5C%0AY%20%5C%5C%0AZ%20%5C%5C%0AW%0A%5Cend%7Bbmatrix%7D%20%3D%20Q%20%5Cbegin%7Bbmatrix%7D%0Ax%20%5C%5C%0Ay%20%5C%5C%0A%5Ctexttt%7Bdisparity%7D%20%28x%2Cy%29%20%5C%5C%0A1%0A%5Cend%7Bbmatrix%7D%2E)
	/// ## See also
	/// To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
	///
	/// ## C++ default parameters
	/// * handle_missing_values: false
	/// * ddepth: -1
	#[inline]
	pub fn reproject_image_to_3d(disparity: &impl ToInputArray, _3d_image: &mut impl ToOutputArray, q: &impl ToInputArray, handle_missing_values: bool, ddepth: i32) -> Result<()> {
		input_array_arg!(disparity);
		output_array_arg!(_3d_image);
		input_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_reprojectImageTo3D_const__InputArrayR_const__OutputArrayR_const__InputArrayR_bool_int(disparity.as_raw__InputArray(), _3d_image.as_raw__OutputArray(), q.as_raw__InputArray(), handle_missing_values, ddepth, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Computes a rectification transform for an uncalibrated stereo camera.
	///
	/// ## Parameters
	/// * points1: Array of feature points in the first image.
	/// * points2: The corresponding points in the second image. The same formats as in
	/// [find_fundamental_mat] are supported.
	/// * F: Input fundamental matrix. It can be computed from the same set of point pairs using
	/// [find_fundamental_mat] .
	/// * imgSize: Size of the image.
	/// * H1: Output rectification homography matrix for the first image.
	/// * H2: Output rectification homography matrix for the second image.
	/// * threshold: Optional threshold used to filter out the outliers. If the parameter is greater
	/// than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
	/// for which ![inline formula](https://latex.codecogs.com/png.latex?%7C%5Ctexttt%7Bpoints2%5Bi%5D%7D%5ET%20%5Ccdot%20%5Ctexttt%7BF%7D%20%5Ccdot%20%5Ctexttt%7Bpoints1%5Bi%5D%7D%7C%3E%5Ctexttt%7Bthreshold%7D) )
	/// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
	///
	/// The function computes the rectification transformations without knowing intrinsic parameters of the
	/// cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
	/// related difference from [stereo_rectify] is that the function outputs not the rectification
	/// transformations in the object (3D) space, but the planar perspective transformations encoded by the
	/// homography matrices H1 and H2 . The function implements the algorithm [Hartley99](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_Hartley99) .
	///
	///
	/// Note:
	///    While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
	///    depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
	///    it would be better to correct it before computing the fundamental matrix and calling this
	///    function. For example, distortion coefficients can be estimated for each head of stereo camera
	///    separately by using [calibrate_camera] . Then, the images can be corrected using [undistort] , or
	///    just the point coordinates can be corrected with [undistort_points] .
	///
	/// ## Note
	/// This alternative version of [stereo_rectify_uncalibrated] function uses the following default values for its arguments:
	/// * threshold: 5
	#[inline]
	pub fn stereo_rectify_uncalibrated_def(points1: &impl ToInputArray, points2: &impl ToInputArray, f: &impl ToInputArray, img_size: core::Size, h1: &mut impl ToOutputArray, h2: &mut impl ToOutputArray) -> Result<bool> {
		input_array_arg!(points1);
		input_array_arg!(points2);
		input_array_arg!(f);
		output_array_arg!(h1);
		output_array_arg!(h2);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_stereoRectifyUncalibrated_const__InputArrayR_const__InputArrayR_const__InputArrayR_Size_const__OutputArrayR_const__OutputArrayR(points1.as_raw__InputArray(), points2.as_raw__InputArray(), f.as_raw__InputArray(), &img_size, h1.as_raw__OutputArray(), h2.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Computes a rectification transform for an uncalibrated stereo camera.
	///
	/// ## Parameters
	/// * points1: Array of feature points in the first image.
	/// * points2: The corresponding points in the second image. The same formats as in
	/// [find_fundamental_mat] are supported.
	/// * F: Input fundamental matrix. It can be computed from the same set of point pairs using
	/// [find_fundamental_mat] .
	/// * imgSize: Size of the image.
	/// * H1: Output rectification homography matrix for the first image.
	/// * H2: Output rectification homography matrix for the second image.
	/// * threshold: Optional threshold used to filter out the outliers. If the parameter is greater
	/// than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
	/// for which ![inline formula](https://latex.codecogs.com/png.latex?%7C%5Ctexttt%7Bpoints2%5Bi%5D%7D%5ET%20%5Ccdot%20%5Ctexttt%7BF%7D%20%5Ccdot%20%5Ctexttt%7Bpoints1%5Bi%5D%7D%7C%3E%5Ctexttt%7Bthreshold%7D) )
	/// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
	///
	/// The function computes the rectification transformations without knowing intrinsic parameters of the
	/// cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
	/// related difference from [stereo_rectify] is that the function outputs not the rectification
	/// transformations in the object (3D) space, but the planar perspective transformations encoded by the
	/// homography matrices H1 and H2 . The function implements the algorithm [Hartley99](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_Hartley99) .
	///
	///
	/// Note:
	///    While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
	///    depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
	///    it would be better to correct it before computing the fundamental matrix and calling this
	///    function. For example, distortion coefficients can be estimated for each head of stereo camera
	///    separately by using [calibrate_camera] . Then, the images can be corrected using [undistort] , or
	///    just the point coordinates can be corrected with [undistort_points] .
	///
	/// ## C++ default parameters
	/// * threshold: 5
	#[inline]
	pub fn stereo_rectify_uncalibrated(points1: &impl ToInputArray, points2: &impl ToInputArray, f: &impl ToInputArray, img_size: core::Size, h1: &mut impl ToOutputArray, h2: &mut impl ToOutputArray, threshold: f64) -> Result<bool> {
		input_array_arg!(points1);
		input_array_arg!(points2);
		input_array_arg!(f);
		output_array_arg!(h1);
		output_array_arg!(h2);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_stereoRectifyUncalibrated_const__InputArrayR_const__InputArrayR_const__InputArrayR_Size_const__OutputArrayR_const__OutputArrayR_double(points1.as_raw__InputArray(), points2.as_raw__InputArray(), f.as_raw__InputArray(), &img_size, h1.as_raw__OutputArray(), h2.as_raw__OutputArray(), threshold, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Computes rectification transforms for each head of a calibrated stereo camera.
	///
	/// ## Parameters
	/// * cameraMatrix1: First camera intrinsic matrix.
	/// * distCoeffs1: First camera distortion parameters.
	/// * cameraMatrix2: Second camera intrinsic matrix.
	/// * distCoeffs2: Second camera distortion parameters.
	/// * imageSize: Size of the image used for stereo calibration.
	/// * R: Rotation matrix from the coordinate system of the first camera to the second camera,
	/// see [stereoCalibrate].
	/// * T: Translation vector from the coordinate system of the first camera to the second camera,
	/// see [stereoCalibrate].
	/// * R1: Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
	/// brings points given in the unrectified first camera's coordinate system to points in the rectified
	/// first camera's coordinate system. In more technical terms, it performs a change of basis from the
	/// unrectified first camera's coordinate system to the rectified first camera's coordinate system.
	/// * R2: Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
	/// brings points given in the unrectified second camera's coordinate system to points in the rectified
	/// second camera's coordinate system. In more technical terms, it performs a change of basis from the
	/// unrectified second camera's coordinate system to the rectified second camera's coordinate system.
	/// * P1: Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
	/// camera, i.e. it projects points given in the rectified first camera coordinate system into the
	/// rectified first camera's image.
	/// * P2: Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
	/// camera, i.e. it projects points given in the rectified first camera coordinate system into the
	/// rectified second camera's image.
	/// * Q: Output ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) disparity-to-depth mapping matrix (see [reprojectImageTo3D]).
	/// * flags: Operation flags that may be zero or [STEREO_ZERO_DISPARITY] . If the flag is set,
	/// the function makes the principal points of each camera have the same pixel coordinates in the
	/// rectified views. And if the flag is not set, the function may still shift the images in the
	/// horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
	/// useful image area.
	/// * alpha: Free scaling parameter. If it is -1 or absent, the function performs the default
	/// scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
	/// images are zoomed and shifted so that only valid pixels are visible (no black areas after
	/// rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
	/// pixels from the original images from the cameras are retained in the rectified images (no source
	/// image pixels are lost). Any intermediate value yields an intermediate result between
	/// those two extreme cases.
	/// * newImageSize: New image resolution after rectification. The same size should be passed to
	/// [init_undistort_rectify_map] (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
	/// is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
	/// preserve details in the original image, especially when there is a big radial distortion.
	/// * validPixROI1: Optional output rectangles inside the rectified images where all the pixels
	/// are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
	/// (see the picture below).
	/// * validPixROI2: Optional output rectangles inside the rectified images where all the pixels
	/// are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
	/// (see the picture below).
	///
	/// The function computes the rotation matrices for each camera that (virtually) make both camera image
	/// planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
	/// the dense stereo correspondence problem. The function takes the matrices computed by [stereo_calibrate]
	/// as input. As output, it provides two rotation matrices and also two projection matrices in the new
	/// coordinates. The function distinguishes the following two cases:
	///
	/// *   **Horizontal stereo**: the first and the second camera views are shifted relative to each other
	///    mainly along the x-axis (with possible small vertical shift). In the rectified images, the
	///    corresponding epipolar lines in the left and right cameras are horizontal and have the same
	///    y-coordinate. P1 and P2 look like:
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP1%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%5F1%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP2%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%5F2%20%26%20T%5Fx%20%5Ccdot%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20%2C)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BQ%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%201%20%26%200%20%26%200%20%26%20%2Dcx%5F1%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%201%20%26%200%20%26%20%2Dcy%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%200%20%26%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%20%2D%5Cfrac%7B1%7D%7BT%5Fx%7D%20%26%20%5Cfrac%7Bcx%5F1%20%2D%20cx%5F2%7D%7BT%5Fx%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20)
	///
	///    where ![inline formula](https://latex.codecogs.com/png.latex?T%5Fx) is a horizontal shift between the cameras and ![inline formula](https://latex.codecogs.com/png.latex?cx%5F1%3Dcx%5F2) if
	///    [STEREO_ZERO_DISPARITY] is set.
	///
	/// *   **Vertical stereo**: the first and the second camera views are shifted relative to each other
	///    mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
	///    lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP1%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%5F1%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP2%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%5F2%20%26%20T%5Fy%20%5Ccdot%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%2C)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BQ%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%201%20%26%200%20%26%200%20%26%20%2Dcx%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%201%20%26%200%20%26%20%2Dcy%5F1%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%200%20%26%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%20%2D%5Cfrac%7B1%7D%7BT%5Fy%7D%20%26%20%5Cfrac%7Bcy%5F1%20%2D%20cy%5F2%7D%7BT%5Fy%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20)
	///
	///    where ![inline formula](https://latex.codecogs.com/png.latex?T%5Fy) is a vertical shift between the cameras and ![inline formula](https://latex.codecogs.com/png.latex?cy%5F1%3Dcy%5F2) if
	///    [STEREO_ZERO_DISPARITY] is set.
	///
	/// As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
	/// matrices. The matrices, together with R1 and R2 , can then be passed to [init_undistort_rectify_map] to
	/// initialize the rectification map for each camera.
	///
	/// See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
	/// the corresponding image regions. This means that the images are well rectified, which is what most
	/// stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
	/// their interiors are all valid pixels.
	///
	/// ![image](https://docs.opencv.org/5.0.0/stereo_undistort.jpg)
	///
	/// ## Note
	/// This alternative version of [stereo_rectify] function uses the following default values for its arguments:
	/// * flags: STEREO_ZERO_DISPARITY
	/// * alpha: -1
	/// * new_image_size: Size()
	/// * valid_pix_roi1: 0
	/// * valid_pix_roi2: 0
	#[inline]
	pub fn stereo_rectify_def(camera_matrix1: &impl ToInputArray, dist_coeffs1: &impl ToInputArray, camera_matrix2: &impl ToInputArray, dist_coeffs2: &impl ToInputArray, image_size: core::Size, r: &impl ToInputArray, t: &impl ToInputArray, r1: &mut impl ToOutputArray, r2: &mut impl ToOutputArray, p1: &mut impl ToOutputArray, p2: &mut impl ToOutputArray, q: &mut impl ToOutputArray) -> Result<()> {
		input_array_arg!(camera_matrix1);
		input_array_arg!(dist_coeffs1);
		input_array_arg!(camera_matrix2);
		input_array_arg!(dist_coeffs2);
		input_array_arg!(r);
		input_array_arg!(t);
		output_array_arg!(r1);
		output_array_arg!(r2);
		output_array_arg!(p1);
		output_array_arg!(p2);
		output_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_stereoRectify_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_Size_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(camera_matrix1.as_raw__InputArray(), dist_coeffs1.as_raw__InputArray(), camera_matrix2.as_raw__InputArray(), dist_coeffs2.as_raw__InputArray(), &image_size, r.as_raw__InputArray(), t.as_raw__InputArray(), r1.as_raw__OutputArray(), r2.as_raw__OutputArray(), p1.as_raw__OutputArray(), p2.as_raw__OutputArray(), q.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Computes rectification transforms for each head of a calibrated stereo camera.
	///
	/// ## Parameters
	/// * cameraMatrix1: First camera intrinsic matrix.
	/// * distCoeffs1: First camera distortion parameters.
	/// * cameraMatrix2: Second camera intrinsic matrix.
	/// * distCoeffs2: Second camera distortion parameters.
	/// * imageSize: Size of the image used for stereo calibration.
	/// * R: Rotation matrix from the coordinate system of the first camera to the second camera,
	/// see [stereoCalibrate].
	/// * T: Translation vector from the coordinate system of the first camera to the second camera,
	/// see [stereoCalibrate].
	/// * R1: Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
	/// brings points given in the unrectified first camera's coordinate system to points in the rectified
	/// first camera's coordinate system. In more technical terms, it performs a change of basis from the
	/// unrectified first camera's coordinate system to the rectified first camera's coordinate system.
	/// * R2: Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
	/// brings points given in the unrectified second camera's coordinate system to points in the rectified
	/// second camera's coordinate system. In more technical terms, it performs a change of basis from the
	/// unrectified second camera's coordinate system to the rectified second camera's coordinate system.
	/// * P1: Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
	/// camera, i.e. it projects points given in the rectified first camera coordinate system into the
	/// rectified first camera's image.
	/// * P2: Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
	/// camera, i.e. it projects points given in the rectified first camera coordinate system into the
	/// rectified second camera's image.
	/// * Q: Output ![inline formula](https://latex.codecogs.com/png.latex?4%20%5Ctimes%204) disparity-to-depth mapping matrix (see [reprojectImageTo3D]).
	/// * flags: Operation flags that may be zero or [STEREO_ZERO_DISPARITY] . If the flag is set,
	/// the function makes the principal points of each camera have the same pixel coordinates in the
	/// rectified views. And if the flag is not set, the function may still shift the images in the
	/// horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
	/// useful image area.
	/// * alpha: Free scaling parameter. If it is -1 or absent, the function performs the default
	/// scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
	/// images are zoomed and shifted so that only valid pixels are visible (no black areas after
	/// rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
	/// pixels from the original images from the cameras are retained in the rectified images (no source
	/// image pixels are lost). Any intermediate value yields an intermediate result between
	/// those two extreme cases.
	/// * newImageSize: New image resolution after rectification. The same size should be passed to
	/// [init_undistort_rectify_map] (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
	/// is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
	/// preserve details in the original image, especially when there is a big radial distortion.
	/// * validPixROI1: Optional output rectangles inside the rectified images where all the pixels
	/// are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
	/// (see the picture below).
	/// * validPixROI2: Optional output rectangles inside the rectified images where all the pixels
	/// are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
	/// (see the picture below).
	///
	/// The function computes the rotation matrices for each camera that (virtually) make both camera image
	/// planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
	/// the dense stereo correspondence problem. The function takes the matrices computed by [stereo_calibrate]
	/// as input. As output, it provides two rotation matrices and also two projection matrices in the new
	/// coordinates. The function distinguishes the following two cases:
	///
	/// *   **Horizontal stereo**: the first and the second camera views are shifted relative to each other
	///    mainly along the x-axis (with possible small vertical shift). In the rectified images, the
	///    corresponding epipolar lines in the left and right cameras are horizontal and have the same
	///    y-coordinate. P1 and P2 look like:
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP1%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%5F1%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP2%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%5F2%20%26%20T%5Fx%20%5Ccdot%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20%2C)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BQ%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%201%20%26%200%20%26%200%20%26%20%2Dcx%5F1%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%201%20%26%200%20%26%20%2Dcy%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%200%20%26%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%20%2D%5Cfrac%7B1%7D%7BT%5Fx%7D%20%26%20%5Cfrac%7Bcx%5F1%20%2D%20cx%5F2%7D%7BT%5Fx%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20)
	///
	///    where ![inline formula](https://latex.codecogs.com/png.latex?T%5Fx) is a horizontal shift between the cameras and ![inline formula](https://latex.codecogs.com/png.latex?cx%5F1%3Dcx%5F2) if
	///    [STEREO_ZERO_DISPARITY] is set.
	///
	/// *   **Vertical stereo**: the first and the second camera views are shifted relative to each other
	///    mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
	///    lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP1%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%5F1%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BP2%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%20%26%200%20%26%20cx%20%26%200%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%20f%20%26%20cy%5F2%20%26%20T%5Fy%20%5Ccdot%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%201%20%26%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%2C)
	///
	///    ![block formula](https://latex.codecogs.com/png.latex?%5Ctexttt%7BQ%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%201%20%26%200%20%26%200%20%26%20%2Dcx%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%201%20%26%200%20%26%20%2Dcy%5F1%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%200%20%26%20f%20%5C%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200%20%26%200%20%26%20%2D%5Cfrac%7B1%7D%7BT%5Fy%7D%20%26%20%5Cfrac%7Bcy%5F1%20%2D%20cy%5F2%7D%7BT%5Fy%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cend%7Bbmatrix%7D%20)
	///
	///    where ![inline formula](https://latex.codecogs.com/png.latex?T%5Fy) is a vertical shift between the cameras and ![inline formula](https://latex.codecogs.com/png.latex?cy%5F1%3Dcy%5F2) if
	///    [STEREO_ZERO_DISPARITY] is set.
	///
	/// As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
	/// matrices. The matrices, together with R1 and R2 , can then be passed to [init_undistort_rectify_map] to
	/// initialize the rectification map for each camera.
	///
	/// See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
	/// the corresponding image regions. This means that the images are well rectified, which is what most
	/// stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
	/// their interiors are all valid pixels.
	///
	/// ![image](https://docs.opencv.org/5.0.0/stereo_undistort.jpg)
	///
	/// ## C++ default parameters
	/// * flags: STEREO_ZERO_DISPARITY
	/// * alpha: -1
	/// * new_image_size: Size()
	/// * valid_pix_roi1: 0
	/// * valid_pix_roi2: 0
	#[inline]
	pub fn stereo_rectify(camera_matrix1: &impl ToInputArray, dist_coeffs1: &impl ToInputArray, camera_matrix2: &impl ToInputArray, dist_coeffs2: &impl ToInputArray, image_size: core::Size, r: &impl ToInputArray, t: &impl ToInputArray, r1: &mut impl ToOutputArray, r2: &mut impl ToOutputArray, p1: &mut impl ToOutputArray, p2: &mut impl ToOutputArray, q: &mut impl ToOutputArray, flags: i32, alpha: f64, new_image_size: core::Size, valid_pix_roi1: &mut core::Rect, valid_pix_roi2: &mut core::Rect) -> Result<()> {
		input_array_arg!(camera_matrix1);
		input_array_arg!(dist_coeffs1);
		input_array_arg!(camera_matrix2);
		input_array_arg!(dist_coeffs2);
		input_array_arg!(r);
		input_array_arg!(t);
		output_array_arg!(r1);
		output_array_arg!(r2);
		output_array_arg!(p1);
		output_array_arg!(p2);
		output_array_arg!(q);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_stereoRectify_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_Size_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_int_double_Size_RectX_RectX(camera_matrix1.as_raw__InputArray(), dist_coeffs1.as_raw__InputArray(), camera_matrix2.as_raw__InputArray(), dist_coeffs2.as_raw__InputArray(), &image_size, r.as_raw__InputArray(), t.as_raw__InputArray(), r1.as_raw__OutputArray(), r2.as_raw__OutputArray(), p1.as_raw__OutputArray(), p2.as_raw__OutputArray(), q.as_raw__OutputArray(), flags, alpha, &new_image_size, valid_pix_roi1, valid_pix_roi2, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
	///
	/// ## Note
	/// This alternative version of [validate_disparity] function uses the following default values for its arguments:
	/// * disp12_max_disp: 1
	#[inline]
	pub fn validate_disparity_def(disparity: &mut impl ToInputOutputArray, cost: &impl ToInputArray, min_disparity: i32, number_of_disparities: i32) -> Result<()> {
		input_output_array_arg!(disparity);
		input_array_arg!(cost);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_validateDisparity_const__InputOutputArrayR_const__InputArrayR_int_int(disparity.as_raw__InputOutputArray(), cost.as_raw__InputArray(), min_disparity, number_of_disparities, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
	///
	/// ## C++ default parameters
	/// * disp12_max_disp: 1
	#[inline]
	pub fn validate_disparity(disparity: &mut impl ToInputOutputArray, cost: &impl ToInputArray, min_disparity: i32, number_of_disparities: i32, disp12_max_disp: i32) -> Result<()> {
		input_output_array_arg!(disparity);
		input_array_arg!(cost);
		return_send!(via ocvrs_return);
		unsafe { sys::cv_validateDisparity_const__InputOutputArrayR_const__InputArrayR_int_int_int(disparity.as_raw__InputOutputArray(), cost.as_raw__InputArray(), min_disparity, number_of_disparities, disp12_max_disp, ocvrs_return.as_mut_ptr()) };
		return_receive!(ocvrs_return => ret);
		let ret = ret.into_result()?;
		Ok(ret)
	}

	/// Class for computing stereo correspondence using the block matching algorithm, introduced and
	/// contributed to OpenCV by K. Konolige.
	pub struct StereoBM {
		ptr: *mut c_void,
	}

	opencv_type_boxed! { StereoBM }

	impl Drop for StereoBM {
		#[inline]
		fn drop(&mut self) {
			unsafe { sys::cv_StereoBM_delete(self.as_raw_mut_StereoBM()) };
		}
	}

	unsafe impl Send for StereoBM {}

	impl StereoBM {
		/// Creates StereoBM object
		///
		/// ## Parameters
		/// * numDisparities: the disparity search range. For each pixel algorithm will find the best
		/// disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
		/// shifted by changing the minimum disparity.
		/// * blockSize: the linear size of the blocks compared by the algorithm. The size should be odd
		/// (as the block is centered at the current pixel). Larger block size implies smoother, though less
		/// accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
		/// chance for algorithm to find a wrong correspondence.
		///
		/// The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
		/// a specific stereo pair.
		///
		/// ## C++ default parameters
		/// * num_disparities: 0
		/// * block_size: 21
		#[inline]
		pub fn create(num_disparities: i32, block_size: i32) -> Result<core::Ptr<crate::stereo::StereoBM>> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_create_int_int(num_disparities, block_size, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			let ret = unsafe { core::Ptr::<crate::stereo::StereoBM>::opencv_from_extern(ret) };
			Ok(ret)
		}

		/// Creates StereoBM object
		///
		/// ## Parameters
		/// * numDisparities: the disparity search range. For each pixel algorithm will find the best
		/// disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
		/// shifted by changing the minimum disparity.
		/// * blockSize: the linear size of the blocks compared by the algorithm. The size should be odd
		/// (as the block is centered at the current pixel). Larger block size implies smoother, though less
		/// accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
		/// chance for algorithm to find a wrong correspondence.
		///
		/// The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
		/// a specific stereo pair.
		///
		/// ## Note
		/// This alternative version of [StereoBM::create] function uses the following default values for its arguments:
		/// * num_disparities: 0
		/// * block_size: 21
		#[inline]
		pub fn create_def() -> Result<core::Ptr<crate::stereo::StereoBM>> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_create(ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			let ret = unsafe { core::Ptr::<crate::stereo::StereoBM>::opencv_from_extern(ret) };
			Ok(ret)
		}

	}

	/// Constant methods for [crate::stereo::StereoBM]
	pub trait StereoBMTraitConst: crate::stereo::StereoMatcherTraitConst {
		fn as_raw_StereoBM(&self) -> *const c_void;

		#[inline]
		fn get_pre_filter_type(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getPreFilterType_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_pre_filter_size(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getPreFilterSize_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_pre_filter_cap(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getPreFilterCap_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_texture_threshold(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getTextureThreshold_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_uniqueness_ratio(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getUniquenessRatio_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_smaller_block_size(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getSmallerBlockSize_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_roi1(&self) -> Result<core::Rect> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getROI1_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_roi2(&self) -> Result<core::Rect> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_getROI2_const(self.as_raw_StereoBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	/// Mutable methods for [crate::stereo::StereoBM]
	pub trait StereoBMTrait: crate::stereo::StereoBMTraitConst + crate::stereo::StereoMatcherTrait {
		fn as_raw_mut_StereoBM(&mut self) -> *mut c_void;

		#[inline]
		fn set_pre_filter_type(&mut self, pre_filter_type: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setPreFilterType_int(self.as_raw_mut_StereoBM(), pre_filter_type, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_pre_filter_size(&mut self, pre_filter_size: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setPreFilterSize_int(self.as_raw_mut_StereoBM(), pre_filter_size, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_pre_filter_cap(&mut self, pre_filter_cap: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setPreFilterCap_int(self.as_raw_mut_StereoBM(), pre_filter_cap, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_texture_threshold(&mut self, texture_threshold: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setTextureThreshold_int(self.as_raw_mut_StereoBM(), texture_threshold, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_uniqueness_ratio(&mut self, uniqueness_ratio: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setUniquenessRatio_int(self.as_raw_mut_StereoBM(), uniqueness_ratio, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_smaller_block_size(&mut self, block_size: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setSmallerBlockSize_int(self.as_raw_mut_StereoBM(), block_size, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_roi1(&mut self, roi1: core::Rect) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setROI1_Rect(self.as_raw_mut_StereoBM(), &roi1, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_roi2(&mut self, roi2: core::Rect) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoBM_setROI2_Rect(self.as_raw_mut_StereoBM(), &roi2, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	impl std::fmt::Debug for StereoBM {
		#[inline]
		fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
			f.debug_struct("StereoBM")
				.finish()
		}
	}

	boxed_cast_base! { StereoBM, core::Algorithm, cv_StereoBM_to_Algorithm }

	boxed_cast_base! { StereoBM, crate::stereo::StereoMatcher, cv_StereoBM_to_StereoMatcher }

	impl core::AlgorithmTraitConst for StereoBM {
		#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
	}

	impl core::AlgorithmTrait for StereoBM {
		#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoBM, core::AlgorithmTraitConst, as_raw_Algorithm, core::AlgorithmTrait, as_raw_mut_Algorithm }

	impl crate::stereo::StereoMatcherTraitConst for StereoBM {
		#[inline] fn as_raw_StereoMatcher(&self) -> *const c_void { self.as_raw() }
	}

	impl crate::stereo::StereoMatcherTrait for StereoBM {
		#[inline] fn as_raw_mut_StereoMatcher(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoBM, crate::stereo::StereoMatcherTraitConst, as_raw_StereoMatcher, crate::stereo::StereoMatcherTrait, as_raw_mut_StereoMatcher }

	impl crate::stereo::StereoBMTraitConst for StereoBM {
		#[inline] fn as_raw_StereoBM(&self) -> *const c_void { self.as_raw() }
	}

	impl crate::stereo::StereoBMTrait for StereoBM {
		#[inline] fn as_raw_mut_StereoBM(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoBM, crate::stereo::StereoBMTraitConst, as_raw_StereoBM, crate::stereo::StereoBMTrait, as_raw_mut_StereoBM }

	/// The base class for stereo correspondence algorithms.
	pub struct StereoMatcher {
		ptr: *mut c_void,
	}

	opencv_type_boxed! { StereoMatcher }

	impl Drop for StereoMatcher {
		#[inline]
		fn drop(&mut self) {
			unsafe { sys::cv_StereoMatcher_delete(self.as_raw_mut_StereoMatcher()) };
		}
	}

	unsafe impl Send for StereoMatcher {}

	/// Constant methods for [crate::stereo::StereoMatcher]
	pub trait StereoMatcherTraitConst: core::AlgorithmTraitConst {
		fn as_raw_StereoMatcher(&self) -> *const c_void;

		#[inline]
		fn get_min_disparity(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getMinDisparity_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_num_disparities(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getNumDisparities_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_block_size(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getBlockSize_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_speckle_window_size(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getSpeckleWindowSize_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_speckle_range(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getSpeckleRange_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_disp12_max_diff(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_getDisp12MaxDiff_const(self.as_raw_StereoMatcher(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	/// Mutable methods for [crate::stereo::StereoMatcher]
	pub trait StereoMatcherTrait: core::AlgorithmTrait + crate::stereo::StereoMatcherTraitConst {
		fn as_raw_mut_StereoMatcher(&mut self) -> *mut c_void;

		/// Computes disparity map for the specified stereo pair
		///
		/// ## Parameters
		/// * left: Left 8-bit single-channel image.
		/// * right: Right image of the same size and the same type as the left one.
		/// * disparity: Output disparity map. It has the same size as the input images. Some algorithms,
		/// like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value
		/// has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map.
		#[inline]
		fn compute(&mut self, left: &impl ToInputArray, right: &impl ToInputArray, disparity: &mut impl ToOutputArray) -> Result<()> {
			input_array_arg!(left);
			input_array_arg!(right);
			output_array_arg!(disparity);
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_compute_const__InputArrayR_const__InputArrayR_const__OutputArrayR(self.as_raw_mut_StereoMatcher(), left.as_raw__InputArray(), right.as_raw__InputArray(), disparity.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_min_disparity(&mut self, min_disparity: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setMinDisparity_int(self.as_raw_mut_StereoMatcher(), min_disparity, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_num_disparities(&mut self, num_disparities: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setNumDisparities_int(self.as_raw_mut_StereoMatcher(), num_disparities, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_block_size(&mut self, block_size: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setBlockSize_int(self.as_raw_mut_StereoMatcher(), block_size, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_speckle_window_size(&mut self, speckle_window_size: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setSpeckleWindowSize_int(self.as_raw_mut_StereoMatcher(), speckle_window_size, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_speckle_range(&mut self, speckle_range: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setSpeckleRange_int(self.as_raw_mut_StereoMatcher(), speckle_range, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_disp12_max_diff(&mut self, disp12_max_diff: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoMatcher_setDisp12MaxDiff_int(self.as_raw_mut_StereoMatcher(), disp12_max_diff, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	impl std::fmt::Debug for StereoMatcher {
		#[inline]
		fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
			f.debug_struct("StereoMatcher")
				.finish()
		}
	}

	boxed_cast_base! { StereoMatcher, core::Algorithm, cv_StereoMatcher_to_Algorithm }

	boxed_cast_descendant! { StereoMatcher, crate::stereo::StereoBM, cv_StereoMatcher_to_StereoBM }

	boxed_cast_descendant! { StereoMatcher, crate::stereo::StereoSGBM, cv_StereoMatcher_to_StereoSGBM }

	impl core::AlgorithmTraitConst for StereoMatcher {
		#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
	}

	impl core::AlgorithmTrait for StereoMatcher {
		#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoMatcher, core::AlgorithmTraitConst, as_raw_Algorithm, core::AlgorithmTrait, as_raw_mut_Algorithm }

	impl crate::stereo::StereoMatcherTraitConst for StereoMatcher {
		#[inline] fn as_raw_StereoMatcher(&self) -> *const c_void { self.as_raw() }
	}

	impl crate::stereo::StereoMatcherTrait for StereoMatcher {
		#[inline] fn as_raw_mut_StereoMatcher(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoMatcher, crate::stereo::StereoMatcherTraitConst, as_raw_StereoMatcher, crate::stereo::StereoMatcherTrait, as_raw_mut_StereoMatcher }

	/// The class implements the modified H. Hirschmuller algorithm [HH08](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_HH08) that differs from the original
	/// one as follows:
	///
	/// *   By default, the algorithm is single-pass, which means that you consider only 5 directions
	/// instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the
	/// algorithm but beware that it may consume a lot of memory.
	/// *   The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the
	/// blocks to single pixels.
	/// *   Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi
	/// sub-pixel metric from [BT98](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_BT98) is used. Though, the color images are supported as well.
	/// *   Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for
	/// example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness
	/// check, quadratic interpolation and speckle filtering).
	///
	///
	/// Note:
	///    *   (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found
	///        at opencv_source_code/samples/python/stereo_match.py
	pub struct StereoSGBM {
		ptr: *mut c_void,
	}

	opencv_type_boxed! { StereoSGBM }

	impl Drop for StereoSGBM {
		#[inline]
		fn drop(&mut self) {
			unsafe { sys::cv_StereoSGBM_delete(self.as_raw_mut_StereoSGBM()) };
		}
	}

	unsafe impl Send for StereoSGBM {}

	impl StereoSGBM {
		/// Creates StereoSGBM object
		///
		/// ## Parameters
		/// * minDisparity: Minimum possible disparity value. Normally, it is zero but sometimes
		/// rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
		/// * numDisparities: Maximum disparity minus minimum disparity. The value is always greater than
		/// zero. In the current implementation, this parameter must be divisible by 16.
		/// * blockSize: Matched block size. It must be an odd number \>=1 . Normally, it should be
		/// somewhere in the 3..11 range.
		/// * P1: The first parameter controlling the disparity smoothness. See below.
		/// * P2: The second parameter controlling the disparity smoothness. The larger the values are,
		/// the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
		/// between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
		/// pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good
		/// P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
		/// 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
		/// * disp12MaxDiff: Maximum allowed difference (in integer pixel units) in the left-right
		/// disparity check. Set it to a non-positive value to disable the check.
		/// * preFilterCap: Truncation value for the prefiltered image pixels. The algorithm first
		/// computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
		/// The result values are passed to the Birchfield-Tomasi pixel cost function.
		/// * uniquenessRatio: Margin in percentage by which the best (minimum) computed cost function
		/// value should "win" the second best value to consider the found match correct. Normally, a value
		/// within the 5-15 range is good enough.
		/// * speckleWindowSize: Maximum size of smooth disparity regions to consider their noise speckles
		/// and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
		/// 50-200 range.
		/// * speckleRange: Maximum disparity variation within each connected component. If you do speckle
		/// filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
		/// Normally, 1 or 2 is good enough.
		/// * mode: Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming
		/// algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
		/// huge for HD-size pictures. By default, it is set to false .
		///
		/// The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
		/// set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
		/// to a custom value.
		///
		/// ## C++ default parameters
		/// * min_disparity: 0
		/// * num_disparities: 16
		/// * block_size: 3
		/// * p1: 0
		/// * p2: 0
		/// * disp12_max_diff: 0
		/// * pre_filter_cap: 0
		/// * uniqueness_ratio: 0
		/// * speckle_window_size: 0
		/// * speckle_range: 0
		/// * mode: StereoSGBM::MODE_SGBM
		#[inline]
		pub fn create(min_disparity: i32, num_disparities: i32, block_size: i32, p1: i32, p2: i32, disp12_max_diff: i32, pre_filter_cap: i32, uniqueness_ratio: i32, speckle_window_size: i32, speckle_range: i32, mode: i32) -> Result<core::Ptr<crate::stereo::StereoSGBM>> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_create_int_int_int_int_int_int_int_int_int_int_int(min_disparity, num_disparities, block_size, p1, p2, disp12_max_diff, pre_filter_cap, uniqueness_ratio, speckle_window_size, speckle_range, mode, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			let ret = unsafe { core::Ptr::<crate::stereo::StereoSGBM>::opencv_from_extern(ret) };
			Ok(ret)
		}

		/// Creates StereoSGBM object
		///
		/// ## Parameters
		/// * minDisparity: Minimum possible disparity value. Normally, it is zero but sometimes
		/// rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
		/// * numDisparities: Maximum disparity minus minimum disparity. The value is always greater than
		/// zero. In the current implementation, this parameter must be divisible by 16.
		/// * blockSize: Matched block size. It must be an odd number \>=1 . Normally, it should be
		/// somewhere in the 3..11 range.
		/// * P1: The first parameter controlling the disparity smoothness. See below.
		/// * P2: The second parameter controlling the disparity smoothness. The larger the values are,
		/// the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
		/// between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
		/// pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good
		/// P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and
		/// 32\*number_of_image_channels\*blockSize\*blockSize , respectively).
		/// * disp12MaxDiff: Maximum allowed difference (in integer pixel units) in the left-right
		/// disparity check. Set it to a non-positive value to disable the check.
		/// * preFilterCap: Truncation value for the prefiltered image pixels. The algorithm first
		/// computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
		/// The result values are passed to the Birchfield-Tomasi pixel cost function.
		/// * uniquenessRatio: Margin in percentage by which the best (minimum) computed cost function
		/// value should "win" the second best value to consider the found match correct. Normally, a value
		/// within the 5-15 range is good enough.
		/// * speckleWindowSize: Maximum size of smooth disparity regions to consider their noise speckles
		/// and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
		/// 50-200 range.
		/// * speckleRange: Maximum disparity variation within each connected component. If you do speckle
		/// filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
		/// Normally, 1 or 2 is good enough.
		/// * mode: Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming
		/// algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
		/// huge for HD-size pictures. By default, it is set to false .
		///
		/// The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
		/// set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
		/// to a custom value.
		///
		/// ## Note
		/// This alternative version of [StereoSGBM::create] function uses the following default values for its arguments:
		/// * min_disparity: 0
		/// * num_disparities: 16
		/// * block_size: 3
		/// * p1: 0
		/// * p2: 0
		/// * disp12_max_diff: 0
		/// * pre_filter_cap: 0
		/// * uniqueness_ratio: 0
		/// * speckle_window_size: 0
		/// * speckle_range: 0
		/// * mode: StereoSGBM::MODE_SGBM
		#[inline]
		pub fn create_def() -> Result<core::Ptr<crate::stereo::StereoSGBM>> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_create(ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			let ret = unsafe { core::Ptr::<crate::stereo::StereoSGBM>::opencv_from_extern(ret) };
			Ok(ret)
		}

	}

	/// Constant methods for [crate::stereo::StereoSGBM]
	pub trait StereoSGBMTraitConst: crate::stereo::StereoMatcherTraitConst {
		fn as_raw_StereoSGBM(&self) -> *const c_void;

		#[inline]
		fn get_pre_filter_cap(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_getPreFilterCap_const(self.as_raw_StereoSGBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_uniqueness_ratio(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_getUniquenessRatio_const(self.as_raw_StereoSGBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_p1(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_getP1_const(self.as_raw_StereoSGBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_p2(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_getP2_const(self.as_raw_StereoSGBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn get_mode(&self) -> Result<i32> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_getMode_const(self.as_raw_StereoSGBM(), ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	/// Mutable methods for [crate::stereo::StereoSGBM]
	pub trait StereoSGBMTrait: crate::stereo::StereoMatcherTrait + crate::stereo::StereoSGBMTraitConst {
		fn as_raw_mut_StereoSGBM(&mut self) -> *mut c_void;

		#[inline]
		fn set_pre_filter_cap(&mut self, pre_filter_cap: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_setPreFilterCap_int(self.as_raw_mut_StereoSGBM(), pre_filter_cap, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_uniqueness_ratio(&mut self, uniqueness_ratio: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_setUniquenessRatio_int(self.as_raw_mut_StereoSGBM(), uniqueness_ratio, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_p1(&mut self, p1: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_setP1_int(self.as_raw_mut_StereoSGBM(), p1, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_p2(&mut self, p2: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_setP2_int(self.as_raw_mut_StereoSGBM(), p2, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

		#[inline]
		fn set_mode(&mut self, mode: i32) -> Result<()> {
			return_send!(via ocvrs_return);
			unsafe { sys::cv_StereoSGBM_setMode_int(self.as_raw_mut_StereoSGBM(), mode, ocvrs_return.as_mut_ptr()) };
			return_receive!(ocvrs_return => ret);
			let ret = ret.into_result()?;
			Ok(ret)
		}

	}

	impl std::fmt::Debug for StereoSGBM {
		#[inline]
		fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
			f.debug_struct("StereoSGBM")
				.finish()
		}
	}

	boxed_cast_base! { StereoSGBM, core::Algorithm, cv_StereoSGBM_to_Algorithm }

	boxed_cast_base! { StereoSGBM, crate::stereo::StereoMatcher, cv_StereoSGBM_to_StereoMatcher }

	impl core::AlgorithmTraitConst for StereoSGBM {
		#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
	}

	impl core::AlgorithmTrait for StereoSGBM {
		#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoSGBM, core::AlgorithmTraitConst, as_raw_Algorithm, core::AlgorithmTrait, as_raw_mut_Algorithm }

	impl crate::stereo::StereoMatcherTraitConst for StereoSGBM {
		#[inline] fn as_raw_StereoMatcher(&self) -> *const c_void { self.as_raw() }
	}

	impl crate::stereo::StereoMatcherTrait for StereoSGBM {
		#[inline] fn as_raw_mut_StereoMatcher(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoSGBM, crate::stereo::StereoMatcherTraitConst, as_raw_StereoMatcher, crate::stereo::StereoMatcherTrait, as_raw_mut_StereoMatcher }

	impl crate::stereo::StereoSGBMTraitConst for StereoSGBM {
		#[inline] fn as_raw_StereoSGBM(&self) -> *const c_void { self.as_raw() }
	}

	impl crate::stereo::StereoSGBMTrait for StereoSGBM {
		#[inline] fn as_raw_mut_StereoSGBM(&mut self) -> *mut c_void { self.as_raw_mut() }
	}

	boxed_ref! { StereoSGBM, crate::stereo::StereoSGBMTraitConst, as_raw_StereoSGBM, crate::stereo::StereoSGBMTrait, as_raw_mut_StereoSGBM }

}