objc2-vision 0.3.2

Bindings to the Vision framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-image")]
use objc2_core_image::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
#[cfg(feature = "objc2-core-ml")]
use objc2_core_ml::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// VNObservation describes the results of performing a VNRequest. The result has a confidence score. The different types of requests will create different subclasses of VNObservation to return their results in properties of those subclasses.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnobservation?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNObservation {}
);

unsafe impl CopyingHelper for VNObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNObservation {}
);

impl VNObservation {
    extern_methods!(
        /// The unique identifier assigned to an observation.
        #[unsafe(method(uuid))]
        #[unsafe(method_family = none)]
        pub unsafe fn uuid(&self) -> Retained<NSUUID>;

        #[cfg(feature = "VNTypes")]
        /// The level of confidence normalized to [0, 1] where 1 is most confident. The only exception is results coming from VNCoreMLRequest, where confidence values are forwarded as is from relevant CoreML models
        ///
        /// Confidence can always be returned as 1.0 if confidence is not supported or has no meaning
        #[unsafe(method(confidence))]
        #[unsafe(method_family = none)]
        pub unsafe fn confidence(&self) -> VNConfidence;

        #[cfg(feature = "objc2-core-media")]
        /// The duration of the observation reporting when first detected and how long it is valid.
        ///
        /// The duration of the observation when used with a sequence of buffers. If a request does not support a timeRange or the timeRange is not known, the start time and duration will be set to 0.
        #[unsafe(method(timeRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn timeRange(&self) -> CMTimeRange;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNDetectedObjectObservation is VNObservation in an image that has a location and/or dimension. Further attributes depend on the specific detected object.
    ///
    /// All result objects (faces, scene objects, shapes etc) must extend from this class.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectedobjectobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNDetectedObjectObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNDetectedObjectObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNDetectedObjectObservation {}
);

unsafe impl CopyingHelper for VNDetectedObjectObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNDetectedObjectObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNDetectedObjectObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNDetectedObjectObservation {}
);

impl VNDetectedObjectObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The bounding box of the detected object. The coordinates are normalized to the dimensions of the processed image, with the origin at the image's lower-left corner.
        #[unsafe(method(boundingBox))]
        #[unsafe(method_family = none)]
        pub unsafe fn boundingBox(&self) -> CGRect;

        /// The resulting CVPixelBuffer from requests that generate a segmentation mask for the entire image.
        #[unsafe(method(globalSegmentationMask))]
        #[unsafe(method_family = none)]
        pub unsafe fn globalSegmentationMask(&self) -> Option<Retained<VNPixelBufferObservation>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNDetectedObjectObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNFaceObservation is the result of a face detection request or derivatives like a face landmark request.
    ///
    /// The properties filled in this obervation depend on the request being performed. For instance, if just a VNDetectFaceRectanglesRequest was performed the landmarks will not be populated. VNFaceObservation are also used as inputs to other request as defined by the VNFaceObservationAccepting protocol. An example would be the VNDetectFaceLandmarksRequest. This can be helpful for instance if the face rectangles in an image are not derived from a VNDetectFaceRectanglesRequest but instead come from other sources like EXIF or other face detectors. In that case the client of the API creates a VNFaceObservation with the boundingBox (in normalized coordinates) that were based on those detected faces.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnfaceobservation?language=objc)
    #[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNFaceObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNFaceObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNFaceObservation {}
);

unsafe impl CopyingHelper for VNFaceObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNFaceObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNFaceObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNFaceObservation {}
);

impl VNFaceObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Create a new VNFaceObservation with a normalized bounding box, roll and yaw.
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectFaceRectanglesRequest that provided the bounding box.  If this observation is being created with data that did not originate from a Vision request, this parameter should be VNRequestRevisionUnspecified.
        ///
        /// Parameter `roll`: The roll angle of the face, reported in radians.  A positive angle corresponds to counterclockwise direction, range [-Pi, Pi). If no roll information is available, this parameter should be nil.
        ///
        /// Parameter `yaw`: The yaw angle of the face, reported in radians.  A positive angle corresponds to counterclockwise direction, range [-Pi/2, Pi/2). If no yaw information is available, this parameter should be nil.
        ///
        /// Parameter `pitch`: The pitch angle of the face, reported in radians.  A positive angle corresponds to nodding head down direction, range [-Pi/2, Pi/2]. If no pitch information is available, this parameter should be nil.
        #[deprecated]
        #[unsafe(method(faceObservationWithRequestRevision:boundingBox:roll:yaw:))]
        #[unsafe(method_family = none)]
        pub unsafe fn faceObservationWithRequestRevision_boundingBox_roll_yaw(
            request_revision: NSUInteger,
            bounding_box: CGRect,
            roll: Option<&NSNumber>,
            yaw: Option<&NSNumber>,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(faceObservationWithRequestRevision:boundingBox:roll:yaw:pitch:))]
        #[unsafe(method_family = none)]
        pub unsafe fn faceObservationWithRequestRevision_boundingBox_roll_yaw_pitch(
            request_revision: NSUInteger,
            bounding_box: CGRect,
            roll: Option<&NSNumber>,
            yaw: Option<&NSNumber>,
            pitch: Option<&NSNumber>,
        ) -> Retained<Self>;

        #[cfg(feature = "VNFaceLandmarks")]
        /// The face landmarks populated by the VNDetectFaceLandmarksRequest. This is set to nil if only a VNDetectFaceRectanglesRequest was performed.
        #[unsafe(method(landmarks))]
        #[unsafe(method_family = none)]
        pub unsafe fn landmarks(&self) -> Option<Retained<VNFaceLandmarks2D>>;

        /// The capture quality of the face as a normalized value between 0.0 and 1.0 that can be used to compare the quality of the face in terms of it capture attributes (lighting, blur, position). This score can be used to compare the capture quality of a face against other captures of the same face in a given set.
        #[unsafe(method(faceCaptureQuality))]
        #[unsafe(method_family = none)]
        pub unsafe fn faceCaptureQuality(&self) -> Option<Retained<NSNumber>>;

        /// Face roll angle populated by VNDetectFaceRectanglesRequest. The roll is reported in radians, positive angle corresponds to counterclockwise direction, range [-Pi, Pi). nil value indicates that the roll angle hasn't been computed
        #[unsafe(method(roll))]
        #[unsafe(method_family = none)]
        pub unsafe fn roll(&self) -> Option<Retained<NSNumber>>;

        /// Face yaw angle populated by VNDetectFaceRectanglesRequest. The yaw is reported in radians, positive angle corresponds to counterclockwise direction, range [-Pi/2, Pi/2]. nil value indicates that the yaw angle hasn't been computed
        #[unsafe(method(yaw))]
        #[unsafe(method_family = none)]
        pub unsafe fn yaw(&self) -> Option<Retained<NSNumber>>;

        /// Face pitch angle populated by VNDetectFaceRectanglesRequest. The pitch is reported in radians, positive angle corresponds to nodding head down direction, range [-Pi/2, Pi/2]. nil value indicates that the pitch angle hasn't been computed
        #[unsafe(method(pitch))]
        #[unsafe(method_family = none)]
        pub unsafe fn pitch(&self) -> Option<Retained<NSNumber>>;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNFaceObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNFaceObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNClassificationObservation returns the classifcation in form of a string.
    ///
    /// VNClassificationObservation is the observation returned by VNCoreMLRequests that using a model that is a classifier. A classifier produces an arrary (this can be a single entry) of classifications which are labels (identifiers) and confidence scores.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnclassificationobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNClassificationObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNClassificationObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNClassificationObservation {}
);

unsafe impl CopyingHelper for VNClassificationObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNClassificationObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNClassificationObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNClassificationObservation {}
);

impl VNClassificationObservation {
    extern_methods!(
        /// The is the label or identifier of a classification request. An example classification could be a string like 'cat' or 'hotdog'. The string is defined in the model that was used for the classification. Usually these are technical labels that are not localized and not meant to be used directly to be presented to an end user in the UI.
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNClassificationObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// PrecisionRecallAdditions.
///
/// VNClassificationObservation mave have precision/recall curves which can be used to decide on an "optimal" operation point.
/// Precision is a value in the range of [0..1] which represents the fraction of relevant instances among the retrieved instances.
/// Recall is a value in the range of [0..1] which represents the fraction of relevant instances that have been retrieved over the total amount of relevant instances.
impl VNClassificationObservation {
    extern_methods!(
        /// Determine whether or not precision/recall curves are available with the observation.
        ///
        /// If this property is YES, then all other precision/recall related methods in this addition can be called.
        #[unsafe(method(hasPrecisionRecallCurve))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasPrecisionRecallCurve(&self) -> bool;

        /// Determine whether or not the observation's operation point for a specific precision has a minimum recall value.
        ///
        ///
        /// Parameter `minimumRecall`: The minimum recall desired for an operation point.
        ///
        ///
        /// Parameter `precision`: The precision value used to select the operation point.
        ///
        ///
        /// Returns: YES if the recall value for the operation point specified by a precision value has the minimum value; otherwise, NO.
        #[unsafe(method(hasMinimumRecall:forPrecision:))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasMinimumRecall_forPrecision(
            &self,
            minimum_recall: c_float,
            precision: c_float,
        ) -> bool;

        /// Determine whether or not the observation's operation point for a specific recall has a minimum precision value.
        ///
        ///
        /// Parameter `minimumPrecision`: The minimum precision desired for an operation point.
        ///
        ///
        /// Parameter `recall`: The recall value used to select the operation point.
        ///
        ///
        /// Returns: YES if the precision value for the operation point specified by a recall value has the minimum value; otherwise, NO.
        #[unsafe(method(hasMinimumPrecision:forRecall:))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasMinimumPrecision_forRecall(
            &self,
            minimum_precision: c_float,
            recall: c_float,
        ) -> bool;
    );
}

extern_class!(
    /// VNRecognizedObjectObservation is a VNDetectedObjectObservation with an array of classifications that classify the recognized object. The confidence of the classifications sum up to 1.0. It is common practice to multiply the classification confidence with the confidence of this observation.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedobjectobservation?language=objc)
    #[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRecognizedObjectObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNRecognizedObjectObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRecognizedObjectObservation {}
);

unsafe impl CopyingHelper for VNRecognizedObjectObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRecognizedObjectObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRecognizedObjectObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRecognizedObjectObservation {}
);

impl VNRecognizedObjectObservation {
    extern_methods!(
        #[unsafe(method(labels))]
        #[unsafe(method_family = none)]
        pub unsafe fn labels(&self) -> Retained<NSArray<VNClassificationObservation>>;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRecognizedObjectObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNRecognizedObjectObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNCoreMLFeatureValueObservation returns the prediction of a model as an MLFeatureValue.
    ///
    /// This is the returned observations for models that are not classifiers and that do not return an image as a prediction. The confidence for these observations is always 1.0.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vncoremlfeaturevalueobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNCoreMLFeatureValueObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNCoreMLFeatureValueObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNCoreMLFeatureValueObservation {}
);

unsafe impl CopyingHelper for VNCoreMLFeatureValueObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNCoreMLFeatureValueObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNCoreMLFeatureValueObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNCoreMLFeatureValueObservation {}
);

impl VNCoreMLFeatureValueObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-ml")]
        /// The result VNCoreMLRequest where the model produces an MLFeatureValue that is neither a classification or image. Refer to the Core ML documentation and the model itself for the handling of the content of the featureValue.
        #[unsafe(method(featureValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValue(&self) -> Retained<MLFeatureValue>;

        /// The name used in the model description of the CoreML model that produced this observation allowing to correlate the observation back to the output of the model.
        #[unsafe(method(featureName))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureName(&self) -> Retained<NSString>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNCoreMLFeatureValueObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNPixelBufferObservation returns the prediction of a model as a CVPixelBufferRef.
    ///
    /// This is the returned observations for models that are not classifiers and return an image as a prediction. The confidence for these observations is always 1.0.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnpixelbufferobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNPixelBufferObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNPixelBufferObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNPixelBufferObservation {}
);

unsafe impl CopyingHelper for VNPixelBufferObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNPixelBufferObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNPixelBufferObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNPixelBufferObservation {}
);

impl VNPixelBufferObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-video")]
        /// The resulting image from a request like VNCoreMLRequest where the model produces an image as an output.
        #[unsafe(method(pixelBuffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn pixelBuffer(&self) -> Retained<CVPixelBuffer>;

        /// The name used in the model description of the CoreML model that produced this observation allowing to correlate the observation back to the output of the model. This can be nil if the observation is not the result of a VNCoreMLRequest operation.
        #[unsafe(method(featureName))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureName(&self) -> Option<Retained<NSString>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNPixelBufferObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNRectangleObservation is the result of a rectangle detector
    ///
    /// The VNRectangleObservation has a bounding box that encompasses the rectangle found in the image. The rectangle itself is defined by the four corner point properties. The rectangle can be rotated in or even out of plane. A common use case is to use the CIPerspectiveTransform filter to correct a detected rectangle to its 'flat upright' representation. All coordinates are normalized and the coordinates can be outside the image.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrectangleobservation?language=objc)
    #[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRectangleObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNRectangleObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRectangleObservation {}
);

unsafe impl CopyingHelper for VNRectangleObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRectangleObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRectangleObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRectangleObservation {}
);

impl VNRectangleObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        /// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        #[deprecated]
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
            request_revision: NSUInteger,
            top_left: CGPoint,
            bottom_left: CGPoint,
            bottom_right: CGPoint,
            top_right: CGPoint,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
            request_revision: NSUInteger,
            top_left: CGPoint,
            top_right: CGPoint,
            bottom_right: CGPoint,
            bottom_left: CGPoint,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(topLeft))]
        #[unsafe(method_family = none)]
        pub unsafe fn topLeft(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(topRight))]
        #[unsafe(method_family = none)]
        pub unsafe fn topRight(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bottomLeft))]
        #[unsafe(method_family = none)]
        pub unsafe fn bottomLeft(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bottomRight))]
        #[unsafe(method_family = none)]
        pub unsafe fn bottomRight(&self) -> CGPoint;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRectangleObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNRectangleObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// The VNTrajectoryObservation describes a detected trajectory with the points on the trajectory and the equation describing the trajectory. The observation also reprorts the duration describing when the trajectory was first detected (which will be in the past).
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vntrajectoryobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNTrajectoryObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNTrajectoryObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNTrajectoryObservation {}
);

unsafe impl CopyingHelper for VNTrajectoryObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNTrajectoryObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNTrajectoryObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNTrajectoryObservation {}
);

impl VNTrajectoryObservation {
    extern_methods!(
        #[cfg(feature = "VNGeometry")]
        /// The centroids of the contour being detected along the trajectory.
        ///
        /// These are the unprocessed centroid points of the detected contour that is tracked on the trajectory. The points may be slightly off the ideal trajectory as these are the measured points that fall within the allowed tolerance. The maximum number or past points is limited by the maximum trajectory length set in the request.
        #[unsafe(method(detectedPoints))]
        #[unsafe(method_family = none)]
        pub unsafe fn detectedPoints(&self) -> Retained<NSArray<VNPoint>>;

        #[cfg(feature = "VNGeometry")]
        /// The centroids of  the calculated trajectory from the detected points.
        ///
        /// These are the calculated centroid points along the ideal trajectory described by the parabolic equation. The equation and the projected points of the detected trajectory get refined over time. The maximum number of cached points is limited by the maximum points needed to describe the trajectory together with the parabolic equation.
        #[unsafe(method(projectedPoints))]
        #[unsafe(method_family = none)]
        pub unsafe fn projectedPoints(&self) -> Retained<NSArray<VNPoint>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The moving average radius of the object being tracked.
        ///
        /// This is the radius of the object at each detected point (used to determine the trajectory) averaged.
        #[unsafe(method(movingAverageRadius))]
        #[unsafe(method_family = none)]
        pub unsafe fn movingAverageRadius(&self) -> CGFloat;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNTrajectoryObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNTextObservation Describes a text area detected by the VNRequestNameDetectTextRectangles request.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vntextobservation?language=objc)
    #[unsafe(super(
        VNRectangleObservation,
        VNDetectedObjectObservation,
        VNObservation,
        NSObject
    ))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNTextObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNTextObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNTextObservation {}
);

unsafe impl CopyingHelper for VNTextObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNTextObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNTextObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNTextObservation {}
);

impl VNTextObservation {
    extern_methods!(
        /// Array of individual character bounding boxes found within the observation's boundingBox.
        ///
        /// If the associated request indicated that it is interested in character boxes by setting the VNDetectTextRectanglesRequest reportCharacterBoxes property to
        /// `true`, this property will be non-nil (but may still be empty, depending on the detection results).
        #[unsafe(method(characterBoxes))]
        #[unsafe(method_family = none)]
        pub unsafe fn characterBoxes(&self) -> Option<Retained<NSArray<VNRectangleObservation>>>;
    );
}

/// Methods declared on superclass `VNRectangleObservation`.
impl VNTextObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        /// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        #[deprecated]
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
            request_revision: NSUInteger,
            top_left: CGPoint,
            bottom_left: CGPoint,
            bottom_right: CGPoint,
            top_right: CGPoint,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
            request_revision: NSUInteger,
            top_left: CGPoint,
            top_right: CGPoint,
            bottom_right: CGPoint,
            bottom_left: CGPoint,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNTextObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNTextObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNRecognizedText A block of recognized text. There can be multiple VNRecognizedText objects returned in a VNRecognizedTextObservation - one for each candidate.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedtext?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRecognizedText;
);

extern_conformance!(
    unsafe impl NSCoding for VNRecognizedText {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRecognizedText {}
);

unsafe impl CopyingHelper for VNRecognizedText {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRecognizedText {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRecognizedText {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRecognizedText {}
);

impl VNRecognizedText {
    extern_methods!(
        /// Field that contains recognized text.
        ///
        /// This is the top candidate of the recognized text.
        #[unsafe(method(string))]
        #[unsafe(method_family = none)]
        pub fn string(&self) -> Retained<NSString>;

        #[cfg(feature = "VNTypes")]
        /// The level of confidence normalized to [0.0, 1.0] where 1.0 is most confident
        #[unsafe(method(confidence))]
        #[unsafe(method_family = none)]
        pub fn confidence(&self) -> VNConfidence;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNRecognizedText {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNRecognizedTextObservation Describes a text area detected and recognized by the VNRecognizeTextRequest request.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedtextobservation?language=objc)
    #[unsafe(super(
        VNRectangleObservation,
        VNDetectedObjectObservation,
        VNObservation,
        NSObject
    ))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRecognizedTextObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNRecognizedTextObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRecognizedTextObservation {}
);

unsafe impl CopyingHelper for VNRecognizedTextObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRecognizedTextObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRecognizedTextObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRecognizedTextObservation {}
);

impl VNRecognizedTextObservation {
    extern_methods!(
        /// Returns the top N candidates sorted by decreasing confidence score
        ///
        /// This will return no more than N but can be less than N candidates. The maximum number of candidates returned cannot exceed 10 candidates.
        #[unsafe(method(topCandidates:))]
        #[unsafe(method_family = none)]
        pub fn topCandidates(
            &self,
            max_candidate_count: NSUInteger,
        ) -> Retained<NSArray<VNRecognizedText>>;
    );
}

/// Methods declared on superclass `VNRectangleObservation`.
impl VNRecognizedTextObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        /// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        #[deprecated]
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
            request_revision: NSUInteger,
            top_left: CGPoint,
            bottom_left: CGPoint,
            bottom_right: CGPoint,
            top_right: CGPoint,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
            request_revision: NSUInteger,
            top_left: CGPoint,
            top_right: CGPoint,
            bottom_right: CGPoint,
            bottom_left: CGPoint,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRecognizedTextObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNRecognizedTextObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNBarcodeObservation Describes an area containing a barcode detected by the VNRequestNameDetectBarcodes request.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnbarcodeobservation?language=objc)
    #[unsafe(super(
        VNRectangleObservation,
        VNDetectedObjectObservation,
        VNObservation,
        NSObject
    ))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNBarcodeObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNBarcodeObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNBarcodeObservation {}
);

unsafe impl CopyingHelper for VNBarcodeObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNBarcodeObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNBarcodeObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNBarcodeObservation {}
);

impl VNBarcodeObservation {
    extern_methods!(
        #[cfg(feature = "VNTypes")]
        /// The symbology of the detected barcode.
        #[unsafe(method(symbology))]
        #[unsafe(method_family = none)]
        pub unsafe fn symbology(&self) -> Retained<VNBarcodeSymbology>;

        #[cfg(feature = "objc2-core-image")]
        /// An object that provides symbology-specific data for the barcode.
        #[unsafe(method(barcodeDescriptor))]
        #[unsafe(method_family = none)]
        pub unsafe fn barcodeDescriptor(&self) -> Option<Retained<CIBarcodeDescriptor>>;

        /// The string representation of the barcode's payload.  Depending on the symbology of the barcode and/or the payload data itself, a string representation of the payload may not be available.
        #[unsafe(method(payloadStringValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn payloadStringValue(&self) -> Option<Retained<NSString>>;

        /// The raw data representation of the barcode's payload if available.
        #[unsafe(method(payloadData))]
        #[unsafe(method_family = none)]
        pub unsafe fn payloadData(&self) -> Option<Retained<NSData>>;

        /// Boolean indicating if the barcode carries any GS1 application specific data
        #[unsafe(method(isGS1DataCarrier))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGS1DataCarrier(&self) -> bool;

        /// A boolean indicating if the barcode is color inverted
        #[unsafe(method(isColorInverted))]
        #[unsafe(method_family = none)]
        pub unsafe fn isColorInverted(&self) -> bool;

        #[cfg(feature = "VNTypes")]
        /// Represents the supplemental composite type. Currently, this can only refer to the composite flag of the 2D symbology as part of a GS1 composite symbology.
        /// This attribute only exists when the primary descriptor is the 1D symbology of a GS1 composite symbology, and of which a valid 2D counterpart has been coalesced into.
        #[unsafe(method(supplementalCompositeType))]
        #[unsafe(method_family = none)]
        pub unsafe fn supplementalCompositeType(&self) -> VNBarcodeCompositeType;

        /// Decode the supplemental code in the descriptor as a string value. Note: this property might be expensive the first time it is accessed
        /// When non-NULL, and if the descriptor has supplemental raw payload data, the pointee will be set to the decoded supplemental payload string value.
        #[unsafe(method(supplementalPayloadString))]
        #[unsafe(method_family = none)]
        pub unsafe fn supplementalPayloadString(&self) -> Option<Retained<NSString>>;

        /// Decode the supplemental code in the descriptor as a string value. Note: this property might be expensive the first time it is accessed
        /// When non-NULL, and if the descriptor has supplemental raw payload data, the pointee will be set to the decoded supplemental payload raw data value.
        #[unsafe(method(supplementalPayloadData))]
        #[unsafe(method_family = none)]
        pub unsafe fn supplementalPayloadData(&self) -> Option<Retained<NSData>>;
    );
}

/// Methods declared on superclass `VNRectangleObservation`.
impl VNBarcodeObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        /// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        #[deprecated]
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
            request_revision: NSUInteger,
            top_left: CGPoint,
            bottom_left: CGPoint,
            bottom_right: CGPoint,
            top_right: CGPoint,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a synthesized `VNRectangleObservation`.
        ///
        ///
        /// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
        ///
        /// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
        ///
        /// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
        #[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
            request_revision: NSUInteger,
            top_left: CGPoint,
            top_right: CGPoint,
            bottom_right: CGPoint,
            bottom_left: CGPoint,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNBarcodeObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNBarcodeObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNHorizonObservation is the result of a VNDetectHorizonRequest
    ///
    /// Use the transform or angle to upright the image and make the detected horizon level.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhorizonobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNHorizonObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNHorizonObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNHorizonObservation {}
);

unsafe impl CopyingHelper for VNHorizonObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNHorizonObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNHorizonObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNHorizonObservation {}
);

impl VNHorizonObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Transform applied to the detected horizon in image coordinates.
        ///
        /// This is the transform in image coordinates and not a normalized transform.
        #[unsafe(method(transform))]
        #[unsafe(method_family = none)]
        pub unsafe fn transform(&self) -> CGAffineTransform;

        #[cfg(feature = "objc2-core-foundation")]
        /// Angle of the observed horizon.
        #[unsafe(method(angle))]
        #[unsafe(method_family = none)]
        pub unsafe fn angle(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Creates a transform for the specified width and height.
        #[unsafe(method(transformForImageWidth:height:))]
        #[unsafe(method_family = none)]
        pub unsafe fn transformForImageWidth_height(
            &self,
            width: usize,
            height: usize,
        ) -> CGAffineTransform;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNHorizonObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNImageAlignmentObservation is generated from an image registration. This is an abstract base class. The type of registration request used defines which subclass describes the result.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagealignmentobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNImageAlignmentObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNImageAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNImageAlignmentObservation {}
);

unsafe impl CopyingHelper for VNImageAlignmentObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNImageAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNImageAlignmentObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNImageAlignmentObservation {}
);

impl VNImageAlignmentObservation {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl VNImageAlignmentObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An observation describing the results of performing a translational image alignment.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagetranslationalignmentobservation?language=objc)
    #[unsafe(super(VNImageAlignmentObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNImageTranslationAlignmentObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNImageTranslationAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNImageTranslationAlignmentObservation {}
);

unsafe impl CopyingHelper for VNImageTranslationAlignmentObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNImageTranslationAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNImageTranslationAlignmentObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNImageTranslationAlignmentObservation {}
);

impl VNImageTranslationAlignmentObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(alignmentTransform))]
        #[unsafe(method_family = none)]
        pub unsafe fn alignmentTransform(&self) -> CGAffineTransform;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNImageTranslationAlignmentObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An observation describing the results of performing a homographic image alignment.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagehomographicalignmentobservation?language=objc)
    #[unsafe(super(VNImageAlignmentObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNImageHomographicAlignmentObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNImageHomographicAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNImageHomographicAlignmentObservation {}
);

unsafe impl CopyingHelper for VNImageHomographicAlignmentObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNImageHomographicAlignmentObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNImageHomographicAlignmentObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNImageHomographicAlignmentObservation {}
);

impl VNImageHomographicAlignmentObservation {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl VNImageHomographicAlignmentObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// VNSaliencyImageObservation provides a grayscale "heat" map of important areas of an image.
    ///
    /// In the revision1, the "heat" map is a OneComponent32Float pixel format CVPixelBuffer.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnsaliencyimageobservation?language=objc)
    #[unsafe(super(VNPixelBufferObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNSaliencyImageObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNSaliencyImageObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNSaliencyImageObservation {}
);

unsafe impl CopyingHelper for VNSaliencyImageObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNSaliencyImageObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNSaliencyImageObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNSaliencyImageObservation {}
);

impl VNSaliencyImageObservation {
    extern_methods!(
        /// An array of bounds of salient objects within the image. Each box represents a distinct mode of the heat map.
        #[unsafe(method(salientObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn salientObjects(&self) -> Option<Retained<NSArray<VNRectangleObservation>>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNSaliencyImageObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vnfeatureprintobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNFeaturePrintObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNFeaturePrintObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNFeaturePrintObservation {}
);

unsafe impl CopyingHelper for VNFeaturePrintObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNFeaturePrintObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNFeaturePrintObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNFeaturePrintObservation {}
);

impl VNFeaturePrintObservation {
    extern_methods!(
        #[cfg(feature = "VNTypes")]
        /// The type of each element in the data.
        #[unsafe(method(elementType))]
        #[unsafe(method_family = none)]
        pub unsafe fn elementType(&self) -> VNElementType;

        /// The total number of elements in the data.
        #[unsafe(method(elementCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn elementCount(&self) -> NSUInteger;

        /// The feature print data.
        #[unsafe(method(data))]
        #[unsafe(method_family = none)]
        pub unsafe fn data(&self) -> Retained<NSData>;

        /// Computes the distance between two observations.
        ///
        /// The larger the distance the more dissimlar the feature prints are. In case of an error this method returns false with an error describing the error condition, for instance comparing two non-comparable feature prints.
        ///
        /// # Safety
        ///
        /// `out_distance` must be a valid pointer.
        #[unsafe(method(computeDistance:toFeaturePrintObservation:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn computeDistance_toFeaturePrintObservation_error(
            &self,
            out_distance: NonNull<c_float>,
            feature_print: &VNFeaturePrintObservation,
        ) -> Result<(), Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNFeaturePrintObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vncontoursobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNContoursObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNContoursObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNContoursObservation {}
);

unsafe impl CopyingHelper for VNContoursObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNContoursObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNContoursObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNContoursObservation {}
);

impl VNContoursObservation {
    extern_methods!(
        /// The total number of contours detected.
        #[unsafe(method(contourCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn contourCount(&self) -> NSInteger;

        #[cfg(feature = "VNGeometry")]
        /// Returns the VNContour object at the specified index, irrespective of hierarchy.
        ///
        /// Parameter `contourIndex`: The index of the contour to request. Valid values are in the range [0..contourCount-1].
        ///
        /// Parameter `error`: The error returned if the index path is out of range.
        ///
        /// Returns: The detected VNContour at the specified index without regard to hierarchy.
        #[unsafe(method(contourAtIndex:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn contourAtIndex_error(
            &self,
            contour_index: NSInteger,
        ) -> Result<Retained<VNContour>, Retained<NSError>>;

        /// The total number of top-level contours detected.
        #[unsafe(method(topLevelContourCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn topLevelContourCount(&self) -> NSInteger;

        #[cfg(feature = "VNGeometry")]
        /// An array of the top level contours (i.e. contours that are not enclosed inside another contour),.
        ///
        /// This array constitutes the top of the contour hierarchy. Each contour object can be further iterated to determine its children.
        ///
        /// See: VNContour for more information.
        #[unsafe(method(topLevelContours))]
        #[unsafe(method_family = none)]
        pub unsafe fn topLevelContours(&self) -> Retained<NSArray<VNContour>>;

        #[cfg(feature = "VNGeometry")]
        /// Returns the VNContour object at the specified index path.
        ///
        /// Use the indexPath property from a VNContour instance to pass to this method.
        ///
        /// Parameter `indexPath`: The index path is the heirarchical path to the contour.
        ///
        /// Parameter `error`: The error returned if the index path is out of range.
        ///
        /// Returns: The VNContour object at the specified index path.
        #[unsafe(method(contourAtIndexPath:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn contourAtIndexPath_error(
            &self,
            index_path: &NSIndexPath,
        ) -> Result<Retained<VNContour>, Retained<NSError>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Obtain all of the contours represented as a CGPath in normalized coordinates.
        ///
        /// The path is owned by the observation and therefore will be alive as long as the the observation is alive.
        #[unsafe(method(normalizedPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn normalizedPath(&self) -> Retained<CGPath>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNContoursObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpointgroupkeyall?language=objc)
    #[cfg(feature = "VNTypes")]
    pub static VNRecognizedPointGroupKeyAll: &'static VNRecognizedPointGroupKey;
}

extern_class!(
    /// VNRecognizedPointsObservation is a request result detailing points in an image.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpointsobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRecognizedPointsObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNRecognizedPointsObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRecognizedPointsObservation {}
);

unsafe impl CopyingHelper for VNRecognizedPointsObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRecognizedPointsObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRecognizedPointsObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRecognizedPointsObservation {}
);

impl VNRecognizedPointsObservation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "VNTypes")]
        /// Returns all of the point group keys available in the observation.
        #[unsafe(method(availableKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableKeys(&self) -> Retained<NSArray<VNRecognizedPointKey>>;

        #[cfg(feature = "VNTypes")]
        /// The availableGroupKeys property returns all of the point group labels usable with the observation.
        #[unsafe(method(availableGroupKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableGroupKeys(&self) -> Retained<NSArray<VNRecognizedPointGroupKey>>;

        #[cfg(all(
            feature = "VNDetectedPoint",
            feature = "VNGeometry",
            feature = "VNTypes"
        ))]
        /// Obtains a specific normalized recognized point.
        ///
        ///
        /// Parameter `pointKey`: The key specifying the desired recognized point.
        ///
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        ///
        /// Returns: the recognized point, or nil if the specific point is not defined.
        #[unsafe(method(recognizedPointForKey:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointForKey_error(
            &self,
            point_key: &VNRecognizedPointKey,
        ) -> Result<Retained<VNRecognizedPoint>, Retained<NSError>>;

        #[cfg(all(
            feature = "VNDetectedPoint",
            feature = "VNGeometry",
            feature = "VNTypes"
        ))]
        /// Obtains the collection of points associated with an identified grouping.
        ///
        ///
        /// The obtained collection is a dictionary that provides the mapping of a recognized point's key to the recognized point.
        ///
        ///
        /// Parameter `groupKey`: The key representing a specific grouping of points.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: the dictionary of recognized points in the group, or nil if an error was encountered.
        #[unsafe(method(recognizedPointsForGroupKey:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointsForGroupKey_error(
            &self,
            group_key: &VNRecognizedPointGroupKey,
        ) -> Result<
            Retained<NSDictionary<VNRecognizedPointKey, VNRecognizedPoint>>,
            Retained<NSError>,
        >;

        #[cfg(feature = "objc2-core-ml")]
        /// Returns the recognized points packaged into an MLMultiArray.
        ///
        ///
        /// The MLMultiArray will contain the raw data output of (x coordinate, y coordinate, confidence) for specific points in the format expected by CreateML action recognition models.
        /// The datatype of the elements in the array is double and the dimensions are [1, 3, # of possible points].  If an expected point key is not available in the obeservation, that entry in the MLMultiArray will be populated with 0s.
        ///
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        ///
        /// Returns: the MLMultiArray representation of the points, or nil if an error was encountered.
        #[unsafe(method(keypointsMultiArrayAndReturnError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn keypointsMultiArrayAndReturnError(
            &self,
        ) -> Result<Retained<MLMultiArray>, Retained<NSError>>;
    );
}

extern_class!(
    /// VNHumanObservation is the result of a Human rectangles detection request
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanobservation?language=objc)
    #[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNHumanObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNHumanObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNHumanObservation {}
);

unsafe impl CopyingHelper for VNHumanObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNHumanObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNHumanObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNHumanObservation {}
);

impl VNHumanObservation {
    extern_methods!(
        /// Boolean property to specify whether the human upper body or full body detection is recorded in the observation. This setting is propagated from [VNDetectHumanRectanglesRequest -upperBodyOnly]
        #[unsafe(method(upperBodyOnly))]
        #[unsafe(method_family = none)]
        pub unsafe fn upperBodyOnly(&self) -> bool;
    );
}

/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNHumanObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
        #[unsafe(method(observationWithBoundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(observationWithRequestRevision:boundingBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn observationWithRequestRevision_boundingBox(
            request_revision: NSUInteger,
            bounding_box: CGRect,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNHumanObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An observation resulting from an instance mask generation request. It contains an instance mask that labels instances in the mask that labels per pixel an instance.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vninstancemaskobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNInstanceMaskObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNInstanceMaskObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNInstanceMaskObservation {}
);

unsafe impl CopyingHelper for VNInstanceMaskObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNInstanceMaskObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNInstanceMaskObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNInstanceMaskObservation {}
);

impl VNInstanceMaskObservation {
    extern_methods!(
        #[cfg(feature = "objc2-core-video")]
        /// The resulting mask represents all instances in a mask image where 0 represents the background and all other values represent the indices of the instances identified.
        /// Note that a pixel can only correspond to one instance and not multiple instances.
        #[unsafe(method(instanceMask))]
        #[unsafe(method_family = none)]
        pub unsafe fn instanceMask(&self) -> Retained<CVPixelBuffer>;

        /// *The IndexSet that encompases all instances except the background
        #[unsafe(method(allInstances))]
        #[unsafe(method_family = none)]
        pub unsafe fn allInstances(&self) -> Retained<NSIndexSet>;

        #[cfg(feature = "objc2-core-video")]
        /// The low res mask from the selected instances in the resolution of the performed analysis which is not upscaled to the image resolution.
        ///
        /// Parameter `instances`: An NSIndexSet of selected instances where 0 is the background. An empty set selects all instances but the background
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        /// The pixel format of kCVPixelFormatType_OneComponent32Float
        #[unsafe(method(generateMaskForInstances:error:_))]
        // required for soundness, method has `returns_retained` attribute.
        #[unsafe(method_family = copy)]
        pub unsafe fn generateMaskForInstances_error(
            &self,
            instances: &NSIndexSet,
        ) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;

        #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-video"))]
        /// High res image with everything but the selected instances removed to transparent black.
        ///
        /// Parameter `instances`: An NSIndexSet of selected instances where 0 is the background.
        ///
        /// Parameter `croppedToInstancesExtent`: Crops the image to the smallest rectangle containg all instances with remaining alpha elements.
        /// Setting this value to NO does not perform any cropping.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        #[unsafe(method(generateMaskedImageOfInstances:fromRequestHandler:croppedToInstancesExtent:error:_))]
        // required for soundness, method has `returns_retained` attribute.
        #[unsafe(method_family = copy)]
        pub unsafe fn generateMaskedImageOfInstances_fromRequestHandler_croppedToInstancesExtent_error(
            &self,
            instances: &NSIndexSet,
            request_handler: &VNImageRequestHandler,
            crop_result: bool,
        ) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;

        #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-video"))]
        /// High res mask with the selected instances preserved while everything else is removed to transparent black.
        ///
        /// Parameter `forInstances`: An NSIndexSet of selected instances where 0 is the background.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        #[unsafe(method(generateScaledMaskForImageForInstances:fromRequestHandler:error:_))]
        // required for soundness, method has `returns_retained` attribute.
        #[unsafe(method_family = copy)]
        pub unsafe fn generateScaledMaskForImageForInstances_fromRequestHandler_error(
            &self,
            instances: &NSIndexSet,
            request_handler: &VNImageRequestHandler,
        ) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNInstanceMaskObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vnanimalbodyposeobservation?language=objc)
    #[unsafe(super(VNRecognizedPointsObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNAnimalBodyPoseObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNAnimalBodyPoseObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNAnimalBodyPoseObservation {}
);

unsafe impl CopyingHelper for VNAnimalBodyPoseObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNAnimalBodyPoseObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNAnimalBodyPoseObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNAnimalBodyPoseObservation {}
);

impl VNAnimalBodyPoseObservation {
    extern_methods!(
        #[cfg(feature = "VNTypes")]
        /// All animal joint names available in the observation.
        #[unsafe(method(availableJointNames))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableJointNames(
            &self,
        ) -> Retained<NSArray<VNAnimalBodyPoseObservationJointName>>;

        #[cfg(feature = "VNTypes")]
        /// All animal joints group names available in the observation.
        #[unsafe(method(availableJointGroupNames))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableJointGroupNames(
            &self,
        ) -> Retained<NSArray<VNAnimalBodyPoseObservationJointsGroupName>>;

        #[cfg(all(
            feature = "VNDetectedPoint",
            feature = "VNGeometry",
            feature = "VNTypes"
        ))]
        /// Obtain a specific normalized point for a named animal body joint.
        ///
        ///
        /// Parameter `jointName`: The name of the animal body joint.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: the recognized point, or nil if the point could not be obtained.
        #[unsafe(method(recognizedPointForJointName:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointForJointName_error(
            &self,
            joint_name: &VNAnimalBodyPoseObservationJointName,
        ) -> Result<Retained<VNRecognizedPoint>, Retained<NSError>>;

        #[cfg(all(
            feature = "VNDetectedPoint",
            feature = "VNGeometry",
            feature = "VNTypes"
        ))]
        /// Obtains the collection of points associated with a named animal body joints group.
        ///
        ///
        /// The obtained collection is a dictionary that provides the mapping of animal join names to the recognized point.
        ///
        ///
        /// Parameter `jointsGroupName`: The name of the animal body joints group.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: a dictionary of recognized points in the group, or nil if an error was encountered.
        #[unsafe(method(recognizedPointsForJointsGroupName:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointsForJointsGroupName_error(
            &self,
            joints_group_name: &VNAnimalBodyPoseObservationJointsGroupName,
        ) -> Result<
            Retained<NSDictionary<VNAnimalBodyPoseObservationJointName, VNRecognizedPoint>>,
            Retained<NSError>,
        >;
    );
}

/// Methods declared on superclass `VNRecognizedPointsObservation`.
impl VNAnimalBodyPoseObservation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpoint3dgroupkeyall?language=objc)
    #[cfg(feature = "VNTypes")]
    pub static VNRecognizedPoint3DGroupKeyAll: &'static VNRecognizedPointGroupKey;
}

extern_class!(
    /// Observation
    ///
    /// VNRecognizedPointsObservation is a request result detailing points in an image.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpoints3dobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNRecognizedPoints3DObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNRecognizedPoints3DObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNRecognizedPoints3DObservation {}
);

unsafe impl CopyingHelper for VNRecognizedPoints3DObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNRecognizedPoints3DObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNRecognizedPoints3DObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNRecognizedPoints3DObservation {}
);

impl VNRecognizedPoints3DObservation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "VNTypes")]
        /// Returns all of the point group keys available in the observation.
        #[unsafe(method(availableKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableKeys(&self) -> Retained<NSArray<VNRecognizedPointKey>>;

        #[cfg(feature = "VNTypes")]
        /// The availableGroupKeys property returns all of the point group labels usable with the observation.
        #[unsafe(method(availableGroupKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableGroupKeys(&self) -> Retained<NSArray<VNRecognizedPointGroupKey>>;

        #[cfg(all(
            feature = "VNGeometry",
            feature = "VNRecognizedPoint3D",
            feature = "VNTypes"
        ))]
        /// Obtains a specific normalized recognized point.
        ///
        /// Parameter `pointKey`: The key specifying the desired recognized point.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: the recognized point, or nil if the specific point is not defined.
        #[unsafe(method(recognizedPointForKey:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointForKey_error(
            &self,
            point_key: &VNRecognizedPointKey,
        ) -> Result<Retained<VNRecognizedPoint3D>, Retained<NSError>>;

        #[cfg(all(
            feature = "VNGeometry",
            feature = "VNRecognizedPoint3D",
            feature = "VNTypes"
        ))]
        /// Obtains the collection of points associated with an identified grouping.
        ///
        /// The obtained collection is a dictionary that provides the mapping of a recognized point's key to the recognized point.
        ///
        /// Parameter `groupKey`: The key representing a specific grouping of points.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: the dictionary of recognized points in the group, or nil if an error was encountered.
        #[unsafe(method(recognizedPointsForGroupKey:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointsForGroupKey_error(
            &self,
            group_key: &VNRecognizedPointGroupKey,
        ) -> Result<
            Retained<NSDictionary<VNRecognizedPointKey, VNRecognizedPoint3D>>,
            Retained<NSError>,
        >;
    );
}

/// Height estimation technique used in observation based on available metadata
/// VNHumanBodyPose3DObservationHeightEstimationReference is the default if no LiDAR depth is present
///
/// reference -   Since no depth was present, a reference height of 1.8 meters is used
/// measured -   LiDAR depth was used to measure a more accurate `bodyHeight` in meters
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanbodypose3dobservationheightestimation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct VNHumanBodyPose3DObservationHeightEstimation(pub NSInteger);
impl VNHumanBodyPose3DObservationHeightEstimation {
    #[doc(alias = "VNHumanBodyPose3DObservationHeightEstimationReference")]
    pub const Reference: Self = Self(0);
    #[doc(alias = "VNHumanBodyPose3DObservationHeightEstimationMeasured")]
    pub const Measured: Self = Self(1);
}

unsafe impl Encode for VNHumanBodyPose3DObservationHeightEstimation {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for VNHumanBodyPose3DObservationHeightEstimation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanbodypose3dobservation?language=objc)
    #[unsafe(super(VNRecognizedPoints3DObservation, VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNHumanBodyPose3DObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNHumanBodyPose3DObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNHumanBodyPose3DObservation {}
);

unsafe impl CopyingHelper for VNHumanBodyPose3DObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNHumanBodyPose3DObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNHumanBodyPose3DObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNHumanBodyPose3DObservation {}
);

impl VNHumanBodyPose3DObservation {
    extern_methods!(
        /// Technique used to estimate body height.   `VNHumanBodyPose3DObservationHeightEstimationMeasured`   indicates`bodyHeight` returns measured height in meters more accurate to true world height.
        /// `VNHumanBodyPose3DObservationHeightEstimationReference` indicates `bodyHeight` returns reference height of 1.8 m
        #[unsafe(method(heightEstimation))]
        #[unsafe(method_family = none)]
        pub unsafe fn heightEstimation(&self) -> VNHumanBodyPose3DObservationHeightEstimation;

        #[cfg(feature = "VNTypes")]
        /// All of the joints group names available in the observation.
        #[unsafe(method(availableJointsGroupNames))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableJointsGroupNames(
            &self,
        ) -> Retained<NSArray<VNHumanBodyPose3DObservationJointsGroupName>>;

        #[cfg(feature = "VNTypes")]
        /// All of the joint names available in the observation.
        #[unsafe(method(availableJointNames))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableJointNames(
            &self,
        ) -> Retained<NSArray<VNHumanBodyPose3DObservationJointName>>;

        /// Estimated human height, in meters.
        ///
        /// Note: A measured height will be returned in meters if  `heightEstimation` is  `VNHumanBodyPose3DObservationHeightEstimationMeasured`, otherwise reference height of 1.8 meters is returned for `VNHumanBodyPose3DObservationHeightEstimationReference`
        #[unsafe(method(bodyHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn bodyHeight(&self) -> c_float;

        #[cfg(all(
            feature = "VNGeometry",
            feature = "VNHumanBodyRecognizedPoint3D",
            feature = "VNRecognizedPoint3D",
            feature = "VNTypes"
        ))]
        /// Obtains the collection of joints associated with a named human body joints group.
        ///
        /// The obtained collection is a dictionary that provides the mapping of human joint names to the recognized point.
        ///
        /// Parameter `jointsGroupName`: The name of the human body joints group.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: a dictionary of recognized points in the group, or nil if an error was encountered.
        #[unsafe(method(recognizedPointsForJointsGroupName:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointsForJointsGroupName_error(
            &self,
            joints_group_name: &VNHumanBodyPose3DObservationJointsGroupName,
        ) -> Result<
            Retained<
                NSDictionary<VNHumanBodyPose3DObservationJointName, VNHumanBodyRecognizedPoint3D>,
            >,
            Retained<NSError>,
        >;

        #[cfg(all(
            feature = "VNGeometry",
            feature = "VNHumanBodyRecognizedPoint3D",
            feature = "VNRecognizedPoint3D",
            feature = "VNTypes"
        ))]
        /// Obtain a specific point for a named human body joint.
        /// Each returned `VNHumanBodyRecognizedPoint3D` instance contains position relative to the model (`position`) and the parent joint (`localPosition`)
        /// Model position is relative to root joint (hip) for a named human body joint in meters .
        /// Local position is relative to parent joint for a named human body joint in meters.
        ///
        /// Parameter `jointName`: The name of the human body joint.
        ///
        /// Parameter `error`: The address of a variable that will be populated with the error that describes the failure.  If the caller does not require this information, NULL can be passed.
        ///
        /// Returns: The recognized point, or nil if the point could not be obtained.
        #[unsafe(method(recognizedPointForJointName:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn recognizedPointForJointName_error(
            &self,
            joint_name: &VNHumanBodyPose3DObservationJointName,
        ) -> Result<Retained<VNHumanBodyRecognizedPoint3D>, Retained<NSError>>;

        #[cfg(all(feature = "VNGeometry", feature = "VNTypes"))]
        /// Obtain 2D point relative to the input image for named human body joint
        ///
        /// Parameter `jointName`: The name of the human body joint
        ///
        /// Returns: A projection of the determined 3D position onto the original 2D image in normalized, lower left origin coordinates
        #[unsafe(method(pointInImageForJointName:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointInImageForJointName_error(
            &self,
            joint_name: &VNHumanBodyPose3DObservationJointName,
        ) -> Result<Retained<VNPoint>, Retained<NSError>>;

        #[cfg(feature = "VNTypes")]
        /// Obtain the parent joint of a specified joint
        ///
        /// Parameter `jointName`: The name of the human body joint
        ///
        /// Returns: The name of the parent joint
        #[unsafe(method(parentJointNameForJointName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn parentJointNameForJointName(
            &self,
            joint_name: &VNHumanBodyPose3DObservationJointName,
        ) -> Option<Retained<VNHumanBodyPose3DObservationJointName>>;
    );
}

/// Methods declared on superclass `VNRecognizedPoints3DObservation`.
impl VNHumanBodyPose3DObservation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

extern_class!(
    /// VNImageAestheticsScoresObservation provides an overall score of aesthetic attributes for an image.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageaestheticsscoresobservation?language=objc)
    #[unsafe(super(VNObservation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VNImageAestheticsScoresObservation;
);

extern_conformance!(
    unsafe impl NSCoding for VNImageAestheticsScoresObservation {}
);

extern_conformance!(
    unsafe impl NSCopying for VNImageAestheticsScoresObservation {}
);

unsafe impl CopyingHelper for VNImageAestheticsScoresObservation {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for VNImageAestheticsScoresObservation {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for VNImageAestheticsScoresObservation {}
);

#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
    unsafe impl VNRequestRevisionProviding for VNImageAestheticsScoresObservation {}
);

impl VNImageAestheticsScoresObservation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// A Boolean value that represents images that are not necessarily of poor image quality, but may not have memorable or exciting content.
        #[unsafe(method(isUtility))]
        #[unsafe(method_family = none)]
        pub unsafe fn isUtility(&self) -> bool;

        /// A score which incorporates aesthetic score, failure score, and utility labels.
        ///
        /// This returns a value within the range of `-1` and `1`, where `-1` is least desirable and `1` is most desirable.
        #[unsafe(method(overallScore))]
        #[unsafe(method_family = none)]
        pub unsafe fn overallScore(&self) -> c_float;
    );
}

/// Methods declared on superclass `NSObject`.
impl VNImageAestheticsScoresObservation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}