1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372
pub mod optflow {
//! # Optical Flow Algorithms
//!
//! Dense optical flow algorithms compute motion for each point:
//!
//! - cv::optflow::calcOpticalFlowSF
//! - cv::optflow::createOptFlow_DeepFlow
//!
//! Motion templates is alternative technique for detecting motion and computing its direction.
//! See samples/motempl.py.
//!
//! - cv::motempl::updateMotionHistory
//! - cv::motempl::calcMotionGradient
//! - cv::motempl::calcGlobalOrientation
//! - cv::motempl::segmentMotion
//!
//! Functions reading and writing .flo files in "Middlebury" format, see: <http://vision.middlebury.edu/flow/code/flow-code/README.txt>
//!
//! - cv::optflow::readOpticalFlow
//! - cv::optflow::writeOpticalFlow
use crate::{mod_prelude::*, core, sys, types};
pub mod prelude {
pub use { super::PCAPriorTraitConst, super::PCAPriorTrait, super::OpticalFlowPCAFlowTraitConst, super::OpticalFlowPCAFlowTrait, super::GPCPatchDescriptorTraitConst, super::GPCPatchDescriptorTrait, super::GPCPatchSampleTraitConst, super::GPCPatchSampleTrait, super::GPCTrainingSamplesTraitConst, super::GPCTrainingSamplesTrait, super::GPCTreeTraitConst, super::GPCTreeTrait, super::GPCDetailsTraitConst, super::GPCDetailsTrait, super::RLOFOpticalFlowParameterTraitConst, super::RLOFOpticalFlowParameterTrait, super::DenseRLOFOpticalFlowTraitConst, super::DenseRLOFOpticalFlowTrait, super::SparseRLOFOpticalFlowTraitConst, super::SparseRLOFOpticalFlowTrait, super::DualTVL1OpticalFlowTraitConst, super::DualTVL1OpticalFlowTrait };
}
/// Better quality but slow
pub const GPC_DESCRIPTOR_DCT: i32 = 0;
/// Worse quality but much faster
pub const GPC_DESCRIPTOR_WHT: i32 = 1;
/// < Edge-preserving interpolation using ximgproc::EdgeAwareInterpolator, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
pub const INTERP_EPIC: i32 = 1;
/// < Fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016)
pub const INTERP_GEO: i32 = 0;
/// < SLIC based robust interpolation using ximgproc::RICInterpolator, see [Hu2017](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Hu2017).
pub const INTERP_RIC: i32 = 2;
/// < Apply a adaptive support region obtained by cross-based segmentation
/// as described in [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
pub const SR_CROSS: i32 = 1;
/// < Apply a constant support region
pub const SR_FIXED: i32 = 0;
/// < Apply optimized iterative refinement based bilinear equation solutions
/// as described in [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013)
pub const ST_BILINEAR: i32 = 1;
/// < Apply standard iterative refinement
pub const ST_STANDART: i32 = 0;
/// Descriptor types for the Global Patch Collider.
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum GPCDescType {
/// Better quality but slow
GPC_DESCRIPTOR_DCT = 0,
/// Worse quality but much faster
GPC_DESCRIPTOR_WHT = 1,
}
opencv_type_enum! { crate::optflow::GPCDescType }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum InterpolationType {
/// < Fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016)
INTERP_GEO = 0,
/// < Edge-preserving interpolation using ximgproc::EdgeAwareInterpolator, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
INTERP_EPIC = 1,
/// < SLIC based robust interpolation using ximgproc::RICInterpolator, see [Hu2017](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Hu2017).
INTERP_RIC = 2,
}
opencv_type_enum! { crate::optflow::InterpolationType }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SolverType {
/// < Apply standard iterative refinement
ST_STANDART = 0,
/// < Apply optimized iterative refinement based bilinear equation solutions
/// as described in [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013)
ST_BILINEAR = 1,
}
opencv_type_enum! { crate::optflow::SolverType }
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SupportRegionType {
/// < Apply a constant support region
SR_FIXED = 0,
/// < Apply a adaptive support region obtained by cross-based segmentation
/// as described in [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
SR_CROSS = 1,
}
opencv_type_enum! { crate::optflow::SupportRegionType }
pub type GPCSamplesVector = core::Vector<crate::optflow::GPCPatchSample>;
/// Calculates a global motion orientation in a selected region.
///
/// ## Parameters
/// * orientation: Motion gradient orientation image calculated by the function calcMotionGradient
/// * mask: Mask image. It may be a conjunction of a valid gradient mask, also calculated by
/// calcMotionGradient , and the mask of a region whose direction needs to be calculated.
/// * mhi: Motion history image calculated by updateMotionHistory .
/// * timestamp: Timestamp passed to updateMotionHistory .
/// * duration: Maximum duration of a motion track in milliseconds, passed to updateMotionHistory
///
/// The function calculates an average motion direction in the selected region and returns the angle
/// between 0 degrees and 360 degrees. The average direction is computed from the weighted orientation
/// histogram, where a recent motion has a larger weight and the motion occurred in the past has a
/// smaller weight, as recorded in mhi .
#[inline]
pub fn calc_global_orientation(orientation: &impl core::ToInputArray, mask: &impl core::ToInputArray, mhi: &impl core::ToInputArray, timestamp: f64, duration: f64) -> Result<f64> {
input_array_arg!(orientation);
input_array_arg!(mask);
input_array_arg!(mhi);
return_send!(via ocvrs_return);
unsafe { sys::cv_motempl_calcGlobalOrientation_const__InputArrayR_const__InputArrayR_const__InputArrayR_double_double(orientation.as_raw__InputArray(), mask.as_raw__InputArray(), mhi.as_raw__InputArray(), timestamp, duration, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculates a gradient orientation of a motion history image.
///
/// ## Parameters
/// * mhi: Motion history single-channel floating-point image.
/// * mask: Output mask image that has the type CV_8UC1 and the same size as mhi . Its non-zero
/// elements mark pixels where the motion gradient data is correct.
/// * orientation: Output motion gradient orientation image that has the same type and the same
/// size as mhi . Each pixel of the image is a motion orientation, from 0 to 360 degrees.
/// * delta1: Minimal (or maximal) allowed difference between mhi values within a pixel
/// neighborhood.
/// * delta2: Maximal (or minimal) allowed difference between mhi values within a pixel
/// neighborhood. That is, the function finds the minimum (  ) and maximum (  ) mhi
/// values over  neighborhood of each pixel and marks the motion orientation at 
/// as valid only if
/// 
/// * apertureSize: Aperture size of the Sobel operator.
///
/// The function calculates a gradient orientation at each pixel  as:
///
/// 
///
/// In fact, fastAtan2 and phase are used so that the computed angle is measured in degrees and covers
/// the full range 0..360. Also, the mask is filled to indicate pixels where the computed angle is
/// valid.
///
///
/// Note:
/// * (Python) An example on how to perform a motion template technique can be found at
/// opencv_source_code/samples/python2/motempl.py
///
/// ## Note
/// This alternative version of [calc_motion_gradient] function uses the following default values for its arguments:
/// * aperture_size: 3
#[inline]
pub fn calc_motion_gradient_def(mhi: &impl core::ToInputArray, mask: &mut impl core::ToOutputArray, orientation: &mut impl core::ToOutputArray, delta1: f64, delta2: f64) -> Result<()> {
input_array_arg!(mhi);
output_array_arg!(mask);
output_array_arg!(orientation);
return_send!(via ocvrs_return);
unsafe { sys::cv_motempl_calcMotionGradient_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_double_double(mhi.as_raw__InputArray(), mask.as_raw__OutputArray(), orientation.as_raw__OutputArray(), delta1, delta2, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculates a gradient orientation of a motion history image.
///
/// ## Parameters
/// * mhi: Motion history single-channel floating-point image.
/// * mask: Output mask image that has the type CV_8UC1 and the same size as mhi . Its non-zero
/// elements mark pixels where the motion gradient data is correct.
/// * orientation: Output motion gradient orientation image that has the same type and the same
/// size as mhi . Each pixel of the image is a motion orientation, from 0 to 360 degrees.
/// * delta1: Minimal (or maximal) allowed difference between mhi values within a pixel
/// neighborhood.
/// * delta2: Maximal (or minimal) allowed difference between mhi values within a pixel
/// neighborhood. That is, the function finds the minimum (  ) and maximum (  ) mhi
/// values over  neighborhood of each pixel and marks the motion orientation at 
/// as valid only if
/// 
/// * apertureSize: Aperture size of the Sobel operator.
///
/// The function calculates a gradient orientation at each pixel  as:
///
/// 
///
/// In fact, fastAtan2 and phase are used so that the computed angle is measured in degrees and covers
/// the full range 0..360. Also, the mask is filled to indicate pixels where the computed angle is
/// valid.
///
///
/// Note:
/// * (Python) An example on how to perform a motion template technique can be found at
/// opencv_source_code/samples/python2/motempl.py
///
/// ## C++ default parameters
/// * aperture_size: 3
#[inline]
pub fn calc_motion_gradient(mhi: &impl core::ToInputArray, mask: &mut impl core::ToOutputArray, orientation: &mut impl core::ToOutputArray, delta1: f64, delta2: f64, aperture_size: i32) -> Result<()> {
input_array_arg!(mhi);
output_array_arg!(mask);
output_array_arg!(orientation);
return_send!(via ocvrs_return);
unsafe { sys::cv_motempl_calcMotionGradient_const__InputArrayR_const__OutputArrayR_const__OutputArrayR_double_double_int(mhi.as_raw__InputArray(), mask.as_raw__OutputArray(), orientation.as_raw__OutputArray(), delta1, delta2, aperture_size, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Splits a motion history image into a few parts corresponding to separate independent motions (for
/// example, left hand, right hand).
///
/// ## Parameters
/// * mhi: Motion history image.
/// * segmask: Image where the found mask should be stored, single-channel, 32-bit floating-point.
/// * boundingRects: Vector containing ROIs of motion connected components.
/// * timestamp: Current time in milliseconds or other units.
/// * segThresh: Segmentation threshold that is recommended to be equal to the interval between
/// motion history "steps" or greater.
///
/// The function finds all of the motion segments and marks them in segmask with individual values
/// (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion
/// direction for every component can be calculated with calcGlobalOrientation using the extracted mask
/// of the particular component.
#[inline]
pub fn segment_motion(mhi: &impl core::ToInputArray, segmask: &mut impl core::ToOutputArray, bounding_rects: &mut core::Vector<core::Rect>, timestamp: f64, seg_thresh: f64) -> Result<()> {
input_array_arg!(mhi);
output_array_arg!(segmask);
return_send!(via ocvrs_return);
unsafe { sys::cv_motempl_segmentMotion_const__InputArrayR_const__OutputArrayR_vectorLRectGR_double_double(mhi.as_raw__InputArray(), segmask.as_raw__OutputArray(), bounding_rects.as_raw_mut_VectorOfRect(), timestamp, seg_thresh, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Updates the motion history image by a moving silhouette.
///
/// ## Parameters
/// * silhouette: Silhouette mask that has non-zero pixels where the motion occurs.
/// * mhi: Motion history image that is updated by the function (single-channel, 32-bit
/// floating-point).
/// * timestamp: Current time in milliseconds or other units.
/// * duration: Maximal duration of the motion track in the same units as timestamp .
///
/// The function updates the motion history image as follows:
///
/// 
///
/// That is, MHI pixels where the motion occurs are set to the current timestamp , while the pixels
/// where the motion happened last time a long time ago are cleared.
///
/// The function, together with calcMotionGradient and calcGlobalOrientation , implements a motion
/// templates technique described in [Davis97](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Davis97) and [Bradski00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bradski00) .
#[inline]
pub fn update_motion_history(silhouette: &impl core::ToInputArray, mhi: &mut impl core::ToInputOutputArray, timestamp: f64, duration: f64) -> Result<()> {
input_array_arg!(silhouette);
input_output_array_arg!(mhi);
return_send!(via ocvrs_return);
unsafe { sys::cv_motempl_updateMotionHistory_const__InputArrayR_const__InputOutputArrayR_double_double(silhouette.as_raw__InputArray(), mhi.as_raw__InputOutputArray(), timestamp, duration, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme.
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016)).
/// For this scheme the following steps are applied:
/// -# motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep
/// -# (optinally) errornous motion vectors are filter based on the forward backward confidence. The threshold can be configured
/// with setForwardBackward. The filter is only applied if the threshold >0 but than the runtime is doubled due to the estimation
/// of the backward flow.
/// -# Vector field interpolation is applied to the motion vector set to obtain a dense vector field.
///
/// ## Parameters
/// * I0: first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * I1: second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * flow: computed flow image that has the same size as I0 and type CV_32FC2.
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: Threshold for the forward backward confidence check.
/// For each grid point  a motion vector  is computed.
/// If the forward backward error 
/// is larger than threshold given by this function then the motion vector will not be used by the following
/// vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * gridStep: Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed.
/// Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the
/// base of the vector field interpolation.
/// * interp_type: interpolation method used to compute the dense optical flow. Two interpolation algorithms are
/// supported:
/// - **INTERP_GEO** applies the fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016).
/// - **INTERP_EPIC_RESIDUAL** applies the edge-preserving interpolation, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
/// * epicK: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * epicSigma: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * epicLambda: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * ricSPSize: see ximgproc::RICInterpolator sets the respective parameter.
/// * ricSLICType: see ximgproc::RICInterpolator sets the respective parameter.
/// * use_post_proc: enables ximgproc::fastGlobalSmootherFilter() parameter.
/// * fgsLambda: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
/// * fgsSigma: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
/// * use_variational_refinement: enables VariationalRefinement
///
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012), [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013), [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014), [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
///
/// Note: If the grid size is set to (1,1) and the forward backward threshold <= 0 that the dense optical flow field is purely
/// computed with the RLOF.
///
///
/// Note: SIMD parallelization is only available when compiling with SSE4.1.
///
/// Note: Note that in output, if no correspondences are found between \a I0 and \a I1, the \a flow is set to 0.
/// ## See also
/// optflow::DenseRLOFOpticalFlow, optflow::RLOFOpticalFlowParameter
///
/// ## Note
/// This alternative version of [calc_optical_flow_dense_rlof] function uses the following default values for its arguments:
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 0
/// * grid_step: Size(6,6)
/// * interp_type: InterpolationType::INTERP_EPIC
/// * epic_k: 128
/// * epic_sigma: 0.05f
/// * epic_lambda: 100.f
/// * ric_sp_size: 15
/// * ric_slic_type: 100
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
/// * use_variational_refinement: false
#[inline]
pub fn calc_optical_flow_dense_rlof_def(i0: &impl core::ToInputArray, i1: &impl core::ToInputArray, flow: &mut impl core::ToInputOutputArray) -> Result<()> {
input_array_arg!(i0);
input_array_arg!(i1);
input_output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowDenseRLOF_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR(i0.as_raw__InputArray(), i1.as_raw__InputArray(), flow.as_raw__InputOutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme.
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016)).
/// For this scheme the following steps are applied:
/// -# motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep
/// -# (optinally) errornous motion vectors are filter based on the forward backward confidence. The threshold can be configured
/// with setForwardBackward. The filter is only applied if the threshold >0 but than the runtime is doubled due to the estimation
/// of the backward flow.
/// -# Vector field interpolation is applied to the motion vector set to obtain a dense vector field.
///
/// ## Parameters
/// * I0: first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * I1: second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * flow: computed flow image that has the same size as I0 and type CV_32FC2.
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: Threshold for the forward backward confidence check.
/// For each grid point  a motion vector  is computed.
/// If the forward backward error 
/// is larger than threshold given by this function then the motion vector will not be used by the following
/// vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * gridStep: Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed.
/// Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the
/// base of the vector field interpolation.
/// * interp_type: interpolation method used to compute the dense optical flow. Two interpolation algorithms are
/// supported:
/// - **INTERP_GEO** applies the fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016).
/// - **INTERP_EPIC_RESIDUAL** applies the edge-preserving interpolation, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
/// * epicK: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * epicSigma: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * epicLambda: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
/// * ricSPSize: see ximgproc::RICInterpolator sets the respective parameter.
/// * ricSLICType: see ximgproc::RICInterpolator sets the respective parameter.
/// * use_post_proc: enables ximgproc::fastGlobalSmootherFilter() parameter.
/// * fgsLambda: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
/// * fgsSigma: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
/// * use_variational_refinement: enables VariationalRefinement
///
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012), [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013), [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014), [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
///
/// Note: If the grid size is set to (1,1) and the forward backward threshold <= 0 that the dense optical flow field is purely
/// computed with the RLOF.
///
///
/// Note: SIMD parallelization is only available when compiling with SSE4.1.
///
/// Note: Note that in output, if no correspondences are found between \a I0 and \a I1, the \a flow is set to 0.
/// ## See also
/// optflow::DenseRLOFOpticalFlow, optflow::RLOFOpticalFlowParameter
///
/// ## C++ default parameters
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 0
/// * grid_step: Size(6,6)
/// * interp_type: InterpolationType::INTERP_EPIC
/// * epic_k: 128
/// * epic_sigma: 0.05f
/// * epic_lambda: 100.f
/// * ric_sp_size: 15
/// * ric_slic_type: 100
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
/// * use_variational_refinement: false
#[inline]
pub fn calc_optical_flow_dense_rlof(i0: &impl core::ToInputArray, i1: &impl core::ToInputArray, flow: &mut impl core::ToInputOutputArray, mut rlof_param: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>, forward_backward_threshold: f32, grid_step: core::Size, interp_type: crate::optflow::InterpolationType, epic_k: i32, epic_sigma: f32, epic_lambda: f32, ric_sp_size: i32, ric_slic_type: i32, use_post_proc: bool, fgs_lambda: f32, fgs_sigma: f32, use_variational_refinement: bool) -> Result<()> {
input_array_arg!(i0);
input_array_arg!(i1);
input_output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowDenseRLOF_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_PtrLRLOFOpticalFlowParameterG_float_Size_InterpolationType_int_float_float_int_int_bool_float_float_bool(i0.as_raw__InputArray(), i1.as_raw__InputArray(), flow.as_raw__InputOutputArray(), rlof_param.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), forward_backward_threshold, grid_step.opencv_as_extern(), interp_type, epic_k, epic_sigma, epic_lambda, ric_sp_size, ric_slic_type, use_post_proc, fgs_lambda, fgs_sigma, use_variational_refinement, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculate an optical flow using "SimpleFlow" algorithm.
///
/// ## Parameters
/// * from: First 8-bit 3-channel image.
/// * to: Second 8-bit 3-channel image of the same size as prev
/// * flow: computed flow image that has the same size as prev and type CV_32FC2
/// * layers: Number of layers
/// * averaging_block_size: Size of block through which we sum up when calculate cost function
/// for pixel
/// * max_flow: maximal flow that we search at each level
/// * sigma_dist: vector smooth spatial sigma parameter
/// * sigma_color: vector smooth color sigma parameter
/// * postprocess_window: window size for postprocess cross bilateral filter
/// * sigma_dist_fix: spatial sigma for postprocess cross bilateralf filter
/// * sigma_color_fix: color sigma for postprocess cross bilateral filter
/// * occ_thr: threshold for detecting occlusions
/// * upscale_averaging_radius: window size for bilateral upscale operation
/// * upscale_sigma_dist: spatial sigma for bilateral upscale operation
/// * upscale_sigma_color: color sigma for bilateral upscale operation
/// * speed_up_thr: threshold to detect point with irregular flow - where flow should be
/// recalculated after upscale
///
/// See [Tao2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Tao2012) . And site of project - <http://graphics.berkeley.edu/papers/Tao-SAN-2012-05/>.
///
///
/// Note:
/// * An example using the simpleFlow algorithm can be found at samples/simpleflow_demo.cpp
///
/// ## Overloaded parameters
#[inline]
pub fn calc_optical_flow_sf(from: &impl core::ToInputArray, to: &impl core::ToInputArray, flow: &mut impl core::ToOutputArray, layers: i32, averaging_block_size: i32, max_flow: i32) -> Result<()> {
input_array_arg!(from);
input_array_arg!(to);
output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSF_const__InputArrayR_const__InputArrayR_const__OutputArrayR_int_int_int(from.as_raw__InputArray(), to.as_raw__InputArray(), flow.as_raw__OutputArray(), layers, averaging_block_size, max_flow, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculate an optical flow using "SimpleFlow" algorithm.
///
/// ## Parameters
/// * from: First 8-bit 3-channel image.
/// * to: Second 8-bit 3-channel image of the same size as prev
/// * flow: computed flow image that has the same size as prev and type CV_32FC2
/// * layers: Number of layers
/// * averaging_block_size: Size of block through which we sum up when calculate cost function
/// for pixel
/// * max_flow: maximal flow that we search at each level
/// * sigma_dist: vector smooth spatial sigma parameter
/// * sigma_color: vector smooth color sigma parameter
/// * postprocess_window: window size for postprocess cross bilateral filter
/// * sigma_dist_fix: spatial sigma for postprocess cross bilateralf filter
/// * sigma_color_fix: color sigma for postprocess cross bilateral filter
/// * occ_thr: threshold for detecting occlusions
/// * upscale_averaging_radius: window size for bilateral upscale operation
/// * upscale_sigma_dist: spatial sigma for bilateral upscale operation
/// * upscale_sigma_color: color sigma for bilateral upscale operation
/// * speed_up_thr: threshold to detect point with irregular flow - where flow should be
/// recalculated after upscale
///
/// See [Tao2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Tao2012) . And site of project - <http://graphics.berkeley.edu/papers/Tao-SAN-2012-05/>.
///
///
/// Note:
/// * An example using the simpleFlow algorithm can be found at samples/simpleflow_demo.cpp
#[inline]
pub fn calc_optical_flow_sf_1(from: &impl core::ToInputArray, to: &impl core::ToInputArray, flow: &mut impl core::ToOutputArray, layers: i32, averaging_block_size: i32, max_flow: i32, sigma_dist: f64, sigma_color: f64, postprocess_window: i32, sigma_dist_fix: f64, sigma_color_fix: f64, occ_thr: f64, upscale_averaging_radius: i32, upscale_sigma_dist: f64, upscale_sigma_color: f64, speed_up_thr: f64) -> Result<()> {
input_array_arg!(from);
input_array_arg!(to);
output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSF_const__InputArrayR_const__InputArrayR_const__OutputArrayR_int_int_int_double_double_int_double_double_double_int_double_double_double(from.as_raw__InputArray(), to.as_raw__InputArray(), flow.as_raw__OutputArray(), layers, averaging_block_size, max_flow, sigma_dist, sigma_color, postprocess_window, sigma_dist_fix, sigma_color_fix, occ_thr, upscale_averaging_radius, upscale_sigma_dist, upscale_sigma_color, speed_up_thr, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculates fast optical flow for a sparse feature set using the robust local optical flow (RLOF) similar
/// to optflow::calcOpticalFlowPyrLK().
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// ## Parameters
/// * prevImg: first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * nextImg: second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * prevPts: vector of 2D points for which the flow needs to be found; point coordinates must be single-precision
/// floating-point numbers.
/// * nextPts: output vector of 2D points (with single-precision floating-point coordinates) containing the calculated
/// new positions of input features in the second image; when optflow::RLOFOpticalFlowParameter::useInitialFlow variable is true the vector must
/// have the same size as in the input and contain the initialization point correspondences.
/// * status: output status vector (of unsigned chars); each element of the vector is set to 1 if the flow for the
/// corresponding features has passed the forward backward check.
/// * err: output vector of errors; each element of the vector is set to the forward backward error for the corresponding feature.
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: Threshold for the forward backward confidence check. If forewardBackwardThreshold <=0 the forward
///
///
/// Note: SIMD parallelization is only available when compiling with SSE4.1.
///
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012), [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013), [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014) and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
///
/// ## Note
/// This alternative version of [calc_optical_flow_sparse_rlof] function uses the following default values for its arguments:
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 0
#[inline]
pub fn calc_optical_flow_sparse_rlof_def(prev_img: &impl core::ToInputArray, next_img: &impl core::ToInputArray, prev_pts: &impl core::ToInputArray, next_pts: &mut impl core::ToInputOutputArray, status: &mut impl core::ToOutputArray, err: &mut impl core::ToOutputArray) -> Result<()> {
input_array_arg!(prev_img);
input_array_arg!(next_img);
input_array_arg!(prev_pts);
input_output_array_arg!(next_pts);
output_array_arg!(status);
output_array_arg!(err);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSparseRLOF_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__OutputArrayR_const__OutputArrayR(prev_img.as_raw__InputArray(), next_img.as_raw__InputArray(), prev_pts.as_raw__InputArray(), next_pts.as_raw__InputOutputArray(), status.as_raw__OutputArray(), err.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Calculates fast optical flow for a sparse feature set using the robust local optical flow (RLOF) similar
/// to optflow::calcOpticalFlowPyrLK().
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// ## Parameters
/// * prevImg: first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * nextImg: second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType
/// = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
/// * prevPts: vector of 2D points for which the flow needs to be found; point coordinates must be single-precision
/// floating-point numbers.
/// * nextPts: output vector of 2D points (with single-precision floating-point coordinates) containing the calculated
/// new positions of input features in the second image; when optflow::RLOFOpticalFlowParameter::useInitialFlow variable is true the vector must
/// have the same size as in the input and contain the initialization point correspondences.
/// * status: output status vector (of unsigned chars); each element of the vector is set to 1 if the flow for the
/// corresponding features has passed the forward backward check.
/// * err: output vector of errors; each element of the vector is set to the forward backward error for the corresponding feature.
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: Threshold for the forward backward confidence check. If forewardBackwardThreshold <=0 the forward
///
///
/// Note: SIMD parallelization is only available when compiling with SSE4.1.
///
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012), [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013), [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014) and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
///
/// ## C++ default parameters
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 0
#[inline]
pub fn calc_optical_flow_sparse_rlof(prev_img: &impl core::ToInputArray, next_img: &impl core::ToInputArray, prev_pts: &impl core::ToInputArray, next_pts: &mut impl core::ToInputOutputArray, status: &mut impl core::ToOutputArray, err: &mut impl core::ToOutputArray, mut rlof_param: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>, forward_backward_threshold: f32) -> Result<()> {
input_array_arg!(prev_img);
input_array_arg!(next_img);
input_array_arg!(prev_pts);
input_output_array_arg!(next_pts);
output_array_arg!(status);
output_array_arg!(err);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSparseRLOF_const__InputArrayR_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR_const__OutputArrayR_const__OutputArrayR_PtrLRLOFOpticalFlowParameterG_float(prev_img.as_raw__InputArray(), next_img.as_raw__InputArray(), prev_pts.as_raw__InputArray(), next_pts.as_raw__InputOutputArray(), status.as_raw__OutputArray(), err.as_raw__OutputArray(), rlof_param.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), forward_backward_threshold, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Fast dense optical flow based on PyrLK sparse matches interpolation.
///
/// ## Parameters
/// * from: first 8-bit 3-channel or 1-channel image.
/// * to: second 8-bit 3-channel or 1-channel image of the same size as from
/// * flow: computed flow image that has the same size as from and CV_32FC2 type
/// * grid_step: stride used in sparse match computation. Lower values usually
/// result in higher quality but slow down the algorithm.
/// * k: number of nearest-neighbor matches considered, when fitting a locally affine
/// model. Lower values can make the algorithm noticeably faster at the cost of
/// some quality degradation.
/// * sigma: parameter defining how fast the weights decrease in the locally-weighted affine
/// fitting. Higher values can help preserve fine details, lower values can help to get rid
/// of the noise in the output flow.
/// * use_post_proc: defines whether the ximgproc::fastGlobalSmootherFilter() is used
/// for post-processing after interpolation
/// * fgs_lambda: see the respective parameter of the ximgproc::fastGlobalSmootherFilter()
/// * fgs_sigma: see the respective parameter of the ximgproc::fastGlobalSmootherFilter()
///
/// ## Note
/// This alternative version of [calc_optical_flow_sparse_to_dense] function uses the following default values for its arguments:
/// * grid_step: 8
/// * k: 128
/// * sigma: 0.05f
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
#[inline]
pub fn calc_optical_flow_sparse_to_dense_def(from: &impl core::ToInputArray, to: &impl core::ToInputArray, flow: &mut impl core::ToOutputArray) -> Result<()> {
input_array_arg!(from);
input_array_arg!(to);
output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSparseToDense_const__InputArrayR_const__InputArrayR_const__OutputArrayR(from.as_raw__InputArray(), to.as_raw__InputArray(), flow.as_raw__OutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Fast dense optical flow based on PyrLK sparse matches interpolation.
///
/// ## Parameters
/// * from: first 8-bit 3-channel or 1-channel image.
/// * to: second 8-bit 3-channel or 1-channel image of the same size as from
/// * flow: computed flow image that has the same size as from and CV_32FC2 type
/// * grid_step: stride used in sparse match computation. Lower values usually
/// result in higher quality but slow down the algorithm.
/// * k: number of nearest-neighbor matches considered, when fitting a locally affine
/// model. Lower values can make the algorithm noticeably faster at the cost of
/// some quality degradation.
/// * sigma: parameter defining how fast the weights decrease in the locally-weighted affine
/// fitting. Higher values can help preserve fine details, lower values can help to get rid
/// of the noise in the output flow.
/// * use_post_proc: defines whether the ximgproc::fastGlobalSmootherFilter() is used
/// for post-processing after interpolation
/// * fgs_lambda: see the respective parameter of the ximgproc::fastGlobalSmootherFilter()
/// * fgs_sigma: see the respective parameter of the ximgproc::fastGlobalSmootherFilter()
///
/// ## C++ default parameters
/// * grid_step: 8
/// * k: 128
/// * sigma: 0.05f
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
#[inline]
pub fn calc_optical_flow_sparse_to_dense(from: &impl core::ToInputArray, to: &impl core::ToInputArray, flow: &mut impl core::ToOutputArray, grid_step: i32, k: i32, sigma: f32, use_post_proc: bool, fgs_lambda: f32, fgs_sigma: f32) -> Result<()> {
input_array_arg!(from);
input_array_arg!(to);
output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_calcOpticalFlowSparseToDense_const__InputArrayR_const__InputArrayR_const__OutputArrayR_int_int_float_bool_float_float(from.as_raw__InputArray(), to.as_raw__InputArray(), flow.as_raw__OutputArray(), grid_step, k, sigma, use_post_proc, fgs_lambda, fgs_sigma, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// DeepFlow optical flow algorithm implementation.
///
/// The class implements the DeepFlow optical flow algorithm described in [Weinzaepfel2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Weinzaepfel2013) . See
/// also <http://lear.inrialpes.fr/src/deepmatching/> .
/// Parameters - class fields - that may be modified after creating a class instance:
/// * member float alpha
/// Smoothness assumption weight
/// * member float delta
/// Color constancy assumption weight
/// * member float gamma
/// Gradient constancy weight
/// * member float sigma
/// Gaussian smoothing parameter
/// * member int minSize
/// Minimal dimension of an image in the pyramid (next, smaller images in the pyramid are generated
/// until one of the dimensions reaches this size)
/// * member float downscaleFactor
/// Scaling factor in the image pyramid (must be \< 1)
/// * member int fixedPointIterations
/// How many iterations on each level of the pyramid
/// * member int sorIterations
/// Iterations of Succesive Over-Relaxation (solver)
/// * member float omega
/// Relaxation factor in SOR
#[inline]
pub fn create_opt_flow_deep_flow() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_DeepFlow(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Additional interface to the Dense RLOF algorithm - optflow::calcOpticalFlowDenseRLOF()
#[inline]
pub fn create_opt_flow_dense_rlof() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_DenseRLOF(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates instance of cv::DenseOpticalFlow
#[inline]
pub fn create_opt_flow_dual_tvl1() -> Result<core::Ptr<crate::optflow::DualTVL1OpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_DualTVL1(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::DualTVL1OpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Additional interface to the Farneback's algorithm - calcOpticalFlowFarneback()
#[inline]
pub fn create_opt_flow_farneback() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_Farneback(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates an instance of PCAFlow
#[inline]
pub fn create_opt_flow_pca_flow() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_PCAFlow(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Additional interface to the SimpleFlow algorithm - calcOpticalFlowSF()
#[inline]
pub fn create_opt_flow_simple_flow() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_SimpleFlow(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Additional interface to the Sparse RLOF algorithm - optflow::calcOpticalFlowSparseRLOF()
#[inline]
pub fn create_opt_flow_sparse_rlof() -> Result<core::Ptr<crate::video::SparseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_SparseRLOF(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::SparseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Additional interface to the SparseToDenseFlow algorithm - calcOpticalFlowSparseToDense()
#[inline]
pub fn create_opt_flow_sparse_to_dense() -> Result<core::Ptr<crate::video::DenseOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_createOptFlow_SparseToDense(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::video::DenseOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn read(fn_: &core::FileNode, node: &mut crate::optflow::GPCTree_Node, unnamed: crate::optflow::GPCTree_Node) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_read_const_FileNodeR_NodeR_Node(fn_.as_raw_FileNode(), node, unnamed.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn write(fs: &mut core::FileStorage, name: &str, node: crate::optflow::GPCTree_Node) -> Result<()> {
extern_container_arg!(name);
return_send!(via ocvrs_return);
unsafe { sys::cv_write_FileStorageR_const_StringR_const_NodeR(fs.as_raw_mut_FileStorage(), name.opencv_as_extern(), &node, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Constant methods for [crate::optflow::DenseRLOFOpticalFlow]
pub trait DenseRLOFOpticalFlowTraitConst: crate::video::DenseOpticalFlowTraitConst {
fn as_raw_DenseRLOFOpticalFlow(&self) -> *const c_void;
/// Configuration of the RLOF alogrithm.
/// ## See also
/// optflow::RLOFOpticalFlowParameter, getRLOFOpticalFlowParameter
/// optflow::RLOFOpticalFlowParameter, setRLOFOpticalFlowParameter
#[inline]
fn get_rlof_optical_flow_parameter(&self) -> Result<core::Ptr<crate::optflow::RLOFOpticalFlowParameter>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getRLOFOpticalFlowParameter_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::RLOFOpticalFlowParameter>::opencv_from_extern(ret) };
Ok(ret)
}
/// Threshold for the forward backward confidence check
/// For each grid point  a motion vector  is computed.
/// * If the forward backward error 
/// * is larger than threshold given by this function then the motion vector will not be used by the following
/// * vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// * will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * getForwardBackward, setGridStep
/// ## See also
/// setForwardBackward
#[inline]
fn get_forward_backward(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getForwardBackward_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Size of the grid to spawn the motion vectors.
/// For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward
/// * threshold (if set >0). The rest will be the base of the vector field interpolation.
/// * see also: getForwardBackward, setGridStep
#[inline]
fn get_grid_step(&self) -> Result<core::Size> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getGridStep_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Interpolation used to compute the dense optical flow.
/// Two interpolation algorithms are supported
/// * - **INTERP_GEO** applies the fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016).
/// * - **INTERP_EPIC_RESIDUAL** applies the edge-preserving interpolation, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
/// * ximgproc::EdgeAwareInterpolator, getInterpolation
/// ## See also
/// ximgproc::EdgeAwareInterpolator, setInterpolation
#[inline]
fn get_interpolation(&self) -> Result<crate::optflow::InterpolationType> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getInterpolation_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() K value.
/// K is a number of nearest-neighbor matches considered, when fitting a locally affine
/// * model. Usually it should be around 128. However, lower values would make the interpolation noticeably faster.
/// * see also: ximgproc::EdgeAwareInterpolator, setEPICK
#[inline]
fn get_epick(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getEPICK_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() sigma value.
/// Sigma is a parameter defining how fast the weights decrease in the locally-weighted affine
/// * fitting. Higher values can help preserve fine details, lower values can help to get rid of noise in the
/// * output flow.
/// * see also: ximgproc::EdgeAwareInterpolator, setEPICSigma
#[inline]
fn get_epic_sigma(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getEPICSigma_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() lambda value.
/// Lambda is a parameter defining the weight of the edge-aware term in geodesic distance,
/// * should be in the range of 0 to 1000.
/// * see also: ximgproc::EdgeAwareInterpolator, setEPICSigma
#[inline]
fn get_epic_lambda(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getEPICLambda_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator().
/// Sets the respective fastGlobalSmootherFilter() parameter.
/// * see also: ximgproc::EdgeAwareInterpolator, setFgsLambda
#[inline]
fn get_fgs_lambda(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getFgsLambda_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator().
/// Sets the respective fastGlobalSmootherFilter() parameter.
/// * see also: ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, setFgsSigma
#[inline]
fn get_fgs_sigma(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getFgsSigma_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// enables ximgproc::fastGlobalSmootherFilter
///
/// * getUsePostProc
/// ## See also
/// ximgproc::fastGlobalSmootherFilter, setUsePostProc
#[inline]
fn get_use_post_proc(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getUsePostProc_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// enables VariationalRefinement
///
/// * getUseVariationalRefinement
/// ## See also
/// ximgproc::fastGlobalSmootherFilter, setUsePostProc
#[inline]
fn get_use_variational_refinement(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getUseVariationalRefinement_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Parameter to tune the approximate size of the superpixel used for oversegmentation.
///
/// * cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator
/// ## See also
/// setRICSPSize
#[inline]
fn get_ricsp_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getRICSPSize_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Parameter to choose superpixel algorithm variant to use:
/// - cv::ximgproc::SLICType SLIC segments image using a desired region_size (value: 100)
/// - cv::ximgproc::SLICType SLICO will optimize using adaptive compactness factor (value: 101)
/// - cv::ximgproc::SLICType MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels (value: 102).
/// ## See also
/// cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator
/// setRICSLICType
#[inline]
fn get_ricslic_type(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_getRICSLICType_const(self.as_raw_DenseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::DenseRLOFOpticalFlow]
pub trait DenseRLOFOpticalFlowTrait: crate::optflow::DenseRLOFOpticalFlowTraitConst + crate::video::DenseOpticalFlowTrait {
fn as_raw_mut_DenseRLOFOpticalFlow(&mut self) -> *mut c_void;
/// Configuration of the RLOF alogrithm.
/// ## See also
/// optflow::RLOFOpticalFlowParameter, getRLOFOpticalFlowParameter
#[inline]
fn set_rlof_optical_flow_parameter(&mut self, mut val: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setRLOFOpticalFlowParameter_PtrLRLOFOpticalFlowParameterG(self.as_raw_mut_DenseRLOFOpticalFlow(), val.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Threshold for the forward backward confidence check
/// For each grid point  a motion vector  is computed.
/// * If the forward backward error 
/// * is larger than threshold given by this function then the motion vector will not be used by the following
/// * vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// * will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * see also: getForwardBackward, setGridStep
#[inline]
fn set_forward_backward(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setForwardBackward_float(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Size of the grid to spawn the motion vectors.
/// For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward
/// * threshold (if set >0). The rest will be the base of the vector field interpolation.
/// * getForwardBackward, setGridStep
/// ## See also
/// getGridStep
#[inline]
fn set_grid_step(&mut self, val: core::Size) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setGridStep_Size(self.as_raw_mut_DenseRLOFOpticalFlow(), val.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Interpolation used to compute the dense optical flow.
/// Two interpolation algorithms are supported
/// * - **INTERP_GEO** applies the fast geodesic interpolation, see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016).
/// * - **INTERP_EPIC_RESIDUAL** applies the edge-preserving interpolation, see [Revaud2015](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Revaud2015),Geistert2016.
/// * see also: ximgproc::EdgeAwareInterpolator, getInterpolation
#[inline]
fn set_interpolation(&mut self, val: crate::optflow::InterpolationType) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setInterpolation_InterpolationType(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() K value.
/// K is a number of nearest-neighbor matches considered, when fitting a locally affine
/// * model. Usually it should be around 128. However, lower values would make the interpolation noticeably faster.
/// * ximgproc::EdgeAwareInterpolator, setEPICK
/// ## See also
/// ximgproc::EdgeAwareInterpolator, getEPICK
#[inline]
fn set_epick(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setEPICK_int(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() sigma value.
/// Sigma is a parameter defining how fast the weights decrease in the locally-weighted affine
/// * fitting. Higher values can help preserve fine details, lower values can help to get rid of noise in the
/// * output flow.
/// * ximgproc::EdgeAwareInterpolator, setEPICSigma
/// ## See also
/// ximgproc::EdgeAwareInterpolator, getEPICSigma
#[inline]
fn set_epic_sigma(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setEPICSigma_float(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator() lambda value.
/// Lambda is a parameter defining the weight of the edge-aware term in geodesic distance,
/// * should be in the range of 0 to 1000.
/// * ximgproc::EdgeAwareInterpolator, setEPICSigma
/// ## See also
/// ximgproc::EdgeAwareInterpolator, getEPICLambda
#[inline]
fn set_epic_lambda(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setEPICLambda_float(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator().
/// Sets the respective fastGlobalSmootherFilter() parameter.
/// * ximgproc::EdgeAwareInterpolator, setFgsLambda
/// ## See also
/// ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsLambda
#[inline]
fn set_fgs_lambda(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setFgsLambda_float(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// see ximgproc::EdgeAwareInterpolator().
/// Sets the respective fastGlobalSmootherFilter() parameter.
/// * ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, setFgsSigma
/// ## See also
/// ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsSigma
#[inline]
fn set_fgs_sigma(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setFgsSigma_float(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// enables ximgproc::fastGlobalSmootherFilter
///
/// * see also: getUsePostProc
#[inline]
fn set_use_post_proc(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setUsePostProc_bool(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// enables VariationalRefinement
///
/// * see also: getUseVariationalRefinement
#[inline]
fn set_use_variational_refinement(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setUseVariationalRefinement_bool(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Parameter to tune the approximate size of the superpixel used for oversegmentation.
///
/// * see also: cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator
#[inline]
fn set_ricsp_size(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setRICSPSize_int(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Parameter to choose superpixel algorithm variant to use:
/// - cv::ximgproc::SLICType SLIC segments image using a desired region_size (value: 100)
/// - cv::ximgproc::SLICType SLICO will optimize using adaptive compactness factor (value: 101)
/// - cv::ximgproc::SLICType MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels (value: 102).
/// ## See also
/// cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator
#[inline]
fn set_ricslic_type(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_setRICSLICType_int(self.as_raw_mut_DenseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation
/// scheme.
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [Geistert2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Geistert2016)).
/// For this scheme the following steps are applied:
/// -# motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep
/// -# (optinally) errornous motion vectors are filter based on the forward backward confidence. The threshold can be configured
/// with setForwardBackward. The filter is only applied if the threshold >0 but than the runtime is doubled due to the estimation
/// of the backward flow.
/// -# Vector field interpolation is applied to the motion vector set to obtain a dense vector field.
///
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014) and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
///
///
/// Note: If the grid size is set to (1,1) and the forward backward threshold <= 0 than pixelwise dense optical flow field is
/// computed by RLOF without using interpolation.
///
///
/// Note: Note that in output, if no correspondences are found between \a I0 and \a I1, the \a flow is set to 0.
/// ## See also
/// optflow::calcOpticalFlowDenseRLOF(), optflow::RLOFOpticalFlowParameter
pub struct DenseRLOFOpticalFlow {
ptr: *mut c_void
}
opencv_type_boxed! { DenseRLOFOpticalFlow }
impl Drop for DenseRLOFOpticalFlow {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_delete(self.as_raw_mut_DenseRLOFOpticalFlow()) };
}
}
unsafe impl Send for DenseRLOFOpticalFlow {}
impl core::AlgorithmTraitConst for DenseRLOFOpticalFlow {
#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
}
impl core::AlgorithmTrait for DenseRLOFOpticalFlow {
#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::video::DenseOpticalFlowTraitConst for DenseRLOFOpticalFlow {
#[inline] fn as_raw_DenseOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::video::DenseOpticalFlowTrait for DenseRLOFOpticalFlow {
#[inline] fn as_raw_mut_DenseOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::optflow::DenseRLOFOpticalFlowTraitConst for DenseRLOFOpticalFlow {
#[inline] fn as_raw_DenseRLOFOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::DenseRLOFOpticalFlowTrait for DenseRLOFOpticalFlow {
#[inline] fn as_raw_mut_DenseRLOFOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl DenseRLOFOpticalFlow {
/// Creates instance of optflow::DenseRLOFOpticalFlow
///
/// ## Parameters
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: see setForwardBackward
/// * gridStep: see setGridStep
/// * interp_type: see setInterpolation
/// * epicK: see setEPICK
/// * epicSigma: see setEPICSigma
/// * epicLambda: see setEPICLambda
/// * ricSPSize: see setRICSPSize
/// * ricSLICType: see setRICSLICType
/// * use_post_proc: see setUsePostProc
/// * fgsLambda: see setFgsLambda
/// * fgsSigma: see setFgsSigma
/// * use_variational_refinement: see setUseVariationalRefinement
///
/// ## C++ default parameters
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 1.f
/// * grid_step: Size(6,6)
/// * interp_type: InterpolationType::INTERP_EPIC
/// * epic_k: 128
/// * epic_sigma: 0.05f
/// * epic_lambda: 999.0f
/// * ric_sp_size: 15
/// * ric_slic_type: 100
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
/// * use_variational_refinement: false
#[inline]
pub fn create(mut rlof_param: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>, forward_backward_threshold: f32, grid_step: core::Size, interp_type: crate::optflow::InterpolationType, epic_k: i32, epic_sigma: f32, epic_lambda: f32, ric_sp_size: i32, ric_slic_type: i32, use_post_proc: bool, fgs_lambda: f32, fgs_sigma: f32, use_variational_refinement: bool) -> Result<core::Ptr<crate::optflow::DenseRLOFOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_create_PtrLRLOFOpticalFlowParameterG_float_Size_InterpolationType_int_float_float_int_int_bool_float_float_bool(rlof_param.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), forward_backward_threshold, grid_step.opencv_as_extern(), interp_type, epic_k, epic_sigma, epic_lambda, ric_sp_size, ric_slic_type, use_post_proc, fgs_lambda, fgs_sigma, use_variational_refinement, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::DenseRLOFOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates instance of optflow::DenseRLOFOpticalFlow
///
/// ## Parameters
/// * rlofParam: see optflow::RLOFOpticalFlowParameter
/// * forwardBackwardThreshold: see setForwardBackward
/// * gridStep: see setGridStep
/// * interp_type: see setInterpolation
/// * epicK: see setEPICK
/// * epicSigma: see setEPICSigma
/// * epicLambda: see setEPICLambda
/// * ricSPSize: see setRICSPSize
/// * ricSLICType: see setRICSLICType
/// * use_post_proc: see setUsePostProc
/// * fgsLambda: see setFgsLambda
/// * fgsSigma: see setFgsSigma
/// * use_variational_refinement: see setUseVariationalRefinement
///
/// ## Note
/// This alternative version of [DenseRLOFOpticalFlow::create] function uses the following default values for its arguments:
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 1.f
/// * grid_step: Size(6,6)
/// * interp_type: InterpolationType::INTERP_EPIC
/// * epic_k: 128
/// * epic_sigma: 0.05f
/// * epic_lambda: 999.0f
/// * ric_sp_size: 15
/// * ric_slic_type: 100
/// * use_post_proc: true
/// * fgs_lambda: 500.0f
/// * fgs_sigma: 1.5f
/// * use_variational_refinement: false
#[inline]
pub fn create_def() -> Result<core::Ptr<crate::optflow::DenseRLOFOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DenseRLOFOpticalFlow_create(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::DenseRLOFOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
}
boxed_cast_base! { DenseRLOFOpticalFlow, core::Algorithm, cv_optflow_DenseRLOFOpticalFlow_to_Algorithm }
boxed_cast_base! { DenseRLOFOpticalFlow, crate::video::DenseOpticalFlow, cv_optflow_DenseRLOFOpticalFlow_to_DenseOpticalFlow }
impl std::fmt::Debug for DenseRLOFOpticalFlow {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("DenseRLOFOpticalFlow")
.finish()
}
}
/// Constant methods for [crate::optflow::DualTVL1OpticalFlow]
pub trait DualTVL1OpticalFlowTraitConst: crate::video::DenseOpticalFlowTraitConst {
fn as_raw_DualTVL1OpticalFlow(&self) -> *const c_void;
/// Time step of the numerical scheme
/// ## See also
/// setTau
#[inline]
fn get_tau(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getTau_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Weight parameter for the data term, attachment parameter
/// ## See also
/// setLambda
#[inline]
fn get_lambda(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getLambda_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Weight parameter for (u - v)^2, tightness parameter
/// ## See also
/// setTheta
#[inline]
fn get_theta(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getTheta_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// coefficient for additional illumination variation term
/// ## See also
/// setGamma
#[inline]
fn get_gamma(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getGamma_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Number of scales used to create the pyramid of images
/// ## See also
/// setScalesNumber
#[inline]
fn get_scales_number(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getScalesNumber_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Number of warpings per scale
/// ## See also
/// setWarpingsNumber
#[inline]
fn get_warpings_number(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getWarpingsNumber_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time
/// ## See also
/// setEpsilon
#[inline]
fn get_epsilon(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getEpsilon_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Inner iterations (between outlier filtering) used in the numerical scheme
/// ## See also
/// setInnerIterations
#[inline]
fn get_inner_iterations(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getInnerIterations_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Outer iterations (number of inner loops) used in the numerical scheme
/// ## See also
/// setOuterIterations
#[inline]
fn get_outer_iterations(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getOuterIterations_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Use initial flow
/// ## See also
/// setUseInitialFlow
#[inline]
fn get_use_initial_flow(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getUseInitialFlow_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Step between scales (<1)
/// ## See also
/// setScaleStep
#[inline]
fn get_scale_step(&self) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getScaleStep_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Median filter kernel size (1 = no filter) (3 or 5)
/// ## See also
/// setMedianFiltering
#[inline]
fn get_median_filtering(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_getMedianFiltering_const(self.as_raw_DualTVL1OpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::DualTVL1OpticalFlow]
pub trait DualTVL1OpticalFlowTrait: crate::optflow::DualTVL1OpticalFlowTraitConst + crate::video::DenseOpticalFlowTrait {
fn as_raw_mut_DualTVL1OpticalFlow(&mut self) -> *mut c_void;
/// Time step of the numerical scheme
/// ## See also
/// setTau getTau
#[inline]
fn set_tau(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setTau_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Weight parameter for the data term, attachment parameter
/// ## See also
/// setLambda getLambda
#[inline]
fn set_lambda(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setLambda_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Weight parameter for (u - v)^2, tightness parameter
/// ## See also
/// setTheta getTheta
#[inline]
fn set_theta(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setTheta_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// coefficient for additional illumination variation term
/// ## See also
/// setGamma getGamma
#[inline]
fn set_gamma(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setGamma_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Number of scales used to create the pyramid of images
/// ## See also
/// setScalesNumber getScalesNumber
#[inline]
fn set_scales_number(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setScalesNumber_int(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Number of warpings per scale
/// ## See also
/// setWarpingsNumber getWarpingsNumber
#[inline]
fn set_warpings_number(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setWarpingsNumber_int(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time
/// ## See also
/// setEpsilon getEpsilon
#[inline]
fn set_epsilon(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setEpsilon_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Inner iterations (between outlier filtering) used in the numerical scheme
/// ## See also
/// setInnerIterations getInnerIterations
#[inline]
fn set_inner_iterations(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setInnerIterations_int(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Outer iterations (number of inner loops) used in the numerical scheme
/// ## See also
/// setOuterIterations getOuterIterations
#[inline]
fn set_outer_iterations(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setOuterIterations_int(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Use initial flow
/// ## See also
/// setUseInitialFlow getUseInitialFlow
#[inline]
fn set_use_initial_flow(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setUseInitialFlow_bool(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Step between scales (<1)
/// ## See also
/// setScaleStep getScaleStep
#[inline]
fn set_scale_step(&mut self, val: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setScaleStep_double(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Median filter kernel size (1 = no filter) (3 or 5)
/// ## See also
/// setMedianFiltering getMedianFiltering
#[inline]
fn set_median_filtering(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_setMedianFiltering_int(self.as_raw_mut_DualTVL1OpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// "Dual TV L1" Optical Flow Algorithm.
///
/// The class implements the "Dual TV L1" optical flow algorithm described in [Zach2007](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Zach2007) and
/// [Javier2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Javier2012) .
/// Here are important members of the class that control the algorithm, which you can set after
/// constructing the class instance:
///
/// * member double tau
/// Time step of the numerical scheme.
///
/// * member double lambda
/// Weight parameter for the data term, attachment parameter. This is the most relevant
/// parameter, which determines the smoothness of the output. The smaller this parameter is,
/// the smoother the solutions we obtain. It depends on the range of motions of the images, so
/// its value should be adapted to each image sequence.
///
/// * member double theta
/// Weight parameter for (u - v)\^2, tightness parameter. It serves as a link between the
/// attachment and the regularization terms. In theory, it should have a small value in order
/// to maintain both parts in correspondence. The method is stable for a large range of values
/// of this parameter.
///
/// * member int nscales
/// Number of scales used to create the pyramid of images.
///
/// * member int warps
/// Number of warpings per scale. Represents the number of times that I1(x+u0) and grad(
/// I1(x+u0) ) are computed per scale. This is a parameter that assures the stability of the
/// method. It also affects the running time, so it is a compromise between speed and
/// accuracy.
///
/// * member double epsilon
/// Stopping criterion threshold used in the numerical scheme, which is a trade-off between
/// precision and running time. A small value will yield more accurate solutions at the
/// expense of a slower convergence.
///
/// * member int iterations
/// Stopping criterion iterations number used in the numerical scheme.
///
/// C. Zach, T. Pock and H. Bischof, "A Duality Based Approach for Realtime TV-L1 Optical Flow".
/// Javier Sanchez, Enric Meinhardt-Llopis and Gabriele Facciolo. "TV-L1 Optical Flow Estimation".
pub struct DualTVL1OpticalFlow {
ptr: *mut c_void
}
opencv_type_boxed! { DualTVL1OpticalFlow }
impl Drop for DualTVL1OpticalFlow {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_delete(self.as_raw_mut_DualTVL1OpticalFlow()) };
}
}
unsafe impl Send for DualTVL1OpticalFlow {}
impl core::AlgorithmTraitConst for DualTVL1OpticalFlow {
#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
}
impl core::AlgorithmTrait for DualTVL1OpticalFlow {
#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::video::DenseOpticalFlowTraitConst for DualTVL1OpticalFlow {
#[inline] fn as_raw_DenseOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::video::DenseOpticalFlowTrait for DualTVL1OpticalFlow {
#[inline] fn as_raw_mut_DenseOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::optflow::DualTVL1OpticalFlowTraitConst for DualTVL1OpticalFlow {
#[inline] fn as_raw_DualTVL1OpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::DualTVL1OpticalFlowTrait for DualTVL1OpticalFlow {
#[inline] fn as_raw_mut_DualTVL1OpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl DualTVL1OpticalFlow {
/// Creates instance of cv::DualTVL1OpticalFlow
///
/// ## C++ default parameters
/// * tau: 0.25
/// * lambda: 0.15
/// * theta: 0.3
/// * nscales: 5
/// * warps: 5
/// * epsilon: 0.01
/// * innner_iterations: 30
/// * outer_iterations: 10
/// * scale_step: 0.8
/// * gamma: 0.0
/// * median_filtering: 5
/// * use_initial_flow: false
#[inline]
pub fn create(tau: f64, lambda: f64, theta: f64, nscales: i32, warps: i32, epsilon: f64, innner_iterations: i32, outer_iterations: i32, scale_step: f64, gamma: f64, median_filtering: i32, use_initial_flow: bool) -> Result<core::Ptr<crate::optflow::DualTVL1OpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_create_double_double_double_int_int_double_int_int_double_double_int_bool(tau, lambda, theta, nscales, warps, epsilon, innner_iterations, outer_iterations, scale_step, gamma, median_filtering, use_initial_flow, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::DualTVL1OpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates instance of cv::DualTVL1OpticalFlow
///
/// ## Note
/// This alternative version of [DualTVL1OpticalFlow::create] function uses the following default values for its arguments:
/// * tau: 0.25
/// * lambda: 0.15
/// * theta: 0.3
/// * nscales: 5
/// * warps: 5
/// * epsilon: 0.01
/// * innner_iterations: 30
/// * outer_iterations: 10
/// * scale_step: 0.8
/// * gamma: 0.0
/// * median_filtering: 5
/// * use_initial_flow: false
#[inline]
pub fn create_def() -> Result<core::Ptr<crate::optflow::DualTVL1OpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_DualTVL1OpticalFlow_create(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::DualTVL1OpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
}
boxed_cast_base! { DualTVL1OpticalFlow, core::Algorithm, cv_optflow_DualTVL1OpticalFlow_to_Algorithm }
boxed_cast_base! { DualTVL1OpticalFlow, crate::video::DenseOpticalFlow, cv_optflow_DualTVL1OpticalFlow_to_DenseOpticalFlow }
impl std::fmt::Debug for DualTVL1OpticalFlow {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("DualTVL1OpticalFlow")
.finish()
}
}
/// Constant methods for [crate::optflow::GPCDetails]
pub trait GPCDetailsTraitConst {
fn as_raw_GPCDetails(&self) -> *const c_void;
}
/// Mutable methods for [crate::optflow::GPCDetails]
pub trait GPCDetailsTrait: crate::optflow::GPCDetailsTraitConst {
fn as_raw_mut_GPCDetails(&mut self) -> *mut c_void;
}
pub struct GPCDetails {
ptr: *mut c_void
}
opencv_type_boxed! { GPCDetails }
impl Drop for GPCDetails {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_GPCDetails_delete(self.as_raw_mut_GPCDetails()) };
}
}
unsafe impl Send for GPCDetails {}
impl crate::optflow::GPCDetailsTraitConst for GPCDetails {
#[inline] fn as_raw_GPCDetails(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::GPCDetailsTrait for GPCDetails {
#[inline] fn as_raw_mut_GPCDetails(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl GPCDetails {
#[inline]
pub fn drop_outliers(corr: &mut core::Vector<core::Tuple<(core::Point2i, core::Point2i)>>) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCDetails_dropOutliers_vectorLpairLcv_Point2i__cv_Point2iGGR(corr.as_raw_mut_VectorOfTupleOfPoint2i_Point2i(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn get_all_descriptors_for_image(img_ch: &core::Mat, descr: &mut core::Vector<crate::optflow::GPCPatchDescriptor>, mp: crate::optflow::GPCMatchingParams, typ: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCDetails_getAllDescriptorsForImage_const_MatX_vectorLGPCPatchDescriptorGR_const_GPCMatchingParamsR_int(img_ch.as_raw_Mat(), descr.as_raw_mut_VectorOfGPCPatchDescriptor(), &mp, typ, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn get_coordinates_from_index(index: size_t, sz: core::Size, x: &mut i32, y: &mut i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCDetails_getCoordinatesFromIndex_size_t_Size_intR_intR(index, sz.opencv_as_extern(), x, y, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl std::fmt::Debug for GPCDetails {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("GPCDetails")
.finish()
}
}
/// Class encapsulating matching parameters.
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct GPCMatchingParams {
/// Whether to use OpenCL to speed up the matching.
pub use_opencl: bool,
}
opencv_type_simple! { crate::optflow::GPCMatchingParams }
impl GPCMatchingParams {
/// ## C++ default parameters
/// * _use_opencl: false
#[inline]
pub fn new(_use_opencl: bool) -> Result<crate::optflow::GPCMatchingParams> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCMatchingParams_GPCMatchingParams_bool(_use_opencl, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * _use_opencl: false
#[inline]
pub fn new_def() -> Result<crate::optflow::GPCMatchingParams> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCMatchingParams_GPCMatchingParams(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
pub fn copy(params: crate::optflow::GPCMatchingParams) -> Result<crate::optflow::GPCMatchingParams> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCMatchingParams_GPCMatchingParams_const_GPCMatchingParamsR(¶ms, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Constant methods for [crate::optflow::GPCPatchDescriptor]
pub trait GPCPatchDescriptorTraitConst {
fn as_raw_GPCPatchDescriptor(&self) -> *const c_void;
#[inline]
fn feature(&self) -> core::VecN<f64, 18> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCPatchDescriptor_propFeature_const(self.as_raw_GPCPatchDescriptor(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
#[inline]
fn dot(&self, coef: core::VecN<f64, 18>) -> Result<f64> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCPatchDescriptor_dot_const_const_VecLdouble__18GR(self.as_raw_GPCPatchDescriptor(), &coef, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn is_separated(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCPatchDescriptor_isSeparated_const(self.as_raw_GPCPatchDescriptor(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::GPCPatchDescriptor]
pub trait GPCPatchDescriptorTrait: crate::optflow::GPCPatchDescriptorTraitConst {
fn as_raw_mut_GPCPatchDescriptor(&mut self) -> *mut c_void;
#[inline]
fn set_feature(&mut self, val: core::VecN<f64, 18>) {
let ret = unsafe { sys::cv_optflow_GPCPatchDescriptor_propFeature_VecLdouble__18G(self.as_raw_mut_GPCPatchDescriptor(), val.opencv_as_extern()) };
ret
}
#[inline]
fn mark_as_separated(&mut self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCPatchDescriptor_markAsSeparated(self.as_raw_mut_GPCPatchDescriptor(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
pub struct GPCPatchDescriptor {
ptr: *mut c_void
}
opencv_type_boxed! { GPCPatchDescriptor }
impl Drop for GPCPatchDescriptor {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_GPCPatchDescriptor_delete(self.as_raw_mut_GPCPatchDescriptor()) };
}
}
unsafe impl Send for GPCPatchDescriptor {}
impl crate::optflow::GPCPatchDescriptorTraitConst for GPCPatchDescriptor {
#[inline] fn as_raw_GPCPatchDescriptor(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::GPCPatchDescriptorTrait for GPCPatchDescriptor {
#[inline] fn as_raw_mut_GPCPatchDescriptor(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl GPCPatchDescriptor {
/// number of features in a patch descriptor
pub const nFeatures: u32 = 18;
}
impl std::fmt::Debug for GPCPatchDescriptor {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("GPCPatchDescriptor")
.field("feature", &crate::optflow::GPCPatchDescriptorTraitConst::feature(self))
.finish()
}
}
/// Constant methods for [crate::optflow::GPCPatchSample]
pub trait GPCPatchSampleTraitConst {
fn as_raw_GPCPatchSample(&self) -> *const c_void;
#[inline]
fn ref_(&self) -> crate::optflow::GPCPatchDescriptor {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propRef_const(self.as_raw_GPCPatchSample()) };
let ret = unsafe { crate::optflow::GPCPatchDescriptor::opencv_from_extern(ret) };
ret
}
#[inline]
fn pos(&self) -> crate::optflow::GPCPatchDescriptor {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propPos_const(self.as_raw_GPCPatchSample()) };
let ret = unsafe { crate::optflow::GPCPatchDescriptor::opencv_from_extern(ret) };
ret
}
#[inline]
fn neg(&self) -> crate::optflow::GPCPatchDescriptor {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propNeg_const(self.as_raw_GPCPatchSample()) };
let ret = unsafe { crate::optflow::GPCPatchDescriptor::opencv_from_extern(ret) };
ret
}
#[inline]
fn get_directions(&self, refdir: &mut bool, posdir: &mut bool, negdir: &mut bool, coef: core::VecN<f64, 18>, rhs: f64) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCPatchSample_getDirections_const_boolR_boolR_boolR_const_VecLdouble__18GR_double(self.as_raw_GPCPatchSample(), refdir, posdir, negdir, &coef, rhs, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::GPCPatchSample]
pub trait GPCPatchSampleTrait: crate::optflow::GPCPatchSampleTraitConst {
fn as_raw_mut_GPCPatchSample(&mut self) -> *mut c_void;
#[inline]
fn set_ref(&mut self, mut val: crate::optflow::GPCPatchDescriptor) {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propRef_GPCPatchDescriptor(self.as_raw_mut_GPCPatchSample(), val.as_raw_mut_GPCPatchDescriptor()) };
ret
}
#[inline]
fn set_pos(&mut self, mut val: crate::optflow::GPCPatchDescriptor) {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propPos_GPCPatchDescriptor(self.as_raw_mut_GPCPatchSample(), val.as_raw_mut_GPCPatchDescriptor()) };
ret
}
#[inline]
fn set_neg(&mut self, mut val: crate::optflow::GPCPatchDescriptor) {
let ret = unsafe { sys::cv_optflow_GPCPatchSample_propNeg_GPCPatchDescriptor(self.as_raw_mut_GPCPatchSample(), val.as_raw_mut_GPCPatchDescriptor()) };
ret
}
}
pub struct GPCPatchSample {
ptr: *mut c_void
}
opencv_type_boxed! { GPCPatchSample }
impl Drop for GPCPatchSample {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_GPCPatchSample_delete(self.as_raw_mut_GPCPatchSample()) };
}
}
unsafe impl Send for GPCPatchSample {}
impl crate::optflow::GPCPatchSampleTraitConst for GPCPatchSample {
#[inline] fn as_raw_GPCPatchSample(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::GPCPatchSampleTrait for GPCPatchSample {
#[inline] fn as_raw_mut_GPCPatchSample(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl GPCPatchSample {
}
impl std::fmt::Debug for GPCPatchSample {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("GPCPatchSample")
.field("ref_", &crate::optflow::GPCPatchSampleTraitConst::ref_(self))
.field("pos", &crate::optflow::GPCPatchSampleTraitConst::pos(self))
.field("neg", &crate::optflow::GPCPatchSampleTraitConst::neg(self))
.finish()
}
}
/// Class encapsulating training parameters.
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct GPCTrainingParams {
/// Maximum tree depth to stop partitioning.
pub max_tree_depth: u32,
/// Minimum number of samples in the node to stop partitioning.
pub min_number_of_samples: i32,
/// Type of descriptors to use.
pub descriptor_type: i32,
/// Print progress to stdout.
pub print_progress: bool,
}
opencv_type_simple! { crate::optflow::GPCTrainingParams }
impl GPCTrainingParams {
#[inline]
pub fn check(self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingParams_check_const(self.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// ## C++ default parameters
/// * _max_tree_depth: 20
/// * _min_number_of_samples: 3
/// * _descriptor_type: GPC_DESCRIPTOR_DCT
/// * _print_progress: true
#[inline]
pub fn new(_max_tree_depth: u32, _min_number_of_samples: i32, _descriptor_type: crate::optflow::GPCDescType, _print_progress: bool) -> Result<crate::optflow::GPCTrainingParams> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingParams_GPCTrainingParams_unsigned_int_int_GPCDescType_bool(_max_tree_depth, _min_number_of_samples, _descriptor_type, _print_progress, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * _max_tree_depth: 20
/// * _min_number_of_samples: 3
/// * _descriptor_type: GPC_DESCRIPTOR_DCT
/// * _print_progress: true
#[inline]
pub fn new_def() -> Result<crate::optflow::GPCTrainingParams> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingParams_GPCTrainingParams(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Constant methods for [crate::optflow::GPCTrainingSamples]
pub trait GPCTrainingSamplesTraitConst {
fn as_raw_GPCTrainingSamples(&self) -> *const c_void;
#[inline]
fn size(&self) -> Result<size_t> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingSamples_size_const(self.as_raw_GPCTrainingSamples(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn typ(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingSamples_type_const(self.as_raw_GPCTrainingSamples(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::GPCTrainingSamples]
pub trait GPCTrainingSamplesTrait: crate::optflow::GPCTrainingSamplesTraitConst {
fn as_raw_mut_GPCTrainingSamples(&mut self) -> *mut c_void;
}
/// Class encapsulating training samples.
pub struct GPCTrainingSamples {
ptr: *mut c_void
}
opencv_type_boxed! { GPCTrainingSamples }
impl Drop for GPCTrainingSamples {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_GPCTrainingSamples_delete(self.as_raw_mut_GPCTrainingSamples()) };
}
}
unsafe impl Send for GPCTrainingSamples {}
impl crate::optflow::GPCTrainingSamplesTraitConst for GPCTrainingSamples {
#[inline] fn as_raw_GPCTrainingSamples(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::GPCTrainingSamplesTrait for GPCTrainingSamples {
#[inline] fn as_raw_mut_GPCTrainingSamples(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl GPCTrainingSamples {
/// This function can be used to extract samples from a pair of images and a ground truth flow.
/// Sizes of all the provided vectors must be equal.
#[inline]
pub fn create(images_from: &core::Vector<String>, images_to: &core::Vector<String>, gt: &core::Vector<String>, descriptor_type: i32) -> Result<core::Ptr<crate::optflow::GPCTrainingSamples>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingSamples_create_const_vectorLStringGR_const_vectorLStringGR_const_vectorLStringGR_int(images_from.as_raw_VectorOfString(), images_to.as_raw_VectorOfString(), gt.as_raw_VectorOfString(), descriptor_type, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::GPCTrainingSamples>::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn create_1(images_from: &impl core::ToInputArray, images_to: &impl core::ToInputArray, gt: &impl core::ToInputArray, descriptor_type: i32) -> Result<core::Ptr<crate::optflow::GPCTrainingSamples>> {
input_array_arg!(images_from);
input_array_arg!(images_to);
input_array_arg!(gt);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTrainingSamples_create_const__InputArrayR_const__InputArrayR_const__InputArrayR_int(images_from.as_raw__InputArray(), images_to.as_raw__InputArray(), gt.as_raw__InputArray(), descriptor_type, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::GPCTrainingSamples>::opencv_from_extern(ret) };
Ok(ret)
}
}
impl std::fmt::Debug for GPCTrainingSamples {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("GPCTrainingSamples")
.finish()
}
}
/// Constant methods for [crate::optflow::GPCTree]
pub trait GPCTreeTraitConst: core::AlgorithmTraitConst {
fn as_raw_GPCTree(&self) -> *const c_void;
#[inline]
fn write(&self, fs: &mut core::FileStorage) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_write_const_FileStorageR(self.as_raw_GPCTree(), fs.as_raw_mut_FileStorage(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn find_leaf_for_patch(&self, descr: &crate::optflow::GPCPatchDescriptor) -> Result<u32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_findLeafForPatch_const_const_GPCPatchDescriptorR(self.as_raw_GPCTree(), descr.as_raw_GPCPatchDescriptor(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn equals(&self, t: &crate::optflow::GPCTree) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_operatorEQ_const_const_GPCTreeR(self.as_raw_GPCTree(), t.as_raw_GPCTree(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_descriptor_type(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_getDescriptorType_const(self.as_raw_GPCTree(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::GPCTree]
pub trait GPCTreeTrait: core::AlgorithmTrait + crate::optflow::GPCTreeTraitConst {
fn as_raw_mut_GPCTree(&mut self) -> *mut c_void;
/// ## C++ default parameters
/// * params: GPCTrainingParams()
#[inline]
fn train(&mut self, samples: &mut crate::optflow::GPCTrainingSamples, params: crate::optflow::GPCTrainingParams) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_train_GPCTrainingSamplesR_const_GPCTrainingParams(self.as_raw_mut_GPCTree(), samples.as_raw_mut_GPCTrainingSamples(), params.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// ## Note
/// This alternative version of [GPCTreeTrait::train] function uses the following default values for its arguments:
/// * params: GPCTrainingParams()
#[inline]
fn train_def(&mut self, samples: &mut crate::optflow::GPCTrainingSamples) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_train_GPCTrainingSamplesR(self.as_raw_mut_GPCTree(), samples.as_raw_mut_GPCTrainingSamples(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn read(&mut self, fn_: &core::FileNode) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_read_const_FileNodeR(self.as_raw_mut_GPCTree(), fn_.as_raw_FileNode(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Class for individual tree.
pub struct GPCTree {
ptr: *mut c_void
}
opencv_type_boxed! { GPCTree }
impl Drop for GPCTree {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_GPCTree_delete(self.as_raw_mut_GPCTree()) };
}
}
unsafe impl Send for GPCTree {}
impl core::AlgorithmTraitConst for GPCTree {
#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
}
impl core::AlgorithmTrait for GPCTree {
#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::optflow::GPCTreeTraitConst for GPCTree {
#[inline] fn as_raw_GPCTree(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::GPCTreeTrait for GPCTree {
#[inline] fn as_raw_mut_GPCTree(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl GPCTree {
#[inline]
pub fn create() -> Result<core::Ptr<crate::optflow::GPCTree>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_create(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::GPCTree>::opencv_from_extern(ret) };
Ok(ret)
}
}
boxed_cast_base! { GPCTree, core::Algorithm, cv_optflow_GPCTree_to_Algorithm }
impl std::fmt::Debug for GPCTree {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("GPCTree")
.finish()
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct GPCTree_Node {
/// Hyperplane coefficients
pub coef: core::VecN<f64, 18>,
/// Bias term of the hyperplane
pub rhs: f64,
pub left: u32,
pub right: u32,
}
opencv_type_simple! { crate::optflow::GPCTree_Node }
impl GPCTree_Node {
#[inline]
pub fn equals(self, n: crate::optflow::GPCTree_Node) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_GPCTree_Node_operatorEQ_const_const_NodeR(self.opencv_as_extern(), &n, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Constant methods for [crate::optflow::OpticalFlowPCAFlow]
pub trait OpticalFlowPCAFlowTraitConst: crate::video::DenseOpticalFlowTraitConst {
fn as_raw_OpticalFlowPCAFlow(&self) -> *const c_void;
}
/// Mutable methods for [crate::optflow::OpticalFlowPCAFlow]
pub trait OpticalFlowPCAFlowTrait: crate::optflow::OpticalFlowPCAFlowTraitConst + crate::video::DenseOpticalFlowTrait {
fn as_raw_mut_OpticalFlowPCAFlow(&mut self) -> *mut c_void;
#[inline]
fn calc(&mut self, i0: &impl core::ToInputArray, i1: &impl core::ToInputArray, flow: &mut impl core::ToInputOutputArray) -> Result<()> {
input_array_arg!(i0);
input_array_arg!(i1);
input_output_array_arg!(flow);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_OpticalFlowPCAFlow_calc_const__InputArrayR_const__InputArrayR_const__InputOutputArrayR(self.as_raw_mut_OpticalFlowPCAFlow(), i0.as_raw__InputArray(), i1.as_raw__InputArray(), flow.as_raw__InputOutputArray(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn collect_garbage(&mut self) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_OpticalFlowPCAFlow_collectGarbage(self.as_raw_mut_OpticalFlowPCAFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// PCAFlow algorithm.
pub struct OpticalFlowPCAFlow {
ptr: *mut c_void
}
opencv_type_boxed! { OpticalFlowPCAFlow }
impl Drop for OpticalFlowPCAFlow {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_OpticalFlowPCAFlow_delete(self.as_raw_mut_OpticalFlowPCAFlow()) };
}
}
unsafe impl Send for OpticalFlowPCAFlow {}
impl core::AlgorithmTraitConst for OpticalFlowPCAFlow {
#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
}
impl core::AlgorithmTrait for OpticalFlowPCAFlow {
#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::video::DenseOpticalFlowTraitConst for OpticalFlowPCAFlow {
#[inline] fn as_raw_DenseOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::video::DenseOpticalFlowTrait for OpticalFlowPCAFlow {
#[inline] fn as_raw_mut_DenseOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::optflow::OpticalFlowPCAFlowTraitConst for OpticalFlowPCAFlow {
#[inline] fn as_raw_OpticalFlowPCAFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::OpticalFlowPCAFlowTrait for OpticalFlowPCAFlow {
#[inline] fn as_raw_mut_OpticalFlowPCAFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl OpticalFlowPCAFlow {
/// Creates an instance of PCAFlow algorithm.
/// ## Parameters
/// * _prior: Learned prior or no prior (default). see also: cv::optflow::PCAPrior
/// * _basisSize: Number of basis vectors.
/// * _sparseRate: Controls density of sparse matches.
/// * _retainedCornersFraction: Retained corners fraction.
/// * _occlusionsThreshold: Occlusion threshold.
/// * _dampingFactor: Regularization term for solving least-squares. It is not related to the prior regularization.
/// * _claheClip: Clip parameter for CLAHE.
///
/// ## C++ default parameters
/// * _prior: Ptr<constPCAPrior>()
/// * _basis_size: Size(18,14)
/// * _sparse_rate: 0.024
/// * _retained_corners_fraction: 0.2
/// * _occlusions_threshold: 0.0003
/// * _damping_factor: 0.00002
/// * _clahe_clip: 14
#[inline]
pub fn new(_prior: core::Ptr<crate::optflow::PCAPrior>, _basis_size: core::Size, _sparse_rate: f32, _retained_corners_fraction: f32, _occlusions_threshold: f32, _damping_factor: f32, _clahe_clip: f32) -> Result<crate::optflow::OpticalFlowPCAFlow> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_OpticalFlowPCAFlow_OpticalFlowPCAFlow_PtrLconst_PCAPriorG_const_Size_float_float_float_float_float(_prior.as_raw_PtrOfPCAPrior(), _basis_size.opencv_as_extern(), _sparse_rate, _retained_corners_fraction, _occlusions_threshold, _damping_factor, _clahe_clip, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::optflow::OpticalFlowPCAFlow::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates an instance of PCAFlow algorithm.
/// ## Parameters
/// * _prior: Learned prior or no prior (default). see also: cv::optflow::PCAPrior
/// * _basisSize: Number of basis vectors.
/// * _sparseRate: Controls density of sparse matches.
/// * _retainedCornersFraction: Retained corners fraction.
/// * _occlusionsThreshold: Occlusion threshold.
/// * _dampingFactor: Regularization term for solving least-squares. It is not related to the prior regularization.
/// * _claheClip: Clip parameter for CLAHE.
///
/// ## Note
/// This alternative version of [new] function uses the following default values for its arguments:
/// * _prior: Ptr<constPCAPrior>()
/// * _basis_size: Size(18,14)
/// * _sparse_rate: 0.024
/// * _retained_corners_fraction: 0.2
/// * _occlusions_threshold: 0.0003
/// * _damping_factor: 0.00002
/// * _clahe_clip: 14
#[inline]
pub fn new_def() -> Result<crate::optflow::OpticalFlowPCAFlow> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_OpticalFlowPCAFlow_OpticalFlowPCAFlow(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::optflow::OpticalFlowPCAFlow::opencv_from_extern(ret) };
Ok(ret)
}
}
boxed_cast_base! { OpticalFlowPCAFlow, core::Algorithm, cv_optflow_OpticalFlowPCAFlow_to_Algorithm }
boxed_cast_base! { OpticalFlowPCAFlow, crate::video::DenseOpticalFlow, cv_optflow_OpticalFlowPCAFlow_to_DenseOpticalFlow }
impl std::fmt::Debug for OpticalFlowPCAFlow {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("OpticalFlowPCAFlow")
.finish()
}
}
/// Constant methods for [crate::optflow::PCAPrior]
pub trait PCAPriorTraitConst {
fn as_raw_PCAPrior(&self) -> *const c_void;
#[inline]
fn get_padding(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_PCAPrior_getPadding_const(self.as_raw_PCAPrior(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_basis_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_PCAPrior_getBasisSize_const(self.as_raw_PCAPrior(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn fill_constraints(&self, a1: &mut f32, a2: &mut f32, b1: &mut f32, b2: &mut f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_PCAPrior_fillConstraints_const_floatX_floatX_floatX_floatX(self.as_raw_PCAPrior(), a1, a2, b1, b2, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::PCAPrior]
pub trait PCAPriorTrait: crate::optflow::PCAPriorTraitConst {
fn as_raw_mut_PCAPrior(&mut self) -> *mut c_void;
}
///
/// This class can be used for imposing a learned prior on the resulting optical flow.
/// Solution will be regularized according to this prior.
/// You need to generate appropriate prior file with "learn_prior.py" script beforehand.
pub struct PCAPrior {
ptr: *mut c_void
}
opencv_type_boxed! { PCAPrior }
impl Drop for PCAPrior {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_PCAPrior_delete(self.as_raw_mut_PCAPrior()) };
}
}
unsafe impl Send for PCAPrior {}
impl crate::optflow::PCAPriorTraitConst for PCAPrior {
#[inline] fn as_raw_PCAPrior(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::PCAPriorTrait for PCAPrior {
#[inline] fn as_raw_mut_PCAPrior(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl PCAPrior {
#[inline]
pub fn new(path_to_prior: &str) -> Result<crate::optflow::PCAPrior> {
extern_container_arg!(path_to_prior);
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_PCAPrior_PCAPrior_const_charX(path_to_prior.opencv_as_extern(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::optflow::PCAPrior::opencv_from_extern(ret) };
Ok(ret)
}
}
impl std::fmt::Debug for PCAPrior {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PCAPrior")
.finish()
}
}
/// Constant methods for [crate::optflow::RLOFOpticalFlowParameter]
pub trait RLOFOpticalFlowParameterTraitConst {
fn as_raw_RLOFOpticalFlowParameter(&self) -> *const c_void;
#[inline]
fn solver_type(&self) -> crate::optflow::SolverType {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSolverType_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
#[inline]
fn support_region_type(&self) -> crate::optflow::SupportRegionType {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSupportRegionType_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
#[inline]
fn norm_sigma0(&self) -> f32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propNormSigma0_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn norm_sigma1(&self) -> f32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propNormSigma1_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn small_win_size(&self) -> i32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSmallWinSize_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn large_win_size(&self) -> i32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propLargeWinSize_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn cross_segmentation_threshold(&self) -> i32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propCrossSegmentationThreshold_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn max_level(&self) -> i32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMaxLevel_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn use_initial_flow(&self) -> bool {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseInitialFlow_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn use_illumination_model(&self) -> bool {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseIlluminationModel_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn use_global_motion_prior(&self) -> bool {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseGlobalMotionPrior_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn max_iteration(&self) -> i32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMaxIteration_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn min_eigen_value(&self) -> f32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMinEigenValue_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn global_motion_ransac_threshold(&self) -> f32 {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propGlobalMotionRansacThreshold_const(self.as_raw_RLOFOpticalFlowParameter()) };
ret
}
#[inline]
fn get_solver_type(&self) -> Result<crate::optflow::SolverType> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getSolverType_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_support_region_type(&self) -> Result<crate::optflow::SupportRegionType> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getSupportRegionType_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_norm_sigma0(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getNormSigma0_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_norm_sigma1(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getNormSigma1_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_small_win_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getSmallWinSize_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_large_win_size(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getLargeWinSize_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_cross_segmentation_threshold(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getCrossSegmentationThreshold_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_level(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getMaxLevel_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_use_initial_flow(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getUseInitialFlow_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_use_illumination_model(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getUseIlluminationModel_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_use_global_motion_prior(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getUseGlobalMotionPrior_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_max_iteration(&self) -> Result<i32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getMaxIteration_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_min_eigen_value(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getMinEigenValue_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_global_motion_ransac_threshold(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_getGlobalMotionRansacThreshold_const(self.as_raw_RLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::RLOFOpticalFlowParameter]
pub trait RLOFOpticalFlowParameterTrait: crate::optflow::RLOFOpticalFlowParameterTraitConst {
fn as_raw_mut_RLOFOpticalFlowParameter(&mut self) -> *mut c_void;
#[inline]
fn set_solver_type(&mut self, val: crate::optflow::SolverType) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSolverType_SolverType(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_support_region_type(&mut self, val: crate::optflow::SupportRegionType) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSupportRegionType_SupportRegionType(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_norm_sigma0(&mut self, val: f32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propNormSigma0_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_norm_sigma1(&mut self, val: f32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propNormSigma1_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_small_win_size(&mut self, val: i32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propSmallWinSize_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_large_win_size(&mut self, val: i32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propLargeWinSize_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_cross_segmentation_threshold(&mut self, val: i32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propCrossSegmentationThreshold_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_max_level(&mut self, val: i32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMaxLevel_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_use_initial_flow(&mut self, val: bool) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseInitialFlow_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_use_illumination_model(&mut self, val: bool) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseIlluminationModel_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_use_global_motion_prior(&mut self, val: bool) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propUseGlobalMotionPrior_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_max_iteration(&mut self, val: i32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMaxIteration_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_min_eigen_value(&mut self, val: f32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propMinEigenValue_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
#[inline]
fn set_global_motion_ransac_threshold(&mut self, val: f32) {
let ret = unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_propGlobalMotionRansacThreshold_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val) };
ret
}
/// Enable M-estimator or disable and use least-square estimator.
/// Enables M-estimator by setting sigma parameters to (3.2, 7.0). Disabling M-estimator can reduce
/// * runtime, while enabling can improve the accuracy.
/// ## Parameters
/// * val: If true M-estimator is used. If false least-square estimator is used.
/// * see also: setNormSigma0, setNormSigma1
#[inline]
fn set_use_m_estimator(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setUseMEstimator_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_solver_type_1(&mut self, val: crate::optflow::SolverType) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setSolverType_SolverType(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_support_region_type_1(&mut self, val: crate::optflow::SupportRegionType) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setSupportRegionType_SupportRegionType(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_norm_sigma0_1(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setNormSigma0_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_norm_sigma1_1(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setNormSigma1_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_small_win_size_1(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setSmallWinSize_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_large_win_size_1(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setLargeWinSize_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_cross_segmentation_threshold_1(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setCrossSegmentationThreshold_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_level_1(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setMaxLevel_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_use_initial_flow_1(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setUseInitialFlow_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_use_illumination_model_1(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setUseIlluminationModel_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_use_global_motion_prior_1(&mut self, val: bool) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setUseGlobalMotionPrior_bool(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_max_iteration_1(&mut self, val: i32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setMaxIteration_int(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_min_eigen_value_1(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setMinEigenValue_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn set_global_motion_ransac_threshold_1(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_setGlobalMotionRansacThreshold_float(self.as_raw_mut_RLOFOpticalFlowParameter(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// This is used store and set up the parameters of the robust local optical flow (RLOF) algoritm.
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
/// This RLOF implementation can be seen as an improved pyramidal iterative Lucas-Kanade and includes
/// a set of improving modules. The main improvements in respect to the pyramidal iterative Lucas-Kanade
/// are:
/// - A more robust redecending M-estimator framework (see [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012)) to improve the accuracy at
/// motion boundaries and appearing and disappearing pixels.
/// - an adaptive support region strategies to improve the accuracy at motion boundaries to reduce the
/// corona effect, i.e oversmoothing of the PLK at motion/object boundaries. The cross-based segementation
/// strategy (SR_CROSS) proposed in [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014) uses a simple segmenation approach to obtain the optimal
/// shape of the support region.
/// - To deal with illumination changes (outdoor sequences and shadow) the intensity constancy assumption
/// based optical flow equation has been adopt with the Gennert and Negahdaripour illumination model
/// (see [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016)). This model can be switched on/off with the useIlluminationModel variable.
/// - By using a global motion prior initialization (see [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016)) of the iterative refinement
/// the accuracy could be significantly improved for large displacements. This initialization can be
/// switched on and of with useGlobalMotionPrior variable.
///
/// The RLOF can be computed with the SparseOpticalFlow class or function interface to track a set of features
/// or with the DenseOpticalFlow class or function interface to compute dense optical flow.
/// ## See also
/// optflow::DenseRLOFOpticalFlow, optflow::calcOpticalFlowDenseRLOF(), optflow::SparseRLOFOpticalFlow, optflow::calcOpticalFlowSparseRLOF()
pub struct RLOFOpticalFlowParameter {
ptr: *mut c_void
}
opencv_type_boxed! { RLOFOpticalFlowParameter }
impl Drop for RLOFOpticalFlowParameter {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_delete(self.as_raw_mut_RLOFOpticalFlowParameter()) };
}
}
unsafe impl Send for RLOFOpticalFlowParameter {}
impl crate::optflow::RLOFOpticalFlowParameterTraitConst for RLOFOpticalFlowParameter {
#[inline] fn as_raw_RLOFOpticalFlowParameter(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::RLOFOpticalFlowParameterTrait for RLOFOpticalFlowParameter {
#[inline] fn as_raw_mut_RLOFOpticalFlowParameter(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl RLOFOpticalFlowParameter {
#[inline]
pub fn default() -> Result<crate::optflow::RLOFOpticalFlowParameter> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_RLOFOpticalFlowParameter(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::optflow::RLOFOpticalFlowParameter::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates instance of optflow::RLOFOpticalFlowParameter
#[inline]
pub fn create() -> Result<core::Ptr<crate::optflow::RLOFOpticalFlowParameter>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_RLOFOpticalFlowParameter_create(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::RLOFOpticalFlowParameter>::opencv_from_extern(ret) };
Ok(ret)
}
}
impl std::fmt::Debug for RLOFOpticalFlowParameter {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RLOFOpticalFlowParameter")
.field("solver_type", &crate::optflow::RLOFOpticalFlowParameterTraitConst::solver_type(self))
.field("support_region_type", &crate::optflow::RLOFOpticalFlowParameterTraitConst::support_region_type(self))
.field("norm_sigma0", &crate::optflow::RLOFOpticalFlowParameterTraitConst::norm_sigma0(self))
.field("norm_sigma1", &crate::optflow::RLOFOpticalFlowParameterTraitConst::norm_sigma1(self))
.field("small_win_size", &crate::optflow::RLOFOpticalFlowParameterTraitConst::small_win_size(self))
.field("large_win_size", &crate::optflow::RLOFOpticalFlowParameterTraitConst::large_win_size(self))
.field("cross_segmentation_threshold", &crate::optflow::RLOFOpticalFlowParameterTraitConst::cross_segmentation_threshold(self))
.field("max_level", &crate::optflow::RLOFOpticalFlowParameterTraitConst::max_level(self))
.field("use_initial_flow", &crate::optflow::RLOFOpticalFlowParameterTraitConst::use_initial_flow(self))
.field("use_illumination_model", &crate::optflow::RLOFOpticalFlowParameterTraitConst::use_illumination_model(self))
.field("use_global_motion_prior", &crate::optflow::RLOFOpticalFlowParameterTraitConst::use_global_motion_prior(self))
.field("max_iteration", &crate::optflow::RLOFOpticalFlowParameterTraitConst::max_iteration(self))
.field("min_eigen_value", &crate::optflow::RLOFOpticalFlowParameterTraitConst::min_eigen_value(self))
.field("global_motion_ransac_threshold", &crate::optflow::RLOFOpticalFlowParameterTraitConst::global_motion_ransac_threshold(self))
.finish()
}
}
/// Constant methods for [crate::optflow::SparseRLOFOpticalFlow]
pub trait SparseRLOFOpticalFlowTraitConst: crate::video::SparseOpticalFlowTraitConst {
fn as_raw_SparseRLOFOpticalFlow(&self) -> *const c_void;
/// @copydoc DenseRLOFOpticalFlow::setRLOFOpticalFlowParameter
/// ## See also
/// setRLOFOpticalFlowParameter
#[inline]
fn get_rlof_optical_flow_parameter(&self) -> Result<core::Ptr<crate::optflow::RLOFOpticalFlowParameter>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_getRLOFOpticalFlowParameter_const(self.as_raw_SparseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::RLOFOpticalFlowParameter>::opencv_from_extern(ret) };
Ok(ret)
}
/// Threshold for the forward backward confidence check
/// For each feature point a motion vector  is computed.
/// * If the forward backward error 
/// * is larger than threshold given by this function then the status will not be used by the following
/// * vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// * will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * setForwardBackward
/// ## See also
/// setForwardBackward
#[inline]
fn get_forward_backward(&self) -> Result<f32> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_getForwardBackward_const(self.as_raw_SparseRLOFOpticalFlow(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Mutable methods for [crate::optflow::SparseRLOFOpticalFlow]
pub trait SparseRLOFOpticalFlowTrait: crate::optflow::SparseRLOFOpticalFlowTraitConst + crate::video::SparseOpticalFlowTrait {
fn as_raw_mut_SparseRLOFOpticalFlow(&mut self) -> *mut c_void;
/// @copydoc DenseRLOFOpticalFlow::setRLOFOpticalFlowParameter
#[inline]
fn set_rlof_optical_flow_parameter(&mut self, mut val: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_setRLOFOpticalFlowParameter_PtrLRLOFOpticalFlowParameterG(self.as_raw_mut_SparseRLOFOpticalFlow(), val.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
/// Threshold for the forward backward confidence check
/// For each feature point a motion vector  is computed.
/// * If the forward backward error 
/// * is larger than threshold given by this function then the status will not be used by the following
/// * vector field interpolation.  denotes the backward flow. Note, the forward backward test
/// * will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
/// * see also: setForwardBackward
#[inline]
fn set_forward_backward(&mut self, val: f32) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_setForwardBackward_float(self.as_raw_mut_SparseRLOFOpticalFlow(), val, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
/// Class used for calculation sparse optical flow and feature tracking with robust local optical flow (RLOF) algorithms.
///
/// The RLOF is a fast local optical flow approach described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012) [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013) [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014)
/// and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016) similar to the pyramidal iterative Lucas-Kanade method as
/// proposed by [Bouguet00](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Bouguet00). More details and experiments can be found in the following thesis [Senst2019](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2019).
/// The implementation is derived from optflow::calcOpticalFlowPyrLK().
///
/// For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
/// Parameters have been described in [Senst2012](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2012), [Senst2013](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2013), [Senst2014](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2014) and [Senst2016](https://docs.opencv.org/4.8.1/d0/de3/citelist.html#CITEREF_Senst2016).
///
///
/// Note: SIMD parallelization is only available when compiling with SSE4.1.
/// ## See also
/// optflow::calcOpticalFlowSparseRLOF(), optflow::RLOFOpticalFlowParameter
pub struct SparseRLOFOpticalFlow {
ptr: *mut c_void
}
opencv_type_boxed! { SparseRLOFOpticalFlow }
impl Drop for SparseRLOFOpticalFlow {
#[inline]
fn drop(&mut self) {
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_delete(self.as_raw_mut_SparseRLOFOpticalFlow()) };
}
}
unsafe impl Send for SparseRLOFOpticalFlow {}
impl core::AlgorithmTraitConst for SparseRLOFOpticalFlow {
#[inline] fn as_raw_Algorithm(&self) -> *const c_void { self.as_raw() }
}
impl core::AlgorithmTrait for SparseRLOFOpticalFlow {
#[inline] fn as_raw_mut_Algorithm(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::video::SparseOpticalFlowTraitConst for SparseRLOFOpticalFlow {
#[inline] fn as_raw_SparseOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::video::SparseOpticalFlowTrait for SparseRLOFOpticalFlow {
#[inline] fn as_raw_mut_SparseOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl crate::optflow::SparseRLOFOpticalFlowTraitConst for SparseRLOFOpticalFlow {
#[inline] fn as_raw_SparseRLOFOpticalFlow(&self) -> *const c_void { self.as_raw() }
}
impl crate::optflow::SparseRLOFOpticalFlowTrait for SparseRLOFOpticalFlow {
#[inline] fn as_raw_mut_SparseRLOFOpticalFlow(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl SparseRLOFOpticalFlow {
/// Creates instance of SparseRLOFOpticalFlow
///
/// ## Parameters
/// * rlofParam: see setRLOFOpticalFlowParameter
/// * forwardBackwardThreshold: see setForwardBackward
///
/// ## C++ default parameters
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 1.f
#[inline]
pub fn create(mut rlof_param: core::Ptr<crate::optflow::RLOFOpticalFlowParameter>, forward_backward_threshold: f32) -> Result<core::Ptr<crate::optflow::SparseRLOFOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_create_PtrLRLOFOpticalFlowParameterG_float(rlof_param.as_raw_mut_PtrOfRLOFOpticalFlowParameter(), forward_backward_threshold, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::SparseRLOFOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
/// Creates instance of SparseRLOFOpticalFlow
///
/// ## Parameters
/// * rlofParam: see setRLOFOpticalFlowParameter
/// * forwardBackwardThreshold: see setForwardBackward
///
/// ## Note
/// This alternative version of [SparseRLOFOpticalFlow::create] function uses the following default values for its arguments:
/// * rlof_param: Ptr<RLOFOpticalFlowParameter>()
/// * forward_backward_threshold: 1.f
#[inline]
pub fn create_def() -> Result<core::Ptr<crate::optflow::SparseRLOFOpticalFlow>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_optflow_SparseRLOFOpticalFlow_create(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<crate::optflow::SparseRLOFOpticalFlow>::opencv_from_extern(ret) };
Ok(ret)
}
}
boxed_cast_base! { SparseRLOFOpticalFlow, core::Algorithm, cv_optflow_SparseRLOFOpticalFlow_to_Algorithm }
boxed_cast_base! { SparseRLOFOpticalFlow, crate::video::SparseOpticalFlow, cv_optflow_SparseRLOFOpticalFlow_to_SparseOpticalFlow }
impl std::fmt::Debug for SparseRLOFOpticalFlow {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SparseRLOFOpticalFlow")
.finish()
}
}
}