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
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
pub mod ptcloud {
//! # Point Clound Processing
use crate::mod_prelude::*;
use crate::{core, sys, types};
pub mod prelude {
pub use super::{OctreeTrait, OctreeTraitConst, OdometryFrameTrait, OdometryFrameTraitConst, OdometrySettingsTrait, OdometrySettingsTraitConst, OdometryTrait, OdometryTraitConst, RgbdNormalsTrait, RgbdNormalsTraitConst, VolumeSettingsTrait, VolumeSettingsTraitConst, VolumeTrait, VolumeTraitConst};
}
pub const N_PYRAMIDS: i32 = 9;
pub const OdometryAlgoType_COMMON: i32 = 0;
pub const OdometryAlgoType_FAST: i32 = 1;
pub const OdometryType_DEPTH: i32 = 0;
pub const OdometryType_RGB: i32 = 1;
pub const OdometryType_RGB_DEPTH: i32 = 2;
/// The pyramid of point clouds, produced from the pyramid of depths
pub const PYR_CLOUD: i32 = 3;
/// The pyramid of depth images
pub const PYR_DEPTH: i32 = 1;
/// The pyramid of dI/dx derivative images
pub const PYR_DIX: i32 = 4;
/// The pyramid of dI/dy derivative images
pub const PYR_DIY: i32 = 5;
/// The pyramid of grayscale images
pub const PYR_IMAGE: i32 = 0;
/// The pyramid of masks
pub const PYR_MASK: i32 = 2;
/// The pyramid of normals
pub const PYR_NORM: i32 = 7;
/// The pyramid of normals masks
pub const PYR_NORMMASK: i32 = 8;
/// The pyramid of "textured" masks (i.e. additional masks for normals or grayscale images)
pub const PYR_TEXMASK: i32 = 6;
/// Color and depth have their natural values and converted to internal formats if needed
pub const RASTERIZE_COMPAT_DISABLED: i32 = 0;
/// Color is natural, Depth is transformed from [-zNear; -zFar] to [0; 1]
/// by the following formula: 
///
/// In this mode the input/output depthBuf is considered to be in this format,
/// therefore it's faster since there're no conversions performed
pub const RASTERIZE_COMPAT_INVDEPTH: i32 = 1;
/// triangles which vertices are given in counterclockwork order are drawn
pub const RASTERIZE_CULLING_CCW: i32 = 2;
/// triangles which vertices are given in clockwork order are drawn
pub const RASTERIZE_CULLING_CW: i32 = 1;
/// all faces are drawn, no culling is actually performed
pub const RASTERIZE_CULLING_NONE: i32 = 0;
/// a color of 1st vertex of each triangle is used
pub const RASTERIZE_SHADING_FLAT: i32 = 1;
/// a color is interpolated between 3 vertices with perspective correction
pub const RASTERIZE_SHADING_SHADED: i32 = 2;
/// a white color is used for the whole triangle
pub const RASTERIZE_SHADING_WHITE: i32 = 0;
pub const RGBD_PLANE_METHOD_DEFAULT: i32 = 0;
pub const RgbdNormals_RGBD_NORMALS_METHOD_CROSS_PRODUCT: i32 = 3;
pub const RgbdNormals_RGBD_NORMALS_METHOD_FALS: i32 = 0;
pub const RgbdNormals_RGBD_NORMALS_METHOD_LINEMOD: i32 = 1;
pub const RgbdNormals_RGBD_NORMALS_METHOD_SRI: i32 = 2;
pub const VolumeType_ColorTSDF: i32 = 2;
pub const VolumeType_HashTSDF: i32 = 1;
pub const VolumeType_TSDF: i32 = 0;
pub const Volume_VOLUME_UNIT: i32 = 0;
pub const Volume_VOXEL: i32 = 1;
/// These constants are used to set the speed and accuracy of odometry
/// ## Parameters
/// * COMMON: accurate but not so fast
/// * FAST: less accurate but faster
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum OdometryAlgoType {
COMMON = 0,
FAST = 1,
}
opencv_type_enum! { crate::ptcloud::OdometryAlgoType { COMMON, FAST } }
/// Indicates what pyramid is to access using getPyramidAt() method:
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum OdometryFramePyramidType {
/// The pyramid of grayscale images
PYR_IMAGE = 0,
/// The pyramid of depth images
PYR_DEPTH = 1,
/// The pyramid of masks
PYR_MASK = 2,
/// The pyramid of point clouds, produced from the pyramid of depths
PYR_CLOUD = 3,
/// The pyramid of dI/dx derivative images
PYR_DIX = 4,
/// The pyramid of dI/dy derivative images
PYR_DIY = 5,
/// The pyramid of "textured" masks (i.e. additional masks for normals or grayscale images)
PYR_TEXMASK = 6,
/// The pyramid of normals
PYR_NORM = 7,
/// The pyramid of normals masks
PYR_NORMMASK = 8,
N_PYRAMIDS = 9,
}
opencv_type_enum! { crate::ptcloud::OdometryFramePyramidType { PYR_IMAGE, PYR_DEPTH, PYR_MASK, PYR_CLOUD, PYR_DIX, PYR_DIY, PYR_TEXMASK, PYR_NORM, PYR_NORMMASK, N_PYRAMIDS } }
/// These constants are used to set a type of data which odometry will use
/// ## Parameters
/// * DEPTH: only depth data
/// * RGB: only rgb image
/// * RGB_DEPTH: depth and rgb data simultaneously
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum OdometryType {
DEPTH = 0,
RGB = 1,
RGB_DEPTH = 2,
}
opencv_type_enum! { crate::ptcloud::OdometryType { DEPTH, RGB, RGB_DEPTH } }
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum RgbdNormals_RgbdNormalsMethod {
RGBD_NORMALS_METHOD_FALS = 0,
RGBD_NORMALS_METHOD_LINEMOD = 1,
RGBD_NORMALS_METHOD_SRI = 2,
RGBD_NORMALS_METHOD_CROSS_PRODUCT = 3,
}
opencv_type_enum! { crate::ptcloud::RgbdNormals_RgbdNormalsMethod { RGBD_NORMALS_METHOD_FALS, RGBD_NORMALS_METHOD_LINEMOD, RGBD_NORMALS_METHOD_SRI, RGBD_NORMALS_METHOD_CROSS_PRODUCT } }
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum RgbdPlaneMethod {
RGBD_PLANE_METHOD_DEFAULT = 0,
}
opencv_type_enum! { crate::ptcloud::RgbdPlaneMethod { RGBD_PLANE_METHOD_DEFAULT } }
/// Face culling settings: what faces are drawn after face culling
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum TriangleCullingMode {
/// all faces are drawn, no culling is actually performed
RASTERIZE_CULLING_NONE = 0,
/// triangles which vertices are given in clockwork order are drawn
RASTERIZE_CULLING_CW = 1,
/// triangles which vertices are given in counterclockwork order are drawn
RASTERIZE_CULLING_CCW = 2,
}
opencv_type_enum! { crate::ptcloud::TriangleCullingMode { RASTERIZE_CULLING_NONE, RASTERIZE_CULLING_CW, RASTERIZE_CULLING_CCW } }
/// GL compatibility settings
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum TriangleGlCompatibleMode {
/// Color and depth have their natural values and converted to internal formats if needed
RASTERIZE_COMPAT_DISABLED = 0,
/// Color is natural, Depth is transformed from [-zNear; -zFar] to [0; 1]
/// by the following formula: 
///
/// In this mode the input/output depthBuf is considered to be in this format,
/// therefore it's faster since there're no conversions performed
RASTERIZE_COMPAT_INVDEPTH = 1,
}
opencv_type_enum! { crate::ptcloud::TriangleGlCompatibleMode { RASTERIZE_COMPAT_DISABLED, RASTERIZE_COMPAT_INVDEPTH } }
/// Triangle fill settings
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum TriangleShadingType {
/// a white color is used for the whole triangle
RASTERIZE_SHADING_WHITE = 0,
/// a color of 1st vertex of each triangle is used
RASTERIZE_SHADING_FLAT = 1,
/// a color is interpolated between 3 vertices with perspective correction
RASTERIZE_SHADING_SHADED = 2,
}
opencv_type_enum! { crate::ptcloud::TriangleShadingType { RASTERIZE_SHADING_WHITE, RASTERIZE_SHADING_FLAT, RASTERIZE_SHADING_SHADED } }
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum VolumeType {
TSDF = 0,
HashTSDF = 1,
ColorTSDF = 2,
}
opencv_type_enum! { crate::ptcloud::VolumeType { TSDF, HashTSDF, ColorTSDF } }
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Volume_BoundingBoxPrecision {
VOLUME_UNIT = 0,
VOXEL = 1,
}
opencv_type_enum! { crate::ptcloud::Volume_BoundingBoxPrecision { VOLUME_UNIT, VOXEL } }
/// ## Parameters
/// * depth: the depth image
/// * in_K:
/// * in_points: the list of xy coordinates
/// * points3d: the resulting 3d points (point is represented by 4 chanels value [x, y, z, 0])
#[inline]
pub fn depth_to3d_sparse(depth: &impl ToInputArray, in_k: &impl ToInputArray, in_points: &impl ToInputArray, points3d: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(in_k);
input_array_arg!(in_points);
output_array_arg!(points3d);
return_send!(via ocvrs_return);
unsafe { sys::cv_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!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Converts a depth image to 3d points. If the mask is empty then the resulting array has the same dimensions as `depth`,
/// otherwise it is 1d vector containing mask-enabled values only.
/// 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 (point is represented by 4 channels value [x, y, z, 0]). They are of the same depth as `depth` if it is CV_32F or CV_64F, and the
/// depth of `K` if `depth` is of depth CV_16U or CV_16S
/// * mask: the mask of the points to consider (can be empty)
///
/// ## Note
/// This alternative version of [depth_to3d] function uses the following default values for its arguments:
/// * mask: noArray()
#[inline]
pub fn depth_to3d_def(depth: &impl ToInputArray, k: &impl ToInputArray, points3d: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(k);
output_array_arg!(points3d);
return_send!(via ocvrs_return);
unsafe { sys::cv_depthTo3d_const__InputArrayR_const__InputArrayR_const__OutputArrayR(depth.as_raw__InputArray(), k.as_raw__InputArray(), points3d.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Converts a depth image to 3d points. If the mask is empty then the resulting array has the same dimensions as `depth`,
/// otherwise it is 1d vector containing mask-enabled values only.
/// 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 (point is represented by 4 channels value [x, y, z, 0]). They are of the same depth as `depth` if it is CV_32F or CV_64F, and the
/// depth of `K` if `depth` is of depth CV_16U or CV_16S
/// * mask: the mask of the points to consider (can be empty)
///
/// ## C++ default parameters
/// * mask: noArray()
#[inline]
pub fn depth_to3d(depth: &impl ToInputArray, k: &impl ToInputArray, points3d: &mut impl ToOutputArray, mask: &impl ToInputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(k);
output_array_arg!(points3d);
input_array_arg!(mask);
return_send!(via ocvrs_return);
unsafe { sys::cv_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!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Find the planes in a depth image
/// ## Parameters
/// * points3d: the 3d points organized like the depth image: rows x cols with 3 channels
/// * normals: the normals for every point in the depth image; optional, can be empty
/// * mask: An image where each pixel is labeled with the plane it belongs to
/// and 255 if it does not belong to any plane
/// * plane_coefficients: the coefficients of the corresponding planes (a,b,c,d) such that ax+by+cz+d=0, norm(a,b,c)=1
/// and c < 0 (so that the normal points towards the camera)
/// * block_size: The size of the blocks to look at for a stable MSE
/// * min_size: The minimum size of a cluster to be considered a plane
/// * threshold: The maximum distance of a point from a plane to belong to it (in meters)
/// * sensor_error_a: coefficient of the sensor error. 0 by default, use 0.0075 for a Kinect
/// * sensor_error_b: coefficient of the sensor error. 0 by default
/// * sensor_error_c: coefficient of the sensor error. 0 by default
/// * method: The method to use to compute the planes.
///
/// ## Note
/// This alternative version of [find_planes] function uses the following default values for its arguments:
/// * block_size: 40
/// * min_size: 40*40
/// * threshold: 0.01
/// * sensor_error_a: 0
/// * sensor_error_b: 0
/// * sensor_error_c: 0
/// * method: RGBD_PLANE_METHOD_DEFAULT
#[inline]
pub fn find_planes_def(points3d: &impl ToInputArray, normals: &impl ToInputArray, mask: &mut impl ToOutputArray, plane_coefficients: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(points3d);
input_array_arg!(normals);
output_array_arg!(mask);
output_array_arg!(plane_coefficients);
return_send!(via ocvrs_return);
unsafe { sys::cv_findPlanes_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR(points3d.as_raw__InputArray(), normals.as_raw__InputArray(), mask.as_raw__OutputArray(), plane_coefficients.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Find the planes in a depth image
/// ## Parameters
/// * points3d: the 3d points organized like the depth image: rows x cols with 3 channels
/// * normals: the normals for every point in the depth image; optional, can be empty
/// * mask: An image where each pixel is labeled with the plane it belongs to
/// and 255 if it does not belong to any plane
/// * plane_coefficients: the coefficients of the corresponding planes (a,b,c,d) such that ax+by+cz+d=0, norm(a,b,c)=1
/// and c < 0 (so that the normal points towards the camera)
/// * block_size: The size of the blocks to look at for a stable MSE
/// * min_size: The minimum size of a cluster to be considered a plane
/// * threshold: The maximum distance of a point from a plane to belong to it (in meters)
/// * sensor_error_a: coefficient of the sensor error. 0 by default, use 0.0075 for a Kinect
/// * sensor_error_b: coefficient of the sensor error. 0 by default
/// * sensor_error_c: coefficient of the sensor error. 0 by default
/// * method: The method to use to compute the planes.
///
/// ## C++ default parameters
/// * block_size: 40
/// * min_size: 40*40
/// * threshold: 0.01
/// * sensor_error_a: 0
/// * sensor_error_b: 0
/// * sensor_error_c: 0
/// * method: RGBD_PLANE_METHOD_DEFAULT
#[inline]
pub fn find_planes(points3d: &impl ToInputArray, normals: &impl ToInputArray, mask: &mut impl ToOutputArray, plane_coefficients: &mut impl ToOutputArray, block_size: i32, min_size: i32, threshold: f64, sensor_error_a: f64, sensor_error_b: f64, sensor_error_c: f64, method: crate::ptcloud::RgbdPlaneMethod) -> Result<()> {
input_array_arg!(points3d);
input_array_arg!(normals);
output_array_arg!(mask);
output_array_arg!(plane_coefficients);
return_send!(via ocvrs_return);
unsafe { sys::cv_findPlanes_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_int_int_double_double_double_double_RgbdPlaneMethod(points3d.as_raw__InputArray(), normals.as_raw__InputArray(), mask.as_raw__OutputArray(), plane_coefficients.as_raw__OutputArray(), block_size, min_size, threshold, sensor_error_a, sensor_error_b, sensor_error_c, method, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Loads a mesh from a file.
///
/// The function loads mesh from the specified file and returns it.
/// If the mesh cannot be read, throws an error
/// Vertex attributes (i.e. space and texture coodinates, normals and colors) are returned in same-sized
/// arrays with corresponding elements having the same indices.
/// This means that if a face uses a vertex with a normal or a texture coordinate with different indices
/// (which is typical for OBJ files for example), this vertex will be duplicated for each face it uses.
///
/// Currently, the following file formats are supported:
/// * [Wavefront obj file *.obj](https://en.wikipedia.org/wiki/Wavefront_.obj_file) (ONLY TRIANGULATED FACES)
/// * [Polygon File Format *.ply](https://en.wikipedia.org/wiki/PLY_(file_format))
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * indices: per-face list of vertices, each value is a vector of ints
/// * normals: per-vertex normals, each value contains 3 floats
/// * colors: per-vertex colors, each value contains 3 floats
/// * texCoords: per-vertex texture coordinates, each value contains 2 or 3 floats
///
/// ## Note
/// This alternative version of [load_mesh] function uses the following default values for its arguments:
/// * normals: noArray()
/// * colors: noArray()
/// * tex_coords: noArray()
#[inline]
pub fn load_mesh_def(filename: &str, vertices: &mut impl ToOutputArray, indices: &mut impl ToOutputArray) -> Result<()> {
extern_container_arg!(filename);
output_array_arg!(vertices);
output_array_arg!(indices);
return_send!(via ocvrs_return);
unsafe { sys::cv_loadMesh_const_StringR_const__OutputArrayR_const__OutputArrayR(filename.opencv_as_extern(), vertices.as_raw__OutputArray(), indices.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Loads a mesh from a file.
///
/// The function loads mesh from the specified file and returns it.
/// If the mesh cannot be read, throws an error
/// Vertex attributes (i.e. space and texture coodinates, normals and colors) are returned in same-sized
/// arrays with corresponding elements having the same indices.
/// This means that if a face uses a vertex with a normal or a texture coordinate with different indices
/// (which is typical for OBJ files for example), this vertex will be duplicated for each face it uses.
///
/// Currently, the following file formats are supported:
/// * [Wavefront obj file *.obj](https://en.wikipedia.org/wiki/Wavefront_.obj_file) (ONLY TRIANGULATED FACES)
/// * [Polygon File Format *.ply](https://en.wikipedia.org/wiki/PLY_(file_format))
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * indices: per-face list of vertices, each value is a vector of ints
/// * normals: per-vertex normals, each value contains 3 floats
/// * colors: per-vertex colors, each value contains 3 floats
/// * texCoords: per-vertex texture coordinates, each value contains 2 or 3 floats
///
/// ## C++ default parameters
/// * normals: noArray()
/// * colors: noArray()
/// * tex_coords: noArray()
#[inline]
pub fn load_mesh(filename: &str, vertices: &mut impl ToOutputArray, indices: &mut impl ToOutputArray, normals: &mut impl ToOutputArray, colors: &mut impl ToOutputArray, tex_coords: &mut impl ToOutputArray) -> Result<()> {
extern_container_arg!(filename);
output_array_arg!(vertices);
output_array_arg!(indices);
output_array_arg!(normals);
output_array_arg!(colors);
output_array_arg!(tex_coords);
return_send!(via ocvrs_return);
unsafe { sys::cv_loadMesh_const_StringR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(filename.opencv_as_extern(), vertices.as_raw__OutputArray(), indices.as_raw__OutputArray(), normals.as_raw__OutputArray(), colors.as_raw__OutputArray(), tex_coords.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Loads a point cloud from a file.
///
/// The function loads point cloud from the specified file and returns it.
/// If the cloud cannot be read, throws an error.
/// Vertex coordinates, normals and colors are returned as they are saved in the file
/// even if these arrays have different sizes and their elements do not correspond to each other
/// (which is typical for OBJ files for example)
///
/// Currently, the following file formats are supported:
/// * [Wavefront obj file *.obj](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
/// * [Polygon File Format *.ply](https://en.wikipedia.org/wiki/PLY_(file_format))
///
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * normals: per-vertex normals, each value contains 3 floats
/// * rgb: per-vertex colors, each value contains 3 floats
///
/// ## Note
/// This alternative version of [load_point_cloud] function uses the following default values for its arguments:
/// * normals: noArray()
/// * rgb: noArray()
#[inline]
pub fn load_point_cloud_def(filename: &str, vertices: &mut impl ToOutputArray) -> Result<()> {
extern_container_arg!(filename);
output_array_arg!(vertices);
return_send!(via ocvrs_return);
unsafe { sys::cv_loadPointCloud_const_StringR_const__OutputArrayR(filename.opencv_as_extern(), vertices.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Loads a point cloud from a file.
///
/// The function loads point cloud from the specified file and returns it.
/// If the cloud cannot be read, throws an error.
/// Vertex coordinates, normals and colors are returned as they are saved in the file
/// even if these arrays have different sizes and their elements do not correspond to each other
/// (which is typical for OBJ files for example)
///
/// Currently, the following file formats are supported:
/// * [Wavefront obj file *.obj](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
/// * [Polygon File Format *.ply](https://en.wikipedia.org/wiki/PLY_(file_format))
///
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * normals: per-vertex normals, each value contains 3 floats
/// * rgb: per-vertex colors, each value contains 3 floats
///
/// ## C++ default parameters
/// * normals: noArray()
/// * rgb: noArray()
#[inline]
pub fn load_point_cloud(filename: &str, vertices: &mut impl ToOutputArray, normals: &mut impl ToOutputArray, rgb: &mut impl ToOutputArray) -> Result<()> {
extern_container_arg!(filename);
output_array_arg!(vertices);
output_array_arg!(normals);
output_array_arg!(rgb);
return_send!(via ocvrs_return);
unsafe { sys::cv_loadPointCloud_const_StringR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(filename.opencv_as_extern(), vertices.as_raw__OutputArray(), normals.as_raw__OutputArray(), rgb.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(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)
///
/// ## Note
/// This alternative version of [register_depth] function uses the following default values for its arguments:
/// * depth_dilation: false
#[inline]
pub fn register_depth_def(unregistered_camera_matrix: &impl ToInputArray, registered_camera_matrix: &impl ToInputArray, registered_dist_coeffs: &impl ToInputArray, rt: &impl ToInputArray, unregistered_depth: &impl ToInputArray, output_image_plane_size: core::Size, registered_depth: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(unregistered_camera_matrix);
input_array_arg!(registered_camera_matrix);
input_array_arg!(registered_dist_coeffs);
input_array_arg!(rt);
input_array_arg!(unregistered_depth);
output_array_arg!(registered_depth);
return_send!(via ocvrs_return);
unsafe { sys::cv_registerDepth_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const_SizeR_const__OutputArrayR(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(), ocvrs_return.as_mut_ptr()) };
return_receive!(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: &impl ToInputArray, registered_camera_matrix: &impl ToInputArray, registered_dist_coeffs: &impl ToInputArray, rt: &impl ToInputArray, unregistered_depth: &impl ToInputArray, output_image_plane_size: core::Size, registered_depth: &mut impl ToOutputArray, depth_dilation: bool) -> Result<()> {
input_array_arg!(unregistered_camera_matrix);
input_array_arg!(registered_camera_matrix);
input_array_arg!(registered_dist_coeffs);
input_array_arg!(rt);
input_array_arg!(unregistered_depth);
output_array_arg!(registered_depth);
return_send!(via ocvrs_return);
unsafe { sys::cv_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!(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)
/// * type: the desired output depth (CV_32F or CV_64F)
/// * out: The rescaled float depth image
/// * depth_factor: (optional) factor by which depth is converted to distance (by default = 1000.0 for Kinect sensor)
///
/// ## Note
/// This alternative version of [rescale_depth] function uses the following default values for its arguments:
/// * depth_factor: 1000.0
#[inline]
pub fn rescale_depth_def(in_: &impl ToInputArray, typ: i32, out: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(in_);
output_array_arg!(out);
return_send!(via ocvrs_return);
unsafe { sys::cv_rescaleDepth_const__InputArrayR_int_const__OutputArrayR(in_.as_raw__InputArray(), typ, out.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(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)
/// * type: the desired output depth (CV_32F or CV_64F)
/// * 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_: &impl ToInputArray, typ: i32, out: &mut impl ToOutputArray, depth_factor: f64) -> Result<()> {
input_array_arg!(in_);
output_array_arg!(out);
return_send!(via ocvrs_return);
unsafe { sys::cv_rescaleDepth_const__InputArrayR_int_const__OutputArrayR_double(in_.as_raw__InputArray(), typ, out.as_raw__OutputArray(), depth_factor, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Saves a mesh to a specified file.
///
/// The function saves mesh to the specified file.
/// File format is chosen based on the filename extension.
///
/// ## Parameters
/// * filename: Name of the file.
/// * vertices: vertex coordinates, each value contains 3 floats
/// * indices: per-face list of vertices, each value is a vector of ints
/// * normals: per-vertex normals, each value contains 3 floats
/// * colors: per-vertex colors, each value contains 3 floats
/// * texCoords: per-vertex texture coordinates, each value contains 2 or 3 floats
///
/// ## Note
/// This alternative version of [save_mesh] function uses the following default values for its arguments:
/// * normals: noArray()
/// * colors: noArray()
/// * tex_coords: noArray()
#[inline]
pub fn save_mesh_def(filename: &str, vertices: &impl ToInputArray, indices: &impl ToInputArray) -> Result<()> {
extern_container_arg!(filename);
input_array_arg!(vertices);
input_array_arg!(indices);
return_send!(via ocvrs_return);
unsafe { sys::cv_saveMesh_const_StringR_const__InputArrayR_const__InputArrayR(filename.opencv_as_extern(), vertices.as_raw__InputArray(), indices.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Saves a mesh to a specified file.
///
/// The function saves mesh to the specified file.
/// File format is chosen based on the filename extension.
///
/// ## Parameters
/// * filename: Name of the file.
/// * vertices: vertex coordinates, each value contains 3 floats
/// * indices: per-face list of vertices, each value is a vector of ints
/// * normals: per-vertex normals, each value contains 3 floats
/// * colors: per-vertex colors, each value contains 3 floats
/// * texCoords: per-vertex texture coordinates, each value contains 2 or 3 floats
///
/// ## C++ default parameters
/// * normals: noArray()
/// * colors: noArray()
/// * tex_coords: noArray()
#[inline]
pub fn save_mesh(filename: &str, vertices: &impl ToInputArray, indices: &impl ToInputArray, normals: &impl ToInputArray, colors: &impl ToInputArray, tex_coords: &impl ToInputArray) -> Result<()> {
extern_container_arg!(filename);
input_array_arg!(vertices);
input_array_arg!(indices);
input_array_arg!(normals);
input_array_arg!(colors);
input_array_arg!(tex_coords);
return_send!(via ocvrs_return);
unsafe { sys::cv_saveMesh_const_StringR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR(filename.opencv_as_extern(), vertices.as_raw__InputArray(), indices.as_raw__InputArray(), normals.as_raw__InputArray(), colors.as_raw__InputArray(), tex_coords.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Saves a point cloud to a specified file.
///
/// The function saves point cloud to the specified file.
/// File format is chosen based on the filename extension.
///
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * normals: per-vertex normals, each value contains 3 floats
/// * rgb: per-vertex colors, each value contains 3 floats
///
/// ## Note
/// This alternative version of [save_point_cloud] function uses the following default values for its arguments:
/// * normals: noArray()
/// * rgb: noArray()
#[inline]
pub fn save_point_cloud_def(filename: &str, vertices: &impl ToInputArray) -> Result<()> {
extern_container_arg!(filename);
input_array_arg!(vertices);
return_send!(via ocvrs_return);
unsafe { sys::cv_savePointCloud_const_StringR_const__InputArrayR(filename.opencv_as_extern(), vertices.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Saves a point cloud to a specified file.
///
/// The function saves point cloud to the specified file.
/// File format is chosen based on the filename extension.
///
/// ## Parameters
/// * filename: Name of the file
/// * vertices: vertex coordinates, each value contains 3 floats
/// * normals: per-vertex normals, each value contains 3 floats
/// * rgb: per-vertex colors, each value contains 3 floats
///
/// ## C++ default parameters
/// * normals: noArray()
/// * rgb: noArray()
#[inline]
pub fn save_point_cloud(filename: &str, vertices: &impl ToInputArray, normals: &impl ToInputArray, rgb: &impl ToInputArray) -> Result<()> {
extern_container_arg!(filename);
input_array_arg!(vertices);
input_array_arg!(normals);
input_array_arg!(rgb);
return_send!(via ocvrs_return);
unsafe { sys::cv_savePointCloud_const_StringR_const__InputArrayR_const__InputArrayR_const__InputArrayR(filename.opencv_as_extern(), vertices.as_raw__InputArray(), normals.as_raw__InputArray(), rgb.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Overloaded version of triangleRasterize() with color-only rendering
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * colors: per-vertex colors of CV_32FC3 type or compatible. Can be empty or the same size as vertices array.
/// If the values are out of [0; 1] range, the result correctness is not guaranteed
/// * colorBuf: an array representing the final rendered image. Should containt CV_32FC3 values and be the same size as depthBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## Note
/// This alternative version of [triangle_rasterize_color] function uses the following default values for its arguments:
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize_color_def(vertices: &impl ToInputArray, indices: &impl ToInputArray, colors: &impl ToInputArray, color_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_array_arg!(colors);
input_output_array_arg!(color_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterizeColor_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), colors.as_raw__InputArray(), color_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Overloaded version of triangleRasterize() with color-only rendering
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * colors: per-vertex colors of CV_32FC3 type or compatible. Can be empty or the same size as vertices array.
/// If the values are out of [0; 1] range, the result correctness is not guaranteed
/// * colorBuf: an array representing the final rendered image. Should containt CV_32FC3 values and be the same size as depthBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## C++ default parameters
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize_color(vertices: &impl ToInputArray, indices: &impl ToInputArray, colors: &impl ToInputArray, color_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64, settings: crate::ptcloud::TriangleRasterizeSettings) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_array_arg!(colors);
input_output_array_arg!(color_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterizeColor_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double_const_TriangleRasterizeSettingsR(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), colors.as_raw__InputArray(), color_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, &settings, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Overloaded version of triangleRasterize() with depth-only rendering
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * depthBuf: an array of floats containing resulting Z buffer. Should contain float values and be the same size as colorBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// Empty scene corresponds to all values set to zFar (or to 1.0 in INVDEPTH mode)
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## Note
/// This alternative version of [triangle_rasterize_depth] function uses the following default values for its arguments:
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize_depth_def(vertices: &impl ToInputArray, indices: &impl ToInputArray, depth_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_output_array_arg!(depth_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterizeDepth_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), depth_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Overloaded version of triangleRasterize() with depth-only rendering
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * depthBuf: an array of floats containing resulting Z buffer. Should contain float values and be the same size as colorBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// Empty scene corresponds to all values set to zFar (or to 1.0 in INVDEPTH mode)
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## C++ default parameters
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize_depth(vertices: &impl ToInputArray, indices: &impl ToInputArray, depth_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64, settings: crate::ptcloud::TriangleRasterizeSettings) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_output_array_arg!(depth_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterizeDepth_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double_const_TriangleRasterizeSettingsR(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), depth_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, &settings, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders a set of triangles on a depth and color image
///
/// Triangles can be drawn white (1.0, 1.0, 1.0), flat-shaded or with a color interpolation between vertices.
/// In flat-shaded mode the 1st vertex color of each triangle is used to fill the whole triangle.
///
/// The world2cam is an inverted camera pose matrix in fact. It transforms vertices from world to
/// camera coordinate system.
///
/// The camera coordinate system emulates the OpenGL's coordinate system having coordinate origin in a screen center,
/// X axis pointing right, Y axis pointing up and Z axis pointing towards the viewer
/// except that image is vertically flipped after the render.
/// This means that all visible objects are placed in z-negative area, or exactly in -zNear > z > -zFar since
/// zNear and zFar are positive.
/// For example, at fovY = PI/2 the point (0, 1, -1) will be projected to (width/2, 0) screen point,
/// (1, 0, -1) to (width/2 + height/2, height/2). Increasing fovY makes projection smaller and vice versa.
///
/// The function does not create or clear output images before the rendering. This means that it can be used
/// for drawing over an existing image or for rendering a model into a 3D scene using pre-filled Z-buffer.
///
/// Empty scene results in a depth buffer filled by the maximum value since every pixel is infinitely far from the camera.
/// Therefore, before rendering anything from scratch the depthBuf should be filled by zFar values (or by ones in INVDEPTH mode).
///
/// There are special versions of this function named triangleRasterizeDepth and triangleRasterizeColor
/// for cases if a user needs a color image or a depth image alone; they may run slightly faster.
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * colors: per-vertex colors of CV_32FC3 type or compatible. Can be empty or the same size as vertices array.
/// If the values are out of [0; 1] range, the result correctness is not guaranteed
/// * colorBuf: an array representing the final rendered image. Should containt CV_32FC3 values and be the same size as depthBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// * depthBuf: an array of floats containing resulting Z buffer. Should contain float values and be the same size as colorBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// Empty scene corresponds to all values set to zFar (or to 1.0 in INVDEPTH mode)
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## Note
/// This alternative version of [triangle_rasterize] function uses the following default values for its arguments:
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize_def(vertices: &impl ToInputArray, indices: &impl ToInputArray, colors: &impl ToInputArray, color_buf: &mut impl ToInputOutputArray, depth_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_array_arg!(colors);
input_output_array_arg!(color_buf);
input_output_array_arg!(depth_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterize_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), colors.as_raw__InputArray(), color_buf.as_raw__InputOutputArray(), depth_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders a set of triangles on a depth and color image
///
/// Triangles can be drawn white (1.0, 1.0, 1.0), flat-shaded or with a color interpolation between vertices.
/// In flat-shaded mode the 1st vertex color of each triangle is used to fill the whole triangle.
///
/// The world2cam is an inverted camera pose matrix in fact. It transforms vertices from world to
/// camera coordinate system.
///
/// The camera coordinate system emulates the OpenGL's coordinate system having coordinate origin in a screen center,
/// X axis pointing right, Y axis pointing up and Z axis pointing towards the viewer
/// except that image is vertically flipped after the render.
/// This means that all visible objects are placed in z-negative area, or exactly in -zNear > z > -zFar since
/// zNear and zFar are positive.
/// For example, at fovY = PI/2 the point (0, 1, -1) will be projected to (width/2, 0) screen point,
/// (1, 0, -1) to (width/2 + height/2, height/2). Increasing fovY makes projection smaller and vice versa.
///
/// The function does not create or clear output images before the rendering. This means that it can be used
/// for drawing over an existing image or for rendering a model into a 3D scene using pre-filled Z-buffer.
///
/// Empty scene results in a depth buffer filled by the maximum value since every pixel is infinitely far from the camera.
/// Therefore, before rendering anything from scratch the depthBuf should be filled by zFar values (or by ones in INVDEPTH mode).
///
/// There are special versions of this function named triangleRasterizeDepth and triangleRasterizeColor
/// for cases if a user needs a color image or a depth image alone; they may run slightly faster.
///
/// ## Parameters
/// * vertices: vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)
/// * indices: triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array.
/// Should contain CV_32SC3 values or compatible
/// * colors: per-vertex colors of CV_32FC3 type or compatible. Can be empty or the same size as vertices array.
/// If the values are out of [0; 1] range, the result correctness is not guaranteed
/// * colorBuf: an array representing the final rendered image. Should containt CV_32FC3 values and be the same size as depthBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// * depthBuf: an array of floats containing resulting Z buffer. Should contain float values and be the same size as colorBuf.
/// Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.
/// Empty scene corresponds to all values set to zFar (or to 1.0 in INVDEPTH mode)
/// * world2cam: a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose
/// * fovY: field of view in vertical direction, given in radians
/// * zNear: minimum Z value to render, everything closer is clipped
/// * zFar: maximum Z value to render, everything farther is clipped
/// * settings: see TriangleRasterizeSettings. By default the smooth shading is on,
/// with CW culling and with disabled GL compatibility
///
/// ## C++ default parameters
/// * settings: TriangleRasterizeSettings()
#[inline]
pub fn triangle_rasterize(vertices: &impl ToInputArray, indices: &impl ToInputArray, colors: &impl ToInputArray, color_buf: &mut impl ToInputOutputArray, depth_buf: &mut impl ToInputOutputArray, world2cam: &impl ToInputArray, fov_y: f64, z_near: f64, z_far: f64, settings: crate::ptcloud::TriangleRasterizeSettings) -> Result<()> {
input_array_arg!(vertices);
input_array_arg!(indices);
input_array_arg!(colors);
input_output_array_arg!(color_buf);
input_output_array_arg!(depth_buf);
input_array_arg!(world2cam);
return_send!(via ocvrs_return);
unsafe { sys::cv_triangleRasterize_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__InputOutputArrayR_const__InputArrayR_double_double_double_const_TriangleRasterizeSettingsR(vertices.as_raw__InputArray(), indices.as_raw__InputArray(), colors.as_raw__InputArray(), color_buf.as_raw__InputOutputArray(), depth_buf.as_raw__InputOutputArray(), world2cam.as_raw__InputArray(), fov_y, z_near, z_far, &settings, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Warps depth or RGB-D image by reprojecting it in 3d, applying Rt transformation
/// and then projecting it back onto the image plane.
/// This function can be used to visualize the results of the Odometry algorithm.
/// ## Parameters
/// * depth: Depth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
/// * image: RGB image (optional), should be 1-, 3- or 4-channel CV_8U
/// * mask: Mask of used pixels (optional), should be CV_8UC1, CV_8SC1 or CV_BoolC1
/// * Rt: Rotation+translation matrix (3x4 or 4x4) to be applied to depth points
/// * cameraMatrix: Camera intrinsics matrix (3x3)
/// * warpedDepth: The warped depth data (optional)
/// * warpedImage: The warped RGB image (optional)
/// * warpedMask: The mask of valid pixels in warped image (optional)
///
/// ## Note
/// This alternative version of [warp_frame] function uses the following default values for its arguments:
/// * warped_depth: noArray()
/// * warped_image: noArray()
/// * warped_mask: noArray()
#[inline]
pub fn warp_frame_def(depth: &impl ToInputArray, image: &impl ToInputArray, mask: &impl ToInputArray, rt: &impl ToInputArray, camera_matrix: &impl ToInputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(image);
input_array_arg!(mask);
input_array_arg!(rt);
input_array_arg!(camera_matrix);
return_send!(via ocvrs_return);
unsafe { sys::cv_warpFrame_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR(depth.as_raw__InputArray(), image.as_raw__InputArray(), mask.as_raw__InputArray(), rt.as_raw__InputArray(), camera_matrix.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Warps depth or RGB-D image by reprojecting it in 3d, applying Rt transformation
/// and then projecting it back onto the image plane.
/// This function can be used to visualize the results of the Odometry algorithm.
/// ## Parameters
/// * depth: Depth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
/// * image: RGB image (optional), should be 1-, 3- or 4-channel CV_8U
/// * mask: Mask of used pixels (optional), should be CV_8UC1, CV_8SC1 or CV_BoolC1
/// * Rt: Rotation+translation matrix (3x4 or 4x4) to be applied to depth points
/// * cameraMatrix: Camera intrinsics matrix (3x3)
/// * warpedDepth: The warped depth data (optional)
/// * warpedImage: The warped RGB image (optional)
/// * warpedMask: The mask of valid pixels in warped image (optional)
///
/// ## C++ default parameters
/// * warped_depth: noArray()
/// * warped_image: noArray()
/// * warped_mask: noArray()
#[inline]
pub fn warp_frame(depth: &impl ToInputArray, image: &impl ToInputArray, mask: &impl ToInputArray, rt: &impl ToInputArray, camera_matrix: &impl ToInputArray, warped_depth: &mut impl ToOutputArray, warped_image: &mut impl ToOutputArray, warped_mask: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(image);
input_array_arg!(mask);
input_array_arg!(rt);
input_array_arg!(camera_matrix);
output_array_arg!(warped_depth);
output_array_arg!(warped_image);
output_array_arg!(warped_mask);
return_send!(via ocvrs_return);
unsafe { sys::cv_warpFrame_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(depth.as_raw__InputArray(), image.as_raw__InputArray(), mask.as_raw__InputArray(), rt.as_raw__InputArray(), camera_matrix.as_raw__InputArray(), warped_depth.as_raw__OutputArray(), warped_image.as_raw__OutputArray(), warped_mask.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Octree for 3D vision.
///
/// In 3D vision filed, the Octree is used to process and accelerate the pointcloud data. The class Octree represents
/// the Octree data structure. Each Octree will have a fixed depth. The depth of Octree refers to the distance from
/// the root node to the leaf node.All OctreeNodes will not exceed this depth.Increasing the depth will increase
/// the amount of calculation exponentially. And the small number of depth refers low resolution of Octree.
/// Each node contains 8 children, which are used to divide the space cube into eight parts. Each octree node represents
/// a cube. And these eight children will have a fixed order, the order is described as follows:
///
/// For illustration, assume,
///
/// rootNode: origin == (0, 0, 0), size == 2
///
/// Then,
///
/// children[0]: origin == (0, 0, 0), size == 1
///
/// children[1]: origin == (1, 0, 0), size == 1, along X-axis next to child 0
///
/// children[2]: origin == (0, 1, 0), size == 1, along Y-axis next to child 0
///
/// children[3]: origin == (1, 1, 0), size == 1, in X-Y plane
///
/// children[4]: origin == (0, 0, 1), size == 1, along Z-axis next to child 0
///
/// children[5]: origin == (1, 0, 1), size == 1, in X-Z plane
///
/// children[6]: origin == (0, 1, 1), size == 1, in Y-Z plane
///
/// children[7]: origin == (1, 1, 1), size == 1, furthest from child 0
pub struct Octree {
ptr: *mut c_void,
}
opencv_type_boxed! { Octree }
impl Drop for Octree {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_Octree_delete(self.as_raw_mut_Octree()) };
}
}
unsafe impl Send for Octree {}
impl Octree {
/// Default constructor.
#[inline]
pub fn default() -> Result<crate::ptcloud::Octree> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_Octree(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Octree::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Creates an empty Octree with given maximum depth
///
/// ## Parameters
/// * maxDepth: The max depth of the Octree
/// * size: bounding box size for the Octree
/// * origin: Initial center coordinate
/// * withColors: Whether to keep per-point colors or not
/// ## Returns
/// resulting Octree
///
/// ## C++ default parameters
/// * origin: {}
/// * with_colors: false
#[inline]
pub fn create_with_depth(max_depth: i32, size: f64, origin: core::Point3f, with_colors: bool) -> Result<core::Ptr<crate::ptcloud::Octree>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithDepth_int_double_const_Point3fR_bool(max_depth, size, &origin, with_colors, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Creates an empty Octree with given maximum depth
///
/// ## Parameters
/// * maxDepth: The max depth of the Octree
/// * size: bounding box size for the Octree
/// * origin: Initial center coordinate
/// * withColors: Whether to keep per-point colors or not
/// ## Returns
/// resulting Octree
///
/// ## Note
/// This alternative version of [Octree::create_with_depth] function uses the following default values for its arguments:
/// * origin: {}
/// * with_colors: false
#[inline]
pub fn create_with_depth_def(max_depth: i32, size: f64) -> Result<core::Ptr<crate::ptcloud::Octree>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithDepth_int_double(max_depth, size, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Create an Octree from the PointCloud data with the specific maxDepth
///
/// ## Parameters
/// * maxDepth: Max depth of the octree
/// * pointCloud: point cloud data, should be 3-channel float array
/// * colors: color attribute of point cloud in the same 3-channel float format
/// ## Returns
/// resulting Octree
///
/// ## C++ default parameters
/// * colors: noArray()
#[inline]
pub fn create_with_depth_1(max_depth: i32, point_cloud: &impl ToInputArray, colors: &impl ToInputArray) -> Result<core::Ptr<crate::ptcloud::Octree>> {
input_array_arg!(point_cloud);
input_array_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithDepth_int_const__InputArrayR_const__InputArrayR(max_depth, point_cloud.as_raw__InputArray(), colors.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Create an Octree from the PointCloud data with the specific maxDepth
///
/// ## Parameters
/// * maxDepth: Max depth of the octree
/// * pointCloud: point cloud data, should be 3-channel float array
/// * colors: color attribute of point cloud in the same 3-channel float format
/// ## Returns
/// resulting Octree
///
/// ## Note
/// This alternative version of [Octree::create_with_depth] function uses the following default values for its arguments:
/// * colors: noArray()
#[inline]
pub fn create_with_depth_def_1(max_depth: i32, point_cloud: &impl ToInputArray) -> Result<core::Ptr<crate::ptcloud::Octree>> {
input_array_arg!(point_cloud);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithDepth_int_const__InputArrayR(max_depth, point_cloud.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Creates an empty Octree with given resolution
///
/// ## Parameters
/// * resolution: The size of the octree leaf node
/// * size: bounding box size for the Octree
/// * origin: Initial center coordinate
/// * withColors: Whether to keep per-point colors or not
/// ## Returns
/// resulting Octree
///
/// ## C++ default parameters
/// * origin: {}
/// * with_colors: false
#[inline]
pub fn create_with_resolution(resolution: f64, size: f64, origin: core::Point3f, with_colors: bool) -> Result<core::Ptr<crate::ptcloud::Octree>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithResolution_double_double_const_Point3fR_bool(resolution, size, &origin, with_colors, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Creates an empty Octree with given resolution
///
/// ## Parameters
/// * resolution: The size of the octree leaf node
/// * size: bounding box size for the Octree
/// * origin: Initial center coordinate
/// * withColors: Whether to keep per-point colors or not
/// ## Returns
/// resulting Octree
///
/// ## Note
/// This alternative version of [Octree::create_with_resolution] function uses the following default values for its arguments:
/// * origin: {}
/// * with_colors: false
#[inline]
pub fn create_with_resolution_def(resolution: f64, size: f64) -> Result<core::Ptr<crate::ptcloud::Octree>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithResolution_double_double(resolution, size, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Create an Octree from the PointCloud data with the specific resolution
///
/// ## Parameters
/// * resolution: The size of the octree leaf node
/// * pointCloud: point cloud data, should be 3-channel float array
/// * colors: color attribute of point cloud in the same 3-channel float format
/// ## Returns
/// resulting octree
///
/// ## C++ default parameters
/// * colors: noArray()
#[inline]
pub fn create_with_resolution_1(resolution: f64, point_cloud: &impl ToInputArray, colors: &impl ToInputArray) -> Result<core::Ptr<crate::ptcloud::Octree>> {
input_array_arg!(point_cloud);
input_array_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithResolution_double_const__InputArrayR_const__InputArrayR(resolution, point_cloud.as_raw__InputArray(), colors.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Create an Octree from the PointCloud data with the specific resolution
///
/// ## Parameters
/// * resolution: The size of the octree leaf node
/// * pointCloud: point cloud data, should be 3-channel float array
/// * colors: color attribute of point cloud in the same 3-channel float format
/// ## Returns
/// resulting octree
///
/// ## Note
/// This alternative version of [Octree::create_with_resolution] function uses the following default values for its arguments:
/// * colors: noArray()
#[inline]
pub fn create_with_resolution_def_1(resolution: f64, point_cloud: &impl ToInputArray) -> Result<core::Ptr<crate::ptcloud::Octree>> {
input_array_arg!(point_cloud);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_createWithResolution_double_const__InputArrayR(resolution, point_cloud.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::Octree>::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::Octree]
pub trait OctreeTraitConst {
fn as_raw_Octree(&self) -> *const c_void;
/// Determine whether the point is within the space range of the specific cube.
///
/// ## Parameters
/// * point: The point coordinates.
/// ## Returns
/// If point is in bound, return ture. Otherwise, false.
#[inline]
fn is_point_in_bound(&self, point: core::Point3f) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_isPointInBound_const_const_Point3fR(self.as_raw_Octree(), &point, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// returns true if the rootnode is NULL.
#[inline]
fn empty(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_empty_const(self.as_raw_Octree(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Radius Nearest Neighbor Search in Octree.
///
/// Search all points that are less than or equal to radius.
/// And return the number of searched points.
/// ## Parameters
/// * query: Query point.
/// * radius: Retrieved radius value.
/// * points: Point output. Contains searched points in 3-float format, and output vector is not in order,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains searched squared distance in floats, and output vector is not in order,
/// can be omitted if not needed
/// ## Returns
/// the number of searched points.
///
/// ## C++ default parameters
/// * square_dists: noArray()
#[inline]
fn radius_nn_search(&self, query: core::Point3f, radius: f32, points: &mut impl ToOutputArray, square_dists: &mut impl ToOutputArray) -> Result<i32> {
output_array_arg!(points);
output_array_arg!(square_dists);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_radiusNNSearch_const_const_Point3fR_float_const__OutputArrayR_const__OutputArrayR(self.as_raw_Octree(), &query, radius, points.as_raw__OutputArray(), square_dists.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Radius Nearest Neighbor Search in Octree.
///
/// Search all points that are less than or equal to radius.
/// And return the number of searched points.
/// ## Parameters
/// * query: Query point.
/// * radius: Retrieved radius value.
/// * points: Point output. Contains searched points in 3-float format, and output vector is not in order,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains searched squared distance in floats, and output vector is not in order,
/// can be omitted if not needed
/// ## Returns
/// the number of searched points.
///
/// ## Note
/// This alternative version of [OctreeTraitConst::radius_nn_search] function uses the following default values for its arguments:
/// * square_dists: noArray()
#[inline]
fn radius_nn_search_def(&self, query: core::Point3f, radius: f32, points: &mut impl ToOutputArray) -> Result<i32> {
output_array_arg!(points);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_radiusNNSearch_const_const_Point3fR_float_const__OutputArrayR(self.as_raw_Octree(), &query, radius, points.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Radius Nearest Neighbor Search in Octree.
///
/// Search all points that are less than or equal to radius.
/// And return the number of searched points.
/// ## Parameters
/// * query: Query point.
/// * radius: Retrieved radius value.
/// * points: Point output. Contains searched points in 3-float format, and output vector is not in order,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains searched squared distance in floats, and output vector is not in order,
/// can be omitted if not needed
/// ## Returns
/// the number of searched points.
///
/// ## Overloaded parameters
///
/// Radius Nearest Neighbor Search in Octree.
///
/// Search all points that are less than or equal to radius.
/// And return the number of searched points.
/// * query: Query point.
/// * radius: Retrieved radius value.
/// * points: Point output. Contains searched points in 3-float format, and output vector is not in order,
/// can be replaced by noArray() if not needed
/// * colors: Color output. Contains colors corresponding to points in pointSet, can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains searched squared distance in floats, and output vector is not in order,
/// can be replaced by noArray() if not needed
/// ## Returns
/// the number of searched points.
#[inline]
fn radius_nn_search_1(&self, query: core::Point3f, radius: f32, points: &mut impl ToOutputArray, colors: &mut impl ToOutputArray, square_dists: &mut impl ToOutputArray) -> Result<i32> {
output_array_arg!(points);
output_array_arg!(colors);
output_array_arg!(square_dists);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_radiusNNSearch_const_const_Point3fR_float_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Octree(), &query, radius, points.as_raw__OutputArray(), colors.as_raw__OutputArray(), square_dists.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// K Nearest Neighbor Search in Octree.
///
/// Find the K nearest neighbors to the query point.
/// ## Parameters
/// * query: Query point.
/// * K: amount of nearest neighbors to find
/// * points: Point output. Contains K points in 3-float format, arranged in order of distance from near to far,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains K squared distance in floats, arranged in order of distance from near to far,
/// can be omitted if not needed
///
/// ## C++ default parameters
/// * square_dists: noArray()
#[inline]
fn knn_search(&self, query: core::Point3f, k: i32, points: &mut impl ToOutputArray, square_dists: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(points);
output_array_arg!(square_dists);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_KNNSearch_const_const_Point3fR_const_int_const__OutputArrayR_const__OutputArrayR(self.as_raw_Octree(), &query, k, points.as_raw__OutputArray(), square_dists.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// K Nearest Neighbor Search in Octree.
///
/// Find the K nearest neighbors to the query point.
/// ## Parameters
/// * query: Query point.
/// * K: amount of nearest neighbors to find
/// * points: Point output. Contains K points in 3-float format, arranged in order of distance from near to far,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains K squared distance in floats, arranged in order of distance from near to far,
/// can be omitted if not needed
///
/// ## Note
/// This alternative version of [OctreeTraitConst::knn_search] function uses the following default values for its arguments:
/// * square_dists: noArray()
#[inline]
fn knn_search_def(&self, query: core::Point3f, k: i32, points: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(points);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_KNNSearch_const_const_Point3fR_const_int_const__OutputArrayR(self.as_raw_Octree(), &query, k, points.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// K Nearest Neighbor Search in Octree.
///
/// Find the K nearest neighbors to the query point.
/// ## Parameters
/// * query: Query point.
/// * K: amount of nearest neighbors to find
/// * points: Point output. Contains K points in 3-float format, arranged in order of distance from near to far,
/// can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains K squared distance in floats, arranged in order of distance from near to far,
/// can be omitted if not needed
///
/// ## Overloaded parameters
///
/// K Nearest Neighbor Search in Octree.
///
/// Find the K nearest neighbors to the query point.
/// * query: Query point.
/// * K: amount of nearest neighbors to find
/// * points: Point output. Contains K points in 3-float format, arranged in order of distance from near to far,
/// can be replaced by noArray() if not needed
/// * colors: Color output. Contains colors corresponding to points in pointSet, can be replaced by noArray() if not needed
/// * squareDists: Dist output. Contains K squared distance in floats, arranged in order of distance from near to far,
/// can be replaced by noArray() if not needed
#[inline]
fn knn_search_1(&self, query: core::Point3f, k: i32, points: &mut impl ToOutputArray, colors: &mut impl ToOutputArray, square_dists: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(points);
output_array_arg!(colors);
output_array_arg!(square_dists);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_KNNSearch_const_const_Point3fR_const_int_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Octree(), &query, k, points.as_raw__OutputArray(), colors.as_raw__OutputArray(), square_dists.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::Octree]
pub trait OctreeTrait: crate::ptcloud::OctreeTraitConst {
fn as_raw_mut_Octree(&mut self) -> *mut c_void;
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Insert a point data with color to a OctreeNode.
///
/// ## Parameters
/// * point: The point data in Point3f format.
/// * color: The color attribute of point in Point3f format.
/// ## Returns
/// Returns whether the insertion is successful.
///
/// ## C++ default parameters
/// * color: {}
#[inline]
fn insert_point(&mut self, point: core::Point3f, color: core::Point3f) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_insertPoint_const_Point3fR_const_Point3fR(self.as_raw_mut_Octree(), &point, &color, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
/// Insert a point data with color to a OctreeNode.
///
/// ## Parameters
/// * point: The point data in Point3f format.
/// * color: The color attribute of point in Point3f format.
/// ## Returns
/// Returns whether the insertion is successful.
///
/// ## Note
/// This alternative version of [OctreeTrait::insert_point] function uses the following default values for its arguments:
/// * color: {}
#[inline]
fn insert_point_def(&mut self, point: core::Point3f) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_insertPoint_const_Point3fR(self.as_raw_mut_Octree(), &point, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Reset all octree parameter.
///
/// Clear all the nodes of the octree and initialize the parameters.
#[inline]
fn clear(&mut self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_clear(self.as_raw_mut_Octree(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Delete a given point from the Octree.
///
/// Delete the corresponding element from the pointList in the corresponding leaf node. If the leaf node
/// does not contain other points after deletion, this node will be deleted. In the same way,
/// its parent node may also be deleted if its last child is deleted.
/// ## Parameters
/// * point: The point coordinates, comparison is epsilon-based
/// ## Returns
/// return ture if the point is deleted successfully.
#[inline]
fn delete_point(&mut self, point: core::Point3f) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_deletePoint_const_Point3fR(self.as_raw_mut_Octree(), &point, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// restore point cloud data from Octree.
///
/// Restore the point cloud data from existing octree. The points in same leaf node will be seen as the same point.
/// This point is the center of the leaf node. If the resolution is small, it will work as a downSampling function.
/// ## Parameters
/// * restoredPointCloud: The output point cloud data, can be replaced by noArray() if not needed
/// * restoredColor: The color attribute of point cloud data, can be omitted if not needed
///
/// ## C++ default parameters
/// * restored_color: noArray()
#[inline]
fn get_point_cloud_by_octree(&mut self, restored_point_cloud: &mut impl ToOutputArray, restored_color: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(restored_point_cloud);
output_array_arg!(restored_color);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_getPointCloudByOctree_const__OutputArrayR_const__OutputArrayR(self.as_raw_mut_Octree(), restored_point_cloud.as_raw__OutputArray(), restored_color.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// restore point cloud data from Octree.
///
/// Restore the point cloud data from existing octree. The points in same leaf node will be seen as the same point.
/// This point is the center of the leaf node. If the resolution is small, it will work as a downSampling function.
/// ## Parameters
/// * restoredPointCloud: The output point cloud data, can be replaced by noArray() if not needed
/// * restoredColor: The color attribute of point cloud data, can be omitted if not needed
///
/// ## Note
/// This alternative version of [OctreeTrait::get_point_cloud_by_octree] function uses the following default values for its arguments:
/// * restored_color: noArray()
#[inline]
fn get_point_cloud_by_octree_def(&mut self, restored_point_cloud: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(restored_point_cloud);
return_send!(via ocvrs_return);
unsafe { sys::cv_Octree_getPointCloudByOctree_const__OutputArrayR(self.as_raw_mut_Octree(), restored_point_cloud.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl std::fmt::Debug for Octree {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Octree")
.finish()
}
}
impl crate::ptcloud::OctreeTraitConst for Octree {
#[inline] fn as_raw_Octree(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::OctreeTrait for Octree {
#[inline] fn as_raw_mut_Octree(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { Octree, crate::ptcloud::OctreeTraitConst, as_raw_Octree, crate::ptcloud::OctreeTrait, as_raw_mut_Octree }
pub struct Odometry {
ptr: *mut c_void,
}
opencv_type_boxed! { Odometry }
impl Drop for Odometry {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_Odometry_delete(self.as_raw_mut_Odometry()) };
}
}
unsafe impl Send for Odometry {}
impl Odometry {
#[inline]
pub fn default() -> Result<crate::ptcloud::Odometry> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_Odometry(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Odometry::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn new(otype: crate::ptcloud::OdometryType) -> Result<crate::ptcloud::Odometry> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_Odometry_OdometryType(otype, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Odometry::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn new_1(otype: crate::ptcloud::OdometryType, settings: &impl crate::ptcloud::OdometrySettingsTraitConst, algtype: crate::ptcloud::OdometryAlgoType) -> Result<crate::ptcloud::Odometry> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_Odometry_OdometryType_const_OdometrySettingsR_OdometryAlgoType(otype, settings.as_raw_OdometrySettings(), algtype, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Odometry::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::Odometry]
pub trait OdometryTraitConst {
fn as_raw_Odometry(&self) -> *const c_void;
/// Prepare frame for odometry calculation
/// ## Parameters
/// * frame: odometry prepare this frame as src frame and dst frame simultaneously
#[inline]
fn prepare_frame(&self, frame: &mut impl crate::ptcloud::OdometryFrameTrait) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_prepareFrame_const_OdometryFrameR(self.as_raw_Odometry(), frame.as_raw_mut_OdometryFrame(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Prepare frame for odometry calculation
/// ## Parameters
/// * srcFrame: frame will be prepared as src frame ("original" image)
/// * dstFrame: frame will be prepared as dsr frame ("rotated" image)
#[inline]
fn prepare_frames(&self, src_frame: &mut impl crate::ptcloud::OdometryFrameTrait, dst_frame: &mut impl crate::ptcloud::OdometryFrameTrait) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_prepareFrames_const_OdometryFrameR_OdometryFrameR(self.as_raw_Odometry(), src_frame.as_raw_mut_OdometryFrame(), dst_frame.as_raw_mut_OdometryFrame(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Compute Rigid Transformation between two frames so that Rt * src = dst
/// Both frames, source and destination, should have been prepared by calling prepareFrame() first
///
/// ## Parameters
/// * srcFrame: src frame ("original" image)
/// * dstFrame: dst frame ("rotated" image)
/// * Rt: Rigid transformation, which will be calculated, in form:
/// { R_11 R_12 R_13 t_1
/// R_21 R_22 R_23 t_2
/// R_31 R_32 R_33 t_3
/// 0 0 0 1 }
/// ## Returns
/// true on success, false if failed to find the transformation
#[inline]
fn compute(&self, src_frame: &impl crate::ptcloud::OdometryFrameTraitConst, dst_frame: &impl crate::ptcloud::OdometryFrameTraitConst, rt: &mut impl ToOutputArray) -> Result<bool> {
output_array_arg!(rt);
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_compute_const_const_OdometryFrameR_const_OdometryFrameR_const__OutputArrayR(self.as_raw_Odometry(), src_frame.as_raw_OdometryFrame(), dst_frame.as_raw_OdometryFrame(), rt.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Compute Rigid Transformation between two frames so that Rt * src = dst
///
/// ## Parameters
/// * srcDepth: source depth ("original" image)
/// * dstDepth: destination depth ("rotated" image)
/// * Rt: Rigid transformation, which will be calculated, in form:
/// { R_11 R_12 R_13 t_1
/// R_21 R_22 R_23 t_2
/// R_31 R_32 R_33 t_3
/// 0 0 0 1 }
/// ## Returns
/// true on success, false if failed to find the transformation
#[inline]
fn compute_1(&self, src_depth: &impl ToInputArray, dst_depth: &impl ToInputArray, rt: &mut impl ToOutputArray) -> Result<bool> {
input_array_arg!(src_depth);
input_array_arg!(dst_depth);
output_array_arg!(rt);
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_compute_const_const__InputArrayR_const__InputArrayR_const__OutputArrayR(self.as_raw_Odometry(), src_depth.as_raw__InputArray(), dst_depth.as_raw__InputArray(), rt.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Compute Rigid Transformation between two frames so that Rt * src = dst
///
/// ## Parameters
/// * srcDepth: source depth ("original" image)
/// * srcRGB: source RGB
/// * dstDepth: destination depth ("rotated" image)
/// * dstRGB: destination RGB
/// * Rt: Rigid transformation, which will be calculated, in form:
/// { R_11 R_12 R_13 t_1
/// R_21 R_22 R_23 t_2
/// R_31 R_32 R_33 t_3
/// 0 0 0 1 }
/// ## Returns
/// true on success, false if failed to find the transformation
#[inline]
fn compute_2(&self, src_depth: &impl ToInputArray, src_rgb: &impl ToInputArray, dst_depth: &impl ToInputArray, dst_rgb: &impl ToInputArray, rt: &mut impl ToOutputArray) -> Result<bool> {
input_array_arg!(src_depth);
input_array_arg!(src_rgb);
input_array_arg!(dst_depth);
input_array_arg!(dst_rgb);
output_array_arg!(rt);
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_compute_const_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__OutputArrayR(self.as_raw_Odometry(), src_depth.as_raw__InputArray(), src_rgb.as_raw__InputArray(), dst_depth.as_raw__InputArray(), dst_rgb.as_raw__InputArray(), rt.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the normals computer object used for normals calculation (if presented).
/// The normals computer is generated at first need during prepareFrame when normals are required for the ICP algorithm
/// but not presented by a user. Re-generated each time the related settings change or a new frame arrives with the different size.
#[inline]
fn get_normals_computer(&self) -> Result<core::Ptr<crate::ptcloud::RgbdNormals>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Odometry_getNormalsComputer_const(self.as_raw_Odometry(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::RgbdNormals>::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::Odometry]
pub trait OdometryTrait: crate::ptcloud::OdometryTraitConst {
fn as_raw_mut_Odometry(&mut self) -> *mut c_void;
}
impl std::fmt::Debug for Odometry {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Odometry")
.finish()
}
}
impl crate::ptcloud::OdometryTraitConst for Odometry {
#[inline] fn as_raw_Odometry(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::OdometryTrait for Odometry {
#[inline] fn as_raw_mut_Odometry(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { Odometry, crate::ptcloud::OdometryTraitConst, as_raw_Odometry, crate::ptcloud::OdometryTrait, as_raw_mut_Odometry }
/// An object that keeps per-frame data for Odometry algorithms from user-provided images to algorithm-specific precalculated data.
/// When not empty, it contains a depth image, a mask of valid pixels and a set of pyramids generated from that data.
/// A BGR/Gray image and normals are optional.
/// OdometryFrame is made to be used together with Odometry class to reuse precalculated data between Rt data calculations.
/// A correct way to do that is to call Odometry::prepareFrames() on prev and next frames and then pass them to Odometry::compute() method.
pub struct OdometryFrame {
ptr: *mut c_void,
}
opencv_type_boxed! { OdometryFrame }
impl Drop for OdometryFrame {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_OdometryFrame_delete(self.as_raw_mut_OdometryFrame()) };
}
}
unsafe impl Send for OdometryFrame {}
impl OdometryFrame {
/// Construct a new OdometryFrame object. All non-empty images should have the same size.
///
/// ## Parameters
/// * depth: A depth image, should be CV_8UC1
/// * image: An BGR or grayscale image (or noArray() if it's not required for used ICP algorithm).
/// Should be CV_8UC3 or CV_8C4 if it's BGR image or CV_8UC1 if it's grayscale. If it's BGR then it's converted to grayscale
/// image automatically.
/// * mask: A user-provided mask of valid pixels, should be CV_8UC1
/// * normals: A user-provided normals to the depth surface, should be CV_32FC4
///
/// ## C++ default parameters
/// * depth: noArray()
/// * image: noArray()
/// * mask: noArray()
/// * normals: noArray()
#[inline]
pub fn new(depth: &impl ToInputArray, image: &impl ToInputArray, mask: &impl ToInputArray, normals: &impl ToInputArray) -> Result<crate::ptcloud::OdometryFrame> {
input_array_arg!(depth);
input_array_arg!(image);
input_array_arg!(mask);
input_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_OdometryFrame_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputArrayR(depth.as_raw__InputArray(), image.as_raw__InputArray(), mask.as_raw__InputArray(), normals.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::OdometryFrame::opencv_from_extern(ret) };
Ok(ret)
}
/// Construct a new OdometryFrame object. All non-empty images should have the same size.
///
/// ## Parameters
/// * depth: A depth image, should be CV_8UC1
/// * image: An BGR or grayscale image (or noArray() if it's not required for used ICP algorithm).
/// Should be CV_8UC3 or CV_8C4 if it's BGR image or CV_8UC1 if it's grayscale. If it's BGR then it's converted to grayscale
/// image automatically.
/// * mask: A user-provided mask of valid pixels, should be CV_8UC1
/// * normals: A user-provided normals to the depth surface, should be CV_32FC4
///
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * depth: noArray()
/// * image: noArray()
/// * mask: noArray()
/// * normals: noArray()
#[inline]
pub fn new_def() -> Result<crate::ptcloud::OdometryFrame> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_OdometryFrame(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::OdometryFrame::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::OdometryFrame]
pub trait OdometryFrameTraitConst {
fn as_raw_OdometryFrame(&self) -> *const c_void;
/// Get the original user-provided BGR/Gray image
///
/// ## Parameters
/// * image: Output image
#[inline]
fn get_image(&self, image: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(image);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getImage_const_const__OutputArrayR(self.as_raw_OdometryFrame(), image.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the gray image generated from the user-provided BGR/Gray image
///
/// ## Parameters
/// * image: Output image
#[inline]
fn get_gray_image(&self, image: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(image);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getGrayImage_const_const__OutputArrayR(self.as_raw_OdometryFrame(), image.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the original user-provided depth image
///
/// ## Parameters
/// * depth: Output image
#[inline]
fn get_depth(&self, depth: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(depth);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getDepth_const_const__OutputArrayR(self.as_raw_OdometryFrame(), depth.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the depth image generated from the user-provided one after conversion, rescale or filtering for ICP algorithm needs
///
/// ## Parameters
/// * depth: Output image
#[inline]
fn get_processed_depth(&self, depth: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(depth);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getProcessedDepth_const_const__OutputArrayR(self.as_raw_OdometryFrame(), depth.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the valid pixels mask generated for the ICP calculations intersected with the user-provided mask
///
/// ## Parameters
/// * mask: Output image
#[inline]
fn get_mask(&self, mask: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(mask);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getMask_const_const__OutputArrayR(self.as_raw_OdometryFrame(), mask.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the normals image either generated for the ICP calculations or user-provided
///
/// ## Parameters
/// * normals: Output image
#[inline]
fn get_normals(&self, normals: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getNormals_const_const__OutputArrayR(self.as_raw_OdometryFrame(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the amount of levels in pyramids (all of them if not empty should have the same number of levels)
/// or 0 if no pyramids were prepared yet
#[inline]
fn get_pyramid_levels(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getPyramidLevels_const(self.as_raw_OdometryFrame(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Get the image generated for the ICP calculations from one of the pyramids specified by pyrType. Returns empty image if
/// the pyramid is empty or there's no such pyramid level
///
/// ## Parameters
/// * img: Output image
/// * pyrType: Type of pyramid
/// * level: Level in the pyramid
#[inline]
fn get_pyramid_at(&self, img: &mut impl ToOutputArray, pyr_type: crate::ptcloud::OdometryFramePyramidType, level: size_t) -> Result<()> {
output_array_arg!(img);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometryFrame_getPyramidAt_const_const__OutputArrayR_OdometryFramePyramidType_size_t(self.as_raw_OdometryFrame(), img.as_raw__OutputArray(), pyr_type, level, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::OdometryFrame]
pub trait OdometryFrameTrait: crate::ptcloud::OdometryFrameTraitConst {
fn as_raw_mut_OdometryFrame(&mut self) -> *mut c_void;
}
impl Clone for OdometryFrame {
#[inline]
fn clone(&self) -> Self {
unsafe { Self::from_raw(sys::cv_OdometryFrame_implicitClone_const(self.as_raw_OdometryFrame())) }
}
}
impl std::fmt::Debug for OdometryFrame {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("OdometryFrame")
.finish()
}
}
impl crate::ptcloud::OdometryFrameTraitConst for OdometryFrame {
#[inline] fn as_raw_OdometryFrame(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::OdometryFrameTrait for OdometryFrame {
#[inline] fn as_raw_mut_OdometryFrame(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { OdometryFrame, crate::ptcloud::OdometryFrameTraitConst, as_raw_OdometryFrame, crate::ptcloud::OdometryFrameTrait, as_raw_mut_OdometryFrame }
pub struct OdometrySettings {
ptr: *mut c_void,
}
opencv_type_boxed! { OdometrySettings }
impl Drop for OdometrySettings {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_OdometrySettings_delete(self.as_raw_mut_OdometrySettings()) };
}
}
unsafe impl Send for OdometrySettings {}
impl OdometrySettings {
#[inline]
pub fn default() -> Result<crate::ptcloud::OdometrySettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_OdometrySettings(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::OdometrySettings::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn copy(unnamed: &impl crate::ptcloud::OdometrySettingsTraitConst) -> Result<crate::ptcloud::OdometrySettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_OdometrySettings_const_OdometrySettingsR(unnamed.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::OdometrySettings::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::OdometrySettings]
pub trait OdometrySettingsTraitConst {
fn as_raw_OdometrySettings(&self) -> *const c_void;
#[inline]
fn get_camera_matrix(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getCameraMatrix_const_const__OutputArrayR(self.as_raw_OdometrySettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_iter_counts(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getIterCounts_const_const__OutputArrayR(self.as_raw_OdometrySettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_min_depth(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMinDepth_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_depth(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMaxDepth_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_depth_diff(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMaxDepthDiff_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_points_part(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMaxPointsPart_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_sobel_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getSobelSize_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_sobel_scale(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getSobelScale_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_normal_win_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getNormalWinSize_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_normal_diff_threshold(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getNormalDiffThreshold_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_normal_method(&self) -> Result<crate::ptcloud::RgbdNormals_RgbdNormalsMethod> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getNormalMethod_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_angle_threshold(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getAngleThreshold_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_translation(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMaxTranslation_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_rotation(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMaxRotation_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_min_gradient_magnitude(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMinGradientMagnitude_const(self.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_min_gradient_magnitudes(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_getMinGradientMagnitudes_const_const__OutputArrayR(self.as_raw_OdometrySettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::OdometrySettings]
pub trait OdometrySettingsTrait: crate::ptcloud::OdometrySettingsTraitConst {
fn as_raw_mut_OdometrySettings(&mut self) -> *mut c_void;
#[inline]
fn set(&mut self, unnamed: &impl crate::ptcloud::OdometrySettingsTraitConst) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_operatorST_const_OdometrySettingsR(self.as_raw_mut_OdometrySettings(), unnamed.as_raw_OdometrySettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_camera_matrix(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setCameraMatrix_const__InputArrayR(self.as_raw_mut_OdometrySettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_iter_counts(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setIterCounts_const__InputArrayR(self.as_raw_mut_OdometrySettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_min_depth(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMinDepth_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_depth(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMaxDepth_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_depth_diff(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMaxDepthDiff_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_points_part(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMaxPointsPart_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_sobel_size(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setSobelSize_int(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_sobel_scale(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setSobelScale_double(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_normal_win_size(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setNormalWinSize_int(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_normal_diff_threshold(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setNormalDiffThreshold_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_normal_method(&mut self, nm: crate::ptcloud::RgbdNormals_RgbdNormalsMethod) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setNormalMethod_RgbdNormalsMethod(self.as_raw_mut_OdometrySettings(), nm, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_angle_threshold(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setAngleThreshold_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_translation(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMaxTranslation_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_rotation(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMaxRotation_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_min_gradient_magnitude(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMinGradientMagnitude_float(self.as_raw_mut_OdometrySettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_min_gradient_magnitudes(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_OdometrySettings_setMinGradientMagnitudes_const__InputArrayR(self.as_raw_mut_OdometrySettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl Clone for OdometrySettings {
#[inline]
fn clone(&self) -> Self {
unsafe { Self::from_raw(sys::cv_OdometrySettings_implicitClone_const(self.as_raw_OdometrySettings())) }
}
}
impl std::fmt::Debug for OdometrySettings {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("OdometrySettings")
.finish()
}
}
impl crate::ptcloud::OdometrySettingsTraitConst for OdometrySettings {
#[inline] fn as_raw_OdometrySettings(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::OdometrySettingsTrait for OdometrySettings {
#[inline] fn as_raw_mut_OdometrySettings(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { OdometrySettings, crate::ptcloud::OdometrySettingsTraitConst, as_raw_OdometrySettings, crate::ptcloud::OdometrySettingsTrait, as_raw_mut_OdometrySettings }
/// Object that can compute the normals in an image.
/// It is an object as it can cache data for speed efficiency
/// The implemented methods are either:
/// - FALS (the fastest) and SRI from
/// ``Fast and Accurate Computation of Surface Normals from Range Images``
/// by H. Badino, D. Huber, Y. Park and T. Kanade
/// - the normals with bilateral filtering on a depth image from
/// ``Gradient Response Maps for Real-Time Detection of Texture-Less Objects``
/// by S. Hinterstoisser, C. Cagniart, S. Ilic, P. Sturm, N. Navab, P. Fua, and V. Lepetit
pub struct RgbdNormals {
ptr: *mut c_void,
}
opencv_type_boxed! { RgbdNormals }
impl Drop for RgbdNormals {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_RgbdNormals_delete(self.as_raw_mut_RgbdNormals()) };
}
}
unsafe impl Send for RgbdNormals {}
impl RgbdNormals {
/// Creates new RgbdNormals object
/// ## Parameters
/// * rows: the number of rows of the depth image normals will be computed on
/// * cols: the number of cols of the depth image normals will be computed on
/// * depth: the depth of the normals (only CV_32F or CV_64F)
/// * K: the calibration matrix to use
/// * window_size: the window size to compute the normals: can only be 1,3,5 or 7
/// * diff_threshold: threshold in depth difference, used in LINEMOD algirithm
/// * method: one of the methods to use: RGBD_NORMALS_METHOD_SRI, RGBD_NORMALS_METHOD_FALS
///
/// ## C++ default parameters
/// * rows: 0
/// * cols: 0
/// * depth: 0
/// * k: noArray()
/// * window_size: 5
/// * diff_threshold: 50.f
/// * method: RgbdNormals::RgbdNormalsMethod::RGBD_NORMALS_METHOD_FALS
#[inline]
pub fn create(rows: i32, cols: i32, depth: i32, k: &impl ToInputArray, window_size: i32, diff_threshold: f32, method: crate::ptcloud::RgbdNormals_RgbdNormalsMethod) -> Result<core::Ptr<crate::ptcloud::RgbdNormals>> {
input_array_arg!(k);
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_create_int_int_int_const__InputArrayR_int_float_RgbdNormalsMethod(rows, cols, depth, k.as_raw__InputArray(), window_size, diff_threshold, method, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::RgbdNormals>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates new RgbdNormals object
/// ## Parameters
/// * rows: the number of rows of the depth image normals will be computed on
/// * cols: the number of cols of the depth image normals will be computed on
/// * depth: the depth of the normals (only CV_32F or CV_64F)
/// * K: the calibration matrix to use
/// * window_size: the window size to compute the normals: can only be 1,3,5 or 7
/// * diff_threshold: threshold in depth difference, used in LINEMOD algirithm
/// * method: one of the methods to use: RGBD_NORMALS_METHOD_SRI, RGBD_NORMALS_METHOD_FALS
///
/// ## Note
/// This alternative version of [RgbdNormals::create] function uses the following default values for its arguments:
/// * rows: 0
/// * cols: 0
/// * depth: 0
/// * k: noArray()
/// * window_size: 5
/// * diff_threshold: 50.f
/// * method: RgbdNormals::RgbdNormalsMethod::RGBD_NORMALS_METHOD_FALS
#[inline]
pub fn create_def() -> Result<core::Ptr<crate::ptcloud::RgbdNormals>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_create(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::ptcloud::RgbdNormals>::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::RgbdNormals]
pub trait RgbdNormalsTraitConst {
fn as_raw_RgbdNormals(&self) -> *const c_void;
/// Given a set of 3d points in a depth image, compute the normals at each point.
/// ## Parameters
/// * points: a rows x cols x 3 matrix of CV_32F/CV64F or a rows x cols x 1 CV_U16S
/// * normals: a rows x cols x 3 matrix
#[inline]
fn apply(&self, points: &impl ToInputArray, normals: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(points);
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_apply_const_const__InputArrayR_const__OutputArrayR(self.as_raw_RgbdNormals(), points.as_raw__InputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Prepares cached data required for calculation
/// If not called by user, called automatically at first calculation
#[inline]
fn cache(&self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_cache_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_rows(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getRows_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_cols(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getCols_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_window_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getWindowSize_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_depth(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getDepth_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_k(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getK_const_const__OutputArrayR(self.as_raw_RgbdNormals(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_method(&self) -> Result<crate::ptcloud::RgbdNormals_RgbdNormalsMethod> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_getMethod_const(self.as_raw_RgbdNormals(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::RgbdNormals]
pub trait RgbdNormalsTrait: crate::ptcloud::RgbdNormalsTraitConst {
fn as_raw_mut_RgbdNormals(&mut self) -> *mut c_void;
#[inline]
fn set_rows(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_setRows_int(self.as_raw_mut_RgbdNormals(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_cols(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_setCols_int(self.as_raw_mut_RgbdNormals(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_window_size(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_setWindowSize_int(self.as_raw_mut_RgbdNormals(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_k(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_RgbdNormals_setK_const__InputArrayR(self.as_raw_mut_RgbdNormals(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl std::fmt::Debug for RgbdNormals {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RgbdNormals")
.finish()
}
}
impl crate::ptcloud::RgbdNormalsTraitConst for RgbdNormals {
#[inline] fn as_raw_RgbdNormals(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::RgbdNormalsTrait for RgbdNormals {
#[inline] fn as_raw_mut_RgbdNormals(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { RgbdNormals, crate::ptcloud::RgbdNormalsTraitConst, as_raw_RgbdNormals, crate::ptcloud::RgbdNormalsTrait, as_raw_mut_RgbdNormals }
/// Structure to keep settings for rasterization
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct TriangleRasterizeSettings {
pub shading_type: crate::ptcloud::TriangleShadingType,
pub culling_mode: crate::ptcloud::TriangleCullingMode,
pub gl_compatible_mode: crate::ptcloud::TriangleGlCompatibleMode,
}
opencv_type_simple! { crate::ptcloud::TriangleRasterizeSettings }
impl TriangleRasterizeSettings {
#[inline]
pub fn default() -> Result<crate::ptcloud::TriangleRasterizeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_TriangleRasterizeSettings_TriangleRasterizeSettings(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn set_shading_type(self, st: crate::ptcloud::TriangleShadingType) -> Result<crate::ptcloud::TriangleRasterizeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_TriangleRasterizeSettings_setShadingType_TriangleShadingType(&self, st, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn set_culling_mode(self, cm: crate::ptcloud::TriangleCullingMode) -> Result<crate::ptcloud::TriangleRasterizeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_TriangleRasterizeSettings_setCullingMode_TriangleCullingMode(&self, cm, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn set_gl_compatible_mode(self, gm: crate::ptcloud::TriangleGlCompatibleMode) -> Result<crate::ptcloud::TriangleRasterizeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_TriangleRasterizeSettings_setGlCompatibleMode_TriangleGlCompatibleMode(&self, gm, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
pub struct Volume {
ptr: *mut c_void,
}
opencv_type_boxed! { Volume }
impl Drop for Volume {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_Volume_delete(self.as_raw_mut_Volume()) };
}
}
unsafe impl Send for Volume {}
impl Volume {
/// Constructor of custom volume.
/// ## Parameters
/// * vtype: the volume type [TSDF, HashTSDF, ColorTSDF].
/// * settings: the custom settings for volume.
///
/// ## C++ default parameters
/// * vtype: VolumeType::TSDF
/// * settings: VolumeSettings(VolumeType::TSDF)
#[inline]
pub fn new(vtype: crate::ptcloud::VolumeType, settings: &impl crate::ptcloud::VolumeSettingsTraitConst) -> Result<crate::ptcloud::Volume> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_Volume_VolumeType_const_VolumeSettingsR(vtype, settings.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Volume::opencv_from_extern(ret) };
Ok(ret)
}
/// Constructor of custom volume.
/// ## Parameters
/// * vtype: the volume type [TSDF, HashTSDF, ColorTSDF].
/// * settings: the custom settings for volume.
///
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * vtype: VolumeType::TSDF
/// * settings: VolumeSettings(VolumeType::TSDF)
#[inline]
pub fn new_def() -> Result<crate::ptcloud::Volume> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_Volume(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::Volume::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::Volume]
pub trait VolumeTraitConst {
fn as_raw_Volume(&self) -> *const c_void;
/// Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.
///
/// Rendered image size and camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * cameraPose: the pose of camera in global coordinates.
/// * points: image to store rendered points.
/// * normals: image to store rendered normals corresponding to points.
#[inline]
fn raycast(&self, camera_pose: &impl ToInputArray, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(camera_pose);
output_array_arg!(points);
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_raycast_const_const__InputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), camera_pose.as_raw__InputArray(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.
///
/// Rendered image size and camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * cameraPose: the pose of camera in global coordinates.
/// * points: image to store rendered points.
/// * normals: image to store rendered normals corresponding to points.
/// * colors: image to store rendered colors corresponding to points (only for ColorTSDF).
#[inline]
fn raycast_color(&self, camera_pose: &impl ToInputArray, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray, colors: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(camera_pose);
output_array_arg!(points);
output_array_arg!(normals);
output_array_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_raycast_const_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), camera_pose.as_raw__InputArray(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), colors.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.
///
/// Rendered image size and camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * cameraPose: the pose of camera in global coordinates.
/// * height: the height of result image
/// * width: the width of result image
/// * K: camera raycast intrinsics
/// * points: image to store rendered points.
/// * normals: image to store rendered normals corresponding to points.
#[inline]
fn raycast_ex(&self, camera_pose: &impl ToInputArray, height: i32, width: i32, k: &impl ToInputArray, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(camera_pose);
input_array_arg!(k);
output_array_arg!(points);
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_raycast_const_const__InputArrayR_int_int_const__InputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), camera_pose.as_raw__InputArray(), height, width, k.as_raw__InputArray(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.
///
/// Rendered image size and camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * cameraPose: the pose of camera in global coordinates.
/// * height: the height of result image
/// * width: the width of result image
/// * K: camera raycast intrinsics
/// * points: image to store rendered points.
/// * normals: image to store rendered normals corresponding to points.
/// * colors: image to store rendered colors corresponding to points (only for ColorTSDF).
#[inline]
fn raycast_ex_color(&self, camera_pose: &impl ToInputArray, height: i32, width: i32, k: &impl ToInputArray, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray, colors: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(camera_pose);
input_array_arg!(k);
output_array_arg!(points);
output_array_arg!(normals);
output_array_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_raycast_const_const__InputArrayR_int_int_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), camera_pose.as_raw__InputArray(), height, width, k.as_raw__InputArray(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), colors.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Extract the all data from volume.
/// ## Parameters
/// * points: the input exist point.
/// * normals: the storage of normals (corresponding to input points) in the image.
#[inline]
fn fetch_normals(&self, points: &impl ToInputArray, normals: &mut impl ToOutputArray) -> Result<()> {
input_array_arg!(points);
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_fetchNormals_const_const__InputArrayR_const__OutputArrayR(self.as_raw_Volume(), points.as_raw__InputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Extract the all data from volume.
/// ## Parameters
/// * points: the storage of all points.
/// * normals: the storage of all normals, corresponding to points.
#[inline]
fn fetch_points_normals(&self, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(points);
output_array_arg!(normals);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_fetchPointsNormals_const_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Extract the all data from volume.
/// ## Parameters
/// * points: the storage of all points.
/// * normals: the storage of all normals, corresponding to points.
/// * colors: the storage of all colors, corresponding to points (only for ColorTSDF).
#[inline]
fn fetch_points_normals_colors(&self, points: &mut impl ToOutputArray, normals: &mut impl ToOutputArray, colors: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(points);
output_array_arg!(normals);
output_array_arg!(colors);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_fetchPointsNormalsColors_const_const__OutputArrayR_const__OutputArrayR_const__OutputArrayR(self.as_raw_Volume(), points.as_raw__OutputArray(), normals.as_raw__OutputArray(), colors.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// return visible blocks in volume.
#[inline]
fn get_visible_blocks(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_getVisibleBlocks_const(self.as_raw_Volume(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// return number of volume units in volume.
#[inline]
fn get_total_volume_units(&self) -> Result<size_t> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_getTotalVolumeUnits_const(self.as_raw_Volume(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Gets bounding box in volume coordinates with given precision:
/// VOLUME_UNIT - up to volume unit
/// VOXEL - up to voxel (currently not supported)
/// ## Parameters
/// * bb: 6-float 1d array containing (min_x, min_y, min_z, max_x, max_y, max_z) in volume coordinates
/// * precision: bounding box calculation precision
#[inline]
fn get_bounding_box(&self, bb: &mut impl ToOutputArray, precision: i32) -> Result<()> {
output_array_arg!(bb);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_getBoundingBox_const_const__OutputArrayR_int(self.as_raw_Volume(), bb.as_raw__OutputArray(), precision, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns if new volume units are allocated during integration or not.
/// Makes sense for HashTSDF only.
#[inline]
fn get_enable_growth(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_getEnableGrowth_const(self.as_raw_Volume(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::Volume]
pub trait VolumeTrait: crate::ptcloud::VolumeTraitConst {
fn as_raw_mut_Volume(&mut self) -> *mut c_void;
/// Integrates the input data to the volume.
///
/// Camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * frame: the object from which to take depth and image data.
/// For color TSDF a depth data should be registered with color data, i.e. have the same intrinsics & camera pose.
/// This can be done using function registerDepth() from 3d module.
/// * pose: the pose of camera in global coordinates.
#[inline]
fn integrate_frame(&mut self, frame: &impl crate::ptcloud::OdometryFrameTraitConst, pose: &impl ToInputArray) -> Result<()> {
input_array_arg!(pose);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_integrate_const_OdometryFrameR_const__InputArrayR(self.as_raw_mut_Volume(), frame.as_raw_OdometryFrame(), pose.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Integrates the input data to the volume.
///
/// Camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * depth: the depth image.
/// * pose: the pose of camera in global coordinates.
#[inline]
fn integrate(&mut self, depth: &impl ToInputArray, pose: &impl ToInputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(pose);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_integrate_const__InputArrayR_const__InputArrayR(self.as_raw_mut_Volume(), depth.as_raw__InputArray(), pose.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Integrates the input data to the volume.
///
/// Camera intrinsics are taken from volume settings structure.
///
/// ## Parameters
/// * depth: the depth image.
/// * image: the color image (only for ColorTSDF).
/// For color TSDF a depth data should be registered with color data, i.e. have the same intrinsics & camera pose.
/// This can be done using function registerDepth() from 3d module.
/// * pose: the pose of camera in global coordinates.
#[inline]
fn integrate_color(&mut self, depth: &impl ToInputArray, image: &impl ToInputArray, pose: &impl ToInputArray) -> Result<()> {
input_array_arg!(depth);
input_array_arg!(image);
input_array_arg!(pose);
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_integrate_const__InputArrayR_const__InputArrayR_const__InputArrayR(self.as_raw_mut_Volume(), depth.as_raw__InputArray(), image.as_raw__InputArray(), pose.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// clear all data in volume.
#[inline]
fn reset(&mut self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_reset(self.as_raw_mut_Volume(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Enables or disables new volume unit allocation during integration.
/// Makes sense for HashTSDF only.
#[inline]
fn set_enable_growth(&mut self, v: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_Volume_setEnableGrowth_bool(self.as_raw_mut_Volume(), v, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl std::fmt::Debug for Volume {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Volume")
.finish()
}
}
impl crate::ptcloud::VolumeTraitConst for Volume {
#[inline] fn as_raw_Volume(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::VolumeTrait for Volume {
#[inline] fn as_raw_mut_Volume(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { Volume, crate::ptcloud::VolumeTraitConst, as_raw_Volume, crate::ptcloud::VolumeTrait, as_raw_mut_Volume }
pub struct VolumeSettings {
ptr: *mut c_void,
}
opencv_type_boxed! { VolumeSettings }
impl Drop for VolumeSettings {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_VolumeSettings_delete(self.as_raw_mut_VolumeSettings()) };
}
}
unsafe impl Send for VolumeSettings {}
impl VolumeSettings {
/// Constructor of settings for custom Volume type.
/// ## Parameters
/// * volumeType: volume type.
///
/// ## C++ default parameters
/// * volume_type: VolumeType::TSDF
#[inline]
pub fn new(volume_type: crate::ptcloud::VolumeType) -> Result<crate::ptcloud::VolumeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_VolumeSettings_VolumeType(volume_type, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::VolumeSettings::opencv_from_extern(ret) };
Ok(ret)
}
/// Constructor of settings for custom Volume type.
/// ## Parameters
/// * volumeType: volume type.
///
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * volume_type: VolumeType::TSDF
#[inline]
pub fn new_def() -> Result<crate::ptcloud::VolumeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_VolumeSettings(ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::VolumeSettings::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn copy(vs: &impl crate::ptcloud::VolumeSettingsTraitConst) -> Result<crate::ptcloud::VolumeSettings> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_VolumeSettings_const_VolumeSettingsR(vs.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::ptcloud::VolumeSettings::opencv_from_extern(ret) };
Ok(ret)
}
}
/// Constant methods for [crate::ptcloud::VolumeSettings]
pub trait VolumeSettingsTraitConst {
fn as_raw_VolumeSettings(&self) -> *const c_void;
/// Returns the width of the image for integration.
#[inline]
fn get_integrate_width(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getIntegrateWidth_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns the height of the image for integration.
#[inline]
fn get_integrate_height(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getIntegrateHeight_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns the width of the raycasted image, used when user does not provide it at raycast() call.
#[inline]
fn get_raycast_width(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getRaycastWidth_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns the height of the raycasted image, used when user does not provide it at raycast() call.
#[inline]
fn get_raycast_height(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getRaycastHeight_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns depth factor, witch is the number for depth scaling.
#[inline]
fn get_depth_factor(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getDepthFactor_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns the size of voxel.
#[inline]
fn get_voxel_size(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getVoxelSize_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns TSDF truncation distance. Distances greater than value from surface will be truncated to 1.0.
#[inline]
fn get_tsdf_truncate_distance(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getTsdfTruncateDistance_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns threshold for depth truncation in meters. Truncates the depth greater than threshold to 0.
#[inline]
fn get_max_depth(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getMaxDepth_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns max number of frames to integrate per voxel.
/// Represents the max number of frames over which a running average of the TSDF is calculated for a voxel.
#[inline]
fn get_max_weight(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getMaxWeight_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns length of single raycast step.
/// Describes the percentage of voxel length that is skipped per march.
#[inline]
fn get_raycast_step_factor(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getRaycastStepFactor_const(self.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets volume pose.
/// ## Parameters
/// * val: output value.
#[inline]
fn get_volume_pose(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getVolumePose_const_const__OutputArrayR(self.as_raw_VolumeSettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Resolution of voxel space.
/// Number of voxels in each dimension.
/// Applicable only for TSDF Volume.
/// HashTSDF volume only supports equal resolution in all three dimensions.
/// ## Parameters
/// * val: output value.
#[inline]
fn get_volume_resolution(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getVolumeResolution_const_const__OutputArrayR(self.as_raw_VolumeSettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns 3 integers representing strides by x, y and z dimension.
/// Can be used to iterate over raw volume unit data.
/// ## Parameters
/// * val: output value.
#[inline]
fn get_volume_strides(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getVolumeStrides_const_const__OutputArrayR(self.as_raw_VolumeSettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns intrinsics of camera for integrations.
/// Format of output:
/// [ fx 0 cx ]
/// [ 0 fy cy ]
/// [ 0 0 1 ]
/// where fx and fy are focus points of Ox and Oy axises, and cx and cy are central points of Ox and Oy axises.
/// ## Parameters
/// * val: output value.
#[inline]
fn get_camera_integrate_intrinsics(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getCameraIntegrateIntrinsics_const_const__OutputArrayR(self.as_raw_VolumeSettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Returns camera intrinsics for raycast image, used when user does not provide them at raycast() call.
/// Format of output:
/// [ fx 0 cx ]
/// [ 0 fy cy ]
/// [ 0 0 1 ]
/// where fx and fy are focus points of Ox and Oy axises, and cx and cy are central points of Ox and Oy axises.
/// ## Parameters
/// * val: output value.
#[inline]
fn get_camera_raycast_intrinsics(&self, val: &mut impl ToOutputArray) -> Result<()> {
output_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_getCameraRaycastIntrinsics_const_const__OutputArrayR(self.as_raw_VolumeSettings(), val.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::ptcloud::VolumeSettings]
pub trait VolumeSettingsTrait: crate::ptcloud::VolumeSettingsTraitConst {
fn as_raw_mut_VolumeSettings(&mut self) -> *mut c_void;
#[inline]
fn set(&mut self, unnamed: &impl crate::ptcloud::VolumeSettingsTraitConst) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_operatorST_const_VolumeSettingsR(self.as_raw_mut_VolumeSettings(), unnamed.as_raw_VolumeSettings(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets the width of the image for integration.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_integrate_width(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setIntegrateWidth_int(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets the height of the image for integration.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_integrate_height(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setIntegrateHeight_int(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets the width of the raycasted image, used when user does not provide it at raycast() call.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_raycast_width(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setRaycastWidth_int(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets the height of the raycasted image, used when user does not provide it at raycast() call.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_raycast_height(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setRaycastHeight_int(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets depth factor, witch is the number for depth scaling.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_depth_factor(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setDepthFactor_float(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets the size of voxel.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_voxel_size(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setVoxelSize_float(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets TSDF truncation distance. Distances greater than value from surface will be truncated to 1.0.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_tsdf_truncate_distance(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setTsdfTruncateDistance_float(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets threshold for depth truncation in meters. Truncates the depth greater than threshold to 0.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_max_depth(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setMaxDepth_float(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets max number of frames to integrate per voxel.
/// Represents the max number of frames over which a running average of the TSDF is calculated for a voxel.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_max_weight(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setMaxWeight_int(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets length of single raycast step.
/// Describes the percentage of voxel length that is skipped per march.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_raycast_step_factor(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setRaycastStepFactor_float(self.as_raw_mut_VolumeSettings(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets volume pose.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_volume_pose(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setVolumePose_const__InputArrayR(self.as_raw_mut_VolumeSettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Resolution of voxel space.
/// Number of voxels in each dimension.
/// Applicable only for TSDF Volume.
/// HashTSDF volume only supports equal resolution in all three dimensions.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_volume_resolution(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setVolumeResolution_const__InputArrayR(self.as_raw_mut_VolumeSettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets intrinsics of camera for integrations.
/// Format of input:
/// [ fx 0 cx ]
/// [ 0 fy cy ]
/// [ 0 0 1 ]
/// where fx and fy are focus points of Ox and Oy axises, and cx and cy are central points of Ox and Oy axises.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_camera_integrate_intrinsics(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setCameraIntegrateIntrinsics_const__InputArrayR(self.as_raw_mut_VolumeSettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Sets camera intrinsics for raycast image which, used when user does not provide them at raycast() call.
/// Format of input:
/// [ fx 0 cx ]
/// [ 0 fy cy ]
/// [ 0 0 1 ]
/// where fx and fy are focus points of Ox and Oy axises, and cx and cy are central points of Ox and Oy axises.
/// ## Parameters
/// * val: input value.
#[inline]
fn set_camera_raycast_intrinsics(&mut self, val: &impl ToInputArray) -> Result<()> {
input_array_arg!(val);
return_send!(via ocvrs_return);
unsafe { sys::cv_VolumeSettings_setCameraRaycastIntrinsics_const__InputArrayR(self.as_raw_mut_VolumeSettings(), val.as_raw__InputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl Clone for VolumeSettings {
#[inline]
fn clone(&self) -> Self {
unsafe { Self::from_raw(sys::cv_VolumeSettings_implicitClone_const(self.as_raw_VolumeSettings())) }
}
}
impl std::fmt::Debug for VolumeSettings {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("VolumeSettings")
.finish()
}
}
impl crate::ptcloud::VolumeSettingsTraitConst for VolumeSettings {
#[inline] fn as_raw_VolumeSettings(&self) -> *const c_void { self.as_raw() }
}
impl crate::ptcloud::VolumeSettingsTrait for VolumeSettings {
#[inline] fn as_raw_mut_VolumeSettings(&mut self) -> *mut c_void { self.as_raw_mut() }
}
boxed_ref! { VolumeSettings, crate::ptcloud::VolumeSettingsTraitConst, as_raw_VolumeSettings, crate::ptcloud::VolumeSettingsTrait, as_raw_mut_VolumeSettings }
}