Compare commits
687 Commits
3.4.2
...
4.0.0-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
| 68942affdb | |||
| e0980c4d73 | |||
| c5920df159 | |||
| 86ddff0b88 | |||
| 908978d00b | |||
| a956732874 | |||
| 879e046b22 | |||
| 5fb0f34e8a | |||
| 861415133e | |||
| 87b1835cb6 | |||
| fce75cd858 | |||
| ec9c53eeff | |||
| b6d5565df1 | |||
| 15e9e3304c | |||
| 3961b214f0 | |||
| 53ad291ef1 | |||
| 145d3ba99d | |||
| 8ac7b21716 | |||
| e6171d17f8 | |||
| de54d45afd | |||
| 3cab9e7a9c | |||
| aa1c86f95e | |||
| 699565828d | |||
| b0ad7f759a | |||
| 38de2a8754 | |||
| 8b661cde15 | |||
| 70f38b4dfa | |||
| d389edd843 | |||
| 27a4e370f9 | |||
| b4fd3e8674 | |||
| 43f889ae1f | |||
| e628fd7bce | |||
| 7d75526373 | |||
| ecc9bd0925 | |||
| d259eb28bb | |||
| 76d4aa0c06 | |||
| 2113818f19 | |||
| 29bee6f07e | |||
| a7b3d2581f | |||
| 3512cb2226 | |||
| 96a50d5eb0 | |||
| 79db32bcd9 | |||
| 808ba552c5 | |||
| 14b438317e | |||
| 6d5f7b72c0 | |||
| cecb878915 | |||
| 29c10b6792 | |||
| 92ec971453 | |||
| 95502242c9 | |||
| 1f88a1af9c | |||
| 65e2961fee | |||
| c5687caf1a | |||
| 5d54def264 | |||
| dbfeb8892d | |||
| 949d7d7d25 | |||
| 451340fd3d | |||
| fdaeb20253 | |||
| 29770e13e8 | |||
| e51d7cb3d8 | |||
| d66f3efd36 | |||
| f512bf7004 | |||
| 63affb2be9 | |||
| 87b1100027 | |||
| a024593fa6 | |||
| 78c500e97a | |||
| a4f53988c4 | |||
| 347e09cd07 | |||
| 095b0d3272 | |||
| 87b5737293 | |||
| b7b82c1cef | |||
| cb5da8983f | |||
| 796795ac89 | |||
| 3e8934dec0 | |||
| 58ac3e09da | |||
| 09fa758725 | |||
| 57ae3ac7a2 | |||
| 6fc855865f | |||
| b80c978f5d | |||
| f4b9acb4db | |||
| acbfd85737 | |||
| 03b3be0f51 | |||
| 38f8fc6c82 | |||
| 7828854c9d | |||
| d7ac4495c3 | |||
| 492ef14550 | |||
| 10ae0c4364 | |||
| be2ccdbf0b | |||
| cb3ae1232b | |||
| e73e393c82 | |||
| 88b04c3cd4 | |||
| 1fb7ee0e16 | |||
| 8f78a1123b | |||
| d7885ed819 | |||
| b9fd5f8186 | |||
| 0c8590027f | |||
| 0a5bd0ac8b | |||
| 2f929376ec | |||
| b01f63835e | |||
| 6d7f5871db | |||
| 30a4e2f7ac | |||
| 8e0781648b | |||
| 89720ae24d | |||
| c331a214d0 | |||
| 9097ccf515 | |||
| dca657a2fd | |||
| c35c5a47df | |||
| 17cc21c9d6 | |||
| 5e241e7c36 | |||
| df8b057b44 | |||
| 64b3c1e691 | |||
| 15aee09c7f | |||
| 92517fa359 | |||
| 80610ca054 | |||
| 95dd4b3f27 | |||
| 87ed12b8f3 | |||
| fd0df5a89b | |||
| b487e2df0b | |||
| c6ed2bf9aa | |||
| 40b1dc12de | |||
| 53bbed89ae | |||
| 8eba3c1e7e | |||
| b50c70bbfa | |||
| 286c2c236b | |||
| af021e79d9 | |||
| 875de75327 | |||
| a39e0daacf | |||
| 73bfe68821 | |||
| f3fae0dae0 | |||
| 4a73b4859f | |||
| f90aea22b1 | |||
| bd98ed46bd | |||
| 8b48c2a10c | |||
| f1f15841d7 | |||
| f5d181db3a | |||
| 80b62a41c6 | |||
| 54279523a3 | |||
| 24e72e151a | |||
| 8a3c394d6a | |||
| ad146e5a6b | |||
| 66d15e89df | |||
| da7e1cfb49 | |||
| d486204a0d | |||
| 07c6b0a8df | |||
| 43b64140ae | |||
| 8e8315abfd | |||
| a18da0c55e | |||
| d621a99e73 | |||
| 107660c7ba | |||
| b33cb2e3f2 | |||
| e70526625f | |||
| 8a328e393d | |||
| 9fae8070dc | |||
| 6ec230480d | |||
| c441ad36c8 | |||
| 59cd636ad7 | |||
| 3f3d805663 | |||
| d74b98c3d9 | |||
| 351ee2e3a5 | |||
| 7f7f30a08b | |||
| e0bfe44cac | |||
| fda99c1c6c | |||
| 71c8de8fa1 | |||
| 27a6be8763 | |||
| acce95f446 | |||
| 10fb88d027 | |||
| a78e5344df | |||
| e5236cecd6 | |||
| 6aff916aa5 | |||
| 4f9db2c03a | |||
| 9988e1b6ee | |||
| afb81ba6e6 | |||
| 0f0a82b619 | |||
| 2cf34c0fe5 | |||
| f826709452 | |||
| f10fd64630 | |||
| 49a1328046 | |||
| 2877f17372 | |||
| 00cbb894ec | |||
| a0f86479e0 | |||
| f9a5c4d181 | |||
| d71812425a | |||
| aa5c45339c | |||
| 1e362ff5c3 | |||
| fc71316690 | |||
| cb7ee27cd9 | |||
| c7cf8fb35c | |||
| 8b0e1c7fcb | |||
| e3af72bb68 | |||
| ec3492a22a | |||
| 07808c8d5d | |||
| 436e330642 | |||
| a11d944f51 | |||
| c85e44697e | |||
| af883e88e1 | |||
| 3dddf703a9 | |||
| 09837928d9 | |||
| f7ccc74e09 | |||
| 546fcd990e | |||
| 5eb295adf3 | |||
| 20bf7b6a79 | |||
| dce4e94f02 | |||
| af769e4ec8 | |||
| ee6415bd1c | |||
| 70a27c7dd6 | |||
| 701760dbeb | |||
| 0f9f2696be | |||
| 65a0587ce8 | |||
| 78835ad87a | |||
| 4e6be21a44 | |||
| f89e4e7dd0 | |||
| dfa8467a08 | |||
| 669ee0415a | |||
| f9c8bb40b1 | |||
| 7d3a1657c9 | |||
| f36790d521 | |||
| 367668710c | |||
| 0f2b535fcc | |||
| e345cb03d5 | |||
| 94dea84915 | |||
| f33cbe94dd | |||
| 9f1218b00b | |||
| e13f6ded7f | |||
| 4b03a4a841 | |||
| bab4f4f5d8 | |||
| a08c6e49b3 | |||
| 50bceea038 | |||
| 9e42204e67 | |||
| c557193b8c | |||
| 3e6b3a6856 | |||
| d52cef1719 | |||
| fcfa488250 | |||
| 0d4fd20a73 | |||
| 2bbe31a8f6 | |||
| 7cdb0eafeb | |||
| 0515f930e8 | |||
| 32a02544de | |||
| 90f47eb952 | |||
| fc1dee685e | |||
| c894fc5bae | |||
| e1ee744e15 | |||
| e86287d8ae | |||
| 15e57d28f5 | |||
| 4c7d521413 | |||
| ade57c8bd0 | |||
| ea43e28a37 | |||
| 532eace7d6 | |||
| d4ac4fcde1 | |||
| 258a769567 | |||
| 7845f6d95c | |||
| be48cdc747 | |||
| 8ef2d19337 | |||
| cecf84410c | |||
| 596a0125ed | |||
| 8a8d07fb17 | |||
| 72f422c7dc | |||
| ca51bbb7ff | |||
| c1db75e0c7 | |||
| 4062ef5fcb | |||
| 1ae477a46d | |||
| 087e9308ec | |||
| d13db35f31 | |||
| b38c50b3d0 | |||
| dd06540e1f | |||
| 50b61668e2 | |||
| 1df84f7246 | |||
| bdc34984f1 | |||
| af0c930e77 | |||
| bb45bf9695 | |||
| 4e0d2a3e6c | |||
| da6d8961fc | |||
| 3e027df583 | |||
| acfdd0e1fc | |||
| 9fb8f6347f | |||
| 7f73b105ca | |||
| ae8dcdf40d | |||
| ee1e1ce377 | |||
| bed388bafb | |||
| 6d165dae5e | |||
| 6477262e63 | |||
| f79599f949 | |||
| c94d75874b | |||
| 21f3987d53 | |||
| 335e61dc47 | |||
| 64380baa85 | |||
| b5eb65e53e | |||
| f1ca05c822 | |||
| 900df21b7d | |||
| 93bad514a8 | |||
| d10a219833 | |||
| bd7bf39b4b | |||
| 472b71ecef | |||
| 4f360f8b1a | |||
| e8d45a9cdd | |||
| d8cd1d8fcc | |||
| ff2eface19 | |||
| 29ce348c4d | |||
| b2a4069f55 | |||
| 4d78342919 | |||
| 1272332ae3 | |||
| b47c9ac643 | |||
| 1c20a7f008 | |||
| 6356403964 | |||
| 6700fdb81f | |||
| 096366738b | |||
| 6a6506b02d | |||
| 59ccf2c9e0 | |||
| 2c42361ecd | |||
| e8a14a775e | |||
| 7b90a1e85a | |||
| 18833d5121 | |||
| 49283ec035 | |||
| f25450791b | |||
| c9faa09d55 | |||
| 1deeca985f | |||
| 6acabd1fd8 | |||
| 5ac9a2a7d0 | |||
| 808c89adc1 | |||
| a527e8cc73 | |||
| 10c570b558 | |||
| 76f47548b3 | |||
| 7d4bb9428b | |||
| 67d46dfc6c | |||
| 3c03fb56e0 | |||
| 378cf2ab63 | |||
| c6f5b013ec | |||
| e593d5bbc5 | |||
| 3f5c3ddd27 | |||
| ab8ba047a5 | |||
| cecc19381f | |||
| 6e84abc746 | |||
| 322c6b1ba4 | |||
| 76eb389761 | |||
| e9a1ccb89a | |||
| 73d44c7881 | |||
| 31fef14d76 | |||
| 7ee69740e8 | |||
| c61bc3a0cb | |||
| db262fa76a | |||
| b24fc6954d | |||
| 828cb4286d | |||
| ee5e0e16d9 | |||
| b907bfe3e7 | |||
| f84eb3dde6 | |||
| b996b618e0 | |||
| 98c5ce9347 | |||
| f89defad5d | |||
| 96f92c6705 | |||
| f0c46a4c74 | |||
| 4e59d6fd12 | |||
| e136c11c7c | |||
| 0e80f56e44 | |||
| 9752d45c87 | |||
| 860ae77ec9 | |||
| 1567a65475 | |||
| d2e08a524e | |||
| 94758c18de | |||
| eff0f9d3f8 | |||
| c1df9ad456 | |||
| 8b197c58e6 | |||
| 781721ca50 | |||
| 603eadfe51 | |||
| b9b66ca437 | |||
| 22cb65ada9 | |||
| e76b375a31 | |||
| 90b8a03a89 | |||
| f056c0f137 | |||
| 9f5f64e14e | |||
| 49e0126b8e | |||
| a24a829490 | |||
| 615883977f | |||
| 216cd7dc61 | |||
| 4910f16f16 | |||
| f2d363feb2 | |||
| 8b2122e12f | |||
| f16f818f5f | |||
| 5b3ac112fe | |||
| a0cff0be94 | |||
| 509de3fa2c | |||
| b00758babe | |||
| 4eb2966559 | |||
| 9f2edc1135 | |||
| a56b221559 | |||
| fb2b26c419 | |||
| 377e51df83 | |||
| 7453a6938a | |||
| 39f5e57321 | |||
| f49f6d52b4 | |||
| 715f23127c | |||
| f0f652f9e9 | |||
| 731aa963bd | |||
| 7e353a1ec5 | |||
| 293facbae7 | |||
| 4fe900c399 | |||
| 5c3880d302 | |||
| 9eaa583bfb | |||
| 6500700d6f | |||
| f95a411ba3 | |||
| 7c8ab271fc | |||
| 70b893333d | |||
| 449696f1e5 | |||
| e0c93bcf6c | |||
| 23022f3ffb | |||
| ac4a6aad15 | |||
| 7d7767ba42 | |||
| 183cfd3a2e | |||
| 9cb3e9abf0 | |||
| 053259fd92 | |||
| b4cea8d6d1 | |||
| 8f57fc93ec | |||
| 9ff4475695 | |||
| 1c73e66edf | |||
| 061149cbbd | |||
| a2daf0c83c | |||
| 2dbb5871e0 | |||
| be08730cd6 | |||
| 3082ea82f9 | |||
| 5131619a1a | |||
| b056ce33aa | |||
| df9efbbd1f | |||
| f2e1710dd5 | |||
| 05830874d7 | |||
| 4fb086d6c3 | |||
| 3ea2586a5a | |||
| 2df0345985 | |||
| da41ac9e60 | |||
| 47e3e89e30 | |||
| 3f302cabb8 | |||
| 8e034053af | |||
| 82c477c9f7 | |||
| 67f79aabdd | |||
| 5aceee5a36 | |||
| 1e1a1855ae | |||
| 2003eb1b9b | |||
| 17196bb4fa | |||
| 7e71b1079e | |||
| 814ebe39ae | |||
| 61c870ae09 | |||
| 6949bc9ef9 | |||
| 7cf52de47e | |||
| 9433784e47 | |||
| ed0e79cb61 | |||
| bb82cdc928 | |||
| db8585701d | |||
| 57bead3a5e | |||
| 28d0e97c09 | |||
| 5d12c070ea | |||
| 5bde800ee3 | |||
| 29a1dc5719 | |||
| dbf3362c4d | |||
| c4e0f4b2b5 | |||
| e90e398e7a | |||
| 4937eeddb5 | |||
| 2988260107 | |||
| 83039c8752 | |||
| 6499263b41 | |||
| 80cab4a163 | |||
| 47202b3349 | |||
| 9076bb6089 | |||
| 89528d7c3a | |||
| 0bef42ba12 | |||
| b41bc0ae59 | |||
| fb1f12021b | |||
| dd8e990451 | |||
| e031bada7d | |||
| 2b7ff90e63 | |||
| b597c87bed | |||
| 0aded5aae6 | |||
| a8e9a3a88d | |||
| d044ac1c66 | |||
| 2f0fc920dd | |||
| 9137e2d635 | |||
| c37d1a53b5 | |||
| 1165fdd0f5 | |||
| 597db69151 | |||
| 9eb79926df | |||
| fa466b022d | |||
| 43820d89b4 | |||
| faa6c4e1e1 | |||
| dd8701c1a0 | |||
| 74cf48b5d7 | |||
| 45b5b3c13a | |||
| 9787ab598b | |||
| 5336b9ad19 | |||
| a16254de2b | |||
| 8a2ce75d96 | |||
| 9c7040802c | |||
| cbb1e867e5 | |||
| 8de08e0463 | |||
| 236f383969 | |||
| 93abdbf25e | |||
| 8f80565d9c | |||
| 391b9586ac | |||
| 4283309daa | |||
| 6e767e2376 | |||
| 0c4d5ffecd | |||
| 28e08ae0bd | |||
| e0603bb45f | |||
| 7d40fcead5 | |||
| 8c7555523b | |||
| b117302bca | |||
| e1205d046a | |||
| dadde75ef0 | |||
| ee743afebe | |||
| 767b31cfbf | |||
| 18abe54497 | |||
| 05f0cb16de | |||
| a4060e15a4 | |||
| 7198b9e461 | |||
| ab9b6e806c | |||
| 270cc3bcbc | |||
| c213a3823e | |||
| 51074b9743 | |||
| 070393dfda | |||
| f4df537e27 | |||
| 905da2994a | |||
| 7e9b5d9e30 | |||
| e526c4bfe4 | |||
| fe806878be | |||
| a2a9a01e05 | |||
| 3d141280aa | |||
| 9df7517dea | |||
| 4560909a5e | |||
| 6c4f618db5 | |||
| f3ee07ca11 | |||
| 7cc84ce8ab | |||
| 40b8ca2eed | |||
| 4dcef28023 | |||
| 0a41b3df45 | |||
| f086fc5b18 | |||
| c473718bc2 | |||
| 1da46fe6fb | |||
| 5b72e83687 | |||
| 78d07e841d | |||
| f38808a39f | |||
| 3f65924c45 | |||
| 540415dc5e | |||
| f0cadaa6e3 | |||
| f058b5fb1e | |||
| 481829a81b | |||
| c9439476da | |||
| 60994389a6 | |||
| b0ee5d9023 | |||
| 84f2f37680 | |||
| d5951bc033 | |||
| a5e8ae2183 | |||
| 1dec480974 | |||
| d6c669f5cf | |||
| 014ae55379 | |||
| 53eb27f508 | |||
| 4a3dfffd46 | |||
| 50751ae6ff | |||
| 10676f86d5 | |||
| 5e31c82b5b | |||
| 4382bdc859 | |||
| dee5f9a67b | |||
| 2b6aa50b81 | |||
| 3c74fde349 | |||
| 6eb8faea85 | |||
| 23fc96e98f | |||
| abceae1ac0 | |||
| eed1130327 | |||
| 41b95cae38 | |||
| de6f0a537d | |||
| 4dc7e617a4 | |||
| 0155851929 | |||
| 71c6cb9c22 | |||
| 2170811e48 | |||
| 9d8495f8b3 | |||
| 5385086fef | |||
| dcc1beb1f8 | |||
| e38ea3a888 | |||
| 33b7028be2 | |||
| 850a8577b2 | |||
| e79c729b20 | |||
| 625d20b9b4 | |||
| 1c75f3d037 | |||
| 9c3ec05825 | |||
| 875f23881f | |||
| d0a3686812 | |||
| c9fe6f1afe | |||
| 2508f7f971 | |||
| 8b5f061dae | |||
| 999aba3807 | |||
| fa66c6b797 | |||
| 82c7ab0231 | |||
| 4c5a86828a | |||
| a7b502f04a | |||
| e4b5e9b9c9 | |||
| e9bb26267e | |||
| d7bd662c95 | |||
| 452fa3011c | |||
| d57e5406f0 | |||
| 2da96be217 | |||
| 7fe0727930 | |||
| 529d38613b | |||
| 88d56dc700 | |||
| 7ba66a1682 | |||
| b6255ab9e7 | |||
| 924ff903ad | |||
| e2b5d11290 | |||
| e41f19d2f3 | |||
| 52b151dceb | |||
| 362d4f5395 | |||
| a29d11240e | |||
| 61d8719b8d | |||
| 0fd74fa177 | |||
| 45677819e8 | |||
| e14b2ba43c | |||
| 43f821afb9 | |||
| 81325a3fa0 | |||
| aa0c6ddb4c | |||
| 5e6a3f1f6c | |||
| 523b6f32ba | |||
| fc59498b2b | |||
| 3b01777c98 | |||
| aa10cdbfa2 | |||
| 06fc77610b | |||
| 019c2f2115 | |||
| 4bc080dc50 | |||
| c7fc563dc0 | |||
| 0bb2c115aa | |||
| ccd2370bb7 | |||
| c0d0cf5e74 | |||
| b09a4a98d4 | |||
| 135ea264ef | |||
| f25a01bb5a | |||
| 6309e28dd0 | |||
| bd8c8e720e | |||
| 36288eebe7 | |||
| 3165baa1f1 | |||
| 9a8a964b69 | |||
| 17888ce0fd | |||
| 051b40f956 | |||
| cc8db99695 | |||
| b39cd06249 | |||
| 46def2fdc1 | |||
| 2195f0cc62 | |||
| 387e92353c | |||
| 2047abd9c3 | |||
| 64f2b1b250 | |||
| 577546ccd9 | |||
| e858c21e1f | |||
| 0d6518aaa0 | |||
| 49886ebae3 | |||
| d1a598c652 | |||
| bfc227b8d4 | |||
| 45dd575ed2 | |||
| 80709697e5 | |||
| 1b53a4fccc | |||
| 4bb220bb90 | |||
| e1b3cf5c14 | |||
| 0f298a4203 | |||
| 5e68f35500 | |||
| ba1bd64bf9 | |||
| db88cd1b25 | |||
| 936d2963a2 | |||
| 4378b4d03d | |||
| 6ddef3b7a9 | |||
| 68c92908d5 | |||
| 51e543050c | |||
| 000a13b6a3 | |||
| 84b3b5b4a4 | |||
| 4e83f4c579 | |||
| cd2b188c9a | |||
| 1e0a60be2a | |||
| fc5bba66af | |||
| 4d7d630e92 | |||
| 4b2d1aaeea | |||
| 7e5581cd86 | |||
| 8b6a6d4546 | |||
| 7ae83df8aa | |||
| 779a42678d | |||
| 10ba6a93a6 | |||
| c917be2189 | |||
| c6aa97c9aa | |||
| 250941bd47 | |||
| 5b17a60dde | |||
| b07f772f36 | |||
| d4688e6474 | |||
| e7e29cb63c | |||
| ca922443db | |||
| 2385a5870e | |||
| e567135ed3 | |||
| 98c8584b88 | |||
| 2b2fa58f97 | |||
| 2d54fed3cc | |||
| 964a4d75b4 |
@@ -2,6 +2,14 @@
|
||||
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
|
||||
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
|
||||
|
||||
Please:
|
||||
|
||||
* Read the documentation to test with the latest developer build.
|
||||
* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
|
||||
* Try to be as detailed as possible in your report.
|
||||
* Report only one problem per created issue.
|
||||
|
||||
|
||||
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
|
||||
-->
|
||||
|
||||
@@ -27,4 +35,4 @@ This is a template helping you to create an issue which can be processed as quic
|
||||
// C++ code example
|
||||
```
|
||||
or attach as .txt or .zip file
|
||||
-->
|
||||
-->
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Binaries branch name: ffmpeg/3.4_20180608
|
||||
# Binaries were created for OpenCV: f5ddbbf65937d8f44e481e4ee1082961821f5c62
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "8041bd6f5ad37045c258904ba3030bb3442e3911")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "fa5a2a4e2f37defcb95bde8ed145c2b3")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "2cc08fc4fef8199fe80e0f126684834f")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c")
|
||||
# Binaries branch name: ffmpeg/master_20180918
|
||||
# Binaries were created for OpenCV: e628fd7bce2b5d64c36b5bdc55a37c0ae78bc907
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "c88df798e9dc3d63840f913714563a730245464a")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "48c95ce37d5aa6b15b3ad116e331ebc1")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "d33eca57ae1cfd6287b975b98125f7a3")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "5fd49e1b84e9f402ca155e27c92d2ce9")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
||||
@@ -335,7 +335,7 @@ ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
|
||||
#ifdef SDL_STRNCPY_S
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
|
||||
#else
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l)
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, b)
|
||||
#endif /* SDL_STRNCPY_S */
|
||||
|
||||
#define __itt_fstrdup(s) strdup(s)
|
||||
|
||||
@@ -47,6 +47,10 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -W
|
||||
-Wsuggest-override -Winconsistent-missing-override
|
||||
-Wimplicit-fallthrough
|
||||
)
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
||||
|
||||
@@ -431,7 +431,7 @@ int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah,
|
||||
return CV_HAL_ERROR_OK;
|
||||
}
|
||||
|
||||
int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4])
|
||||
int ovx_hal_warpPerspective(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4])
|
||||
{
|
||||
if (skipSmallImages<VX_KERNEL_WARP_PERSPECTIVE>(aw, ah))
|
||||
return CV_HAL_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -27,7 +27,7 @@ int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t
|
||||
int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int cn);
|
||||
int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, double inv_scale_x, double inv_scale_y, int interpolation);
|
||||
int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[6], int interpolation, int borderType, const double borderValue[4]);
|
||||
int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]);
|
||||
int ovx_hal_warpPerspective(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]);
|
||||
|
||||
struct cvhalFilter2D;
|
||||
int ovx_hal_filterInit(cvhalFilter2D **filter_context, uchar *kernel_data, size_t kernel_step, int kernel_type, int kernel_width, int kernel_height,
|
||||
@@ -97,7 +97,7 @@ int ovx_hal_integral(int depth, int sdepth, int, const uchar * a, size_t astep,
|
||||
//#undef cv_hal_warpAffine
|
||||
//#define cv_hal_warpAffine ovx_hal_warpAffine
|
||||
//#undef cv_hal_warpPerspective
|
||||
//#define cv_hal_warpPerspective ovx_hal_warpPerspectve
|
||||
//#define cv_hal_warpPerspective ovx_hal_warpPerspective
|
||||
|
||||
#undef cv_hal_filterInit
|
||||
#define cv_hal_filterInit ovx_hal_filterInit
|
||||
|
||||
@@ -29,6 +29,9 @@ if(CV_ICC)
|
||||
-wd265 -wd858 -wd873 -wd2196
|
||||
)
|
||||
endif()
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
|
||||
endif()
|
||||
|
||||
# Easier to support different versions of protobufs
|
||||
function(append_if_exist OUTPUT_LIST)
|
||||
|
||||
@@ -149,7 +149,6 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect compiler and target platform architecture
|
||||
# ----------------------------------------------------------------------------
|
||||
OCV_OPTION(ENABLE_CXX11 "Enable C++11 compilation mode" "${OPENCV_CXX11}")
|
||||
include(cmake/OpenCVDetectCXXCompiler.cmake)
|
||||
ocv_cmake_hook(POST_DETECT_COMPILER)
|
||||
|
||||
@@ -253,8 +252,8 @@ OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON
|
||||
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF)
|
||||
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
|
||||
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32 OR MINGW) )
|
||||
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
@@ -271,18 +270,19 @@ OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_MATLAB "Include Matlab support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT))
|
||||
OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF IF (NOT WITH_INTELPERC) )
|
||||
OCV_OPTION(WITH_VA "Include VA support" OFF IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF IF ((UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)) )
|
||||
OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" OFF IF (UNIX AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_LAPACK "Include Lapack library support" (NOT CV_DISABLE_OPTIMIZATION) IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_ITT "Include Intel ITT support" ON IF (NOT APPLE_FRAMEWORK) )
|
||||
OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON )
|
||||
OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON)
|
||||
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
@@ -373,8 +373,6 @@ endif()
|
||||
|
||||
if(ANDROID OR WIN32)
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH doc)
|
||||
else()
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
||||
@@ -414,8 +412,6 @@ if(ANDROID)
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata")
|
||||
elseif(WIN32)
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "testdata")
|
||||
else()
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "share/OpenCV/testdata")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -428,6 +424,7 @@ if(ANDROID)
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH sdk/etc)
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
|
||||
else()
|
||||
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
|
||||
ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
|
||||
@@ -443,42 +440,40 @@ else()
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH java)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH etc)
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
|
||||
else()
|
||||
# Note: layout differs from OpenCV 3.4
|
||||
include(GNUInstallDirs)
|
||||
ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
|
||||
ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH share/OpenCV)
|
||||
|
||||
if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH)
|
||||
math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX)
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv)
|
||||
else()
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV)
|
||||
endif()
|
||||
endif()
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/opencv4")
|
||||
ocv_update(OPENCV_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}")
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/cmake/opencv4")
|
||||
ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/opencv4/3rdparty")
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/samples")
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/doc/opencv4")
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/java/opencv4")
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/testdata")
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4")
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/licenses/opencv4")
|
||||
endif()
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
|
||||
endif()
|
||||
|
||||
ocv_update(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION})
|
||||
foreach(v
|
||||
OPENCV_INCLUDE_INSTALL_PATH
|
||||
# file names include version (.so/.dll): OPENCV_LIB_INSTALL_PATH
|
||||
OPENCV_CONFIG_INSTALL_PATH
|
||||
OPENCV_3P_LIB_INSTALL_PATH
|
||||
OPENCV_SAMPLES_SRC_INSTALL_PATH
|
||||
OPENCV_CONFIG_INSTALL_PATH
|
||||
OPENCV_DOC_INSTALL_PATH
|
||||
OPENCV_JAR_INSTALL_PATH
|
||||
# JAR file name includes version: OPENCV_JAR_INSTALL_PATH
|
||||
OPENCV_TEST_DATA_INSTALL_PATH
|
||||
OPENCV_OTHER_INSTALL_PATH
|
||||
)
|
||||
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
string(REPLACE "opencv" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
string(REGEX REPLACE "opencv[0-9]*" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -693,11 +688,6 @@ if(WITH_DIRECTX)
|
||||
include(cmake/OpenCVDetectDirectX.cmake)
|
||||
endif()
|
||||
|
||||
# --- Matlab/Octave ---
|
||||
if(WITH_MATLAB)
|
||||
include(cmake/OpenCVFindMatlab.cmake)
|
||||
endif()
|
||||
|
||||
if(WITH_VTK)
|
||||
include(cmake/OpenCVDetectVTK.cmake)
|
||||
endif()
|
||||
@@ -1015,9 +1005,6 @@ string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
|
||||
status("")
|
||||
status(" C/C++:")
|
||||
status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
|
||||
if(ENABLE_CXX11 OR HAVE_CXX11)
|
||||
status(" C++11:" HAVE_CXX11 THEN YES ELSE NO)
|
||||
endif()
|
||||
status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
|
||||
status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
@@ -1231,6 +1218,10 @@ if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
|
||||
status(" PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
|
||||
endif()
|
||||
|
||||
if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
|
||||
status(" PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
|
||||
endif()
|
||||
|
||||
# ========================== VIDEO IO ==========================
|
||||
status("")
|
||||
status(" Video I/O:")
|
||||
@@ -1352,7 +1343,7 @@ endif()
|
||||
# Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
|
||||
ocv_build_features_string(parallel_status EXCLUSIVE
|
||||
IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
|
||||
IF HAVE_CSTRIPES THEN "C="
|
||||
IF HAVE_HPX THEN "HPX"
|
||||
IF HAVE_OPENMP THEN "OpenMP"
|
||||
IF HAVE_GCD THEN "GCD"
|
||||
IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"
|
||||
@@ -1396,7 +1387,7 @@ if(WITH_VA OR HAVE_VA)
|
||||
endif()
|
||||
|
||||
if(WITH_VA_INTEL OR HAVE_VA_INTEL)
|
||||
status(" Intel VA-API/OpenCL:" HAVE_VA_INTEL THEN "YES (MSDK: ${VA_INTEL_MSDK_ROOT} OpenCL: ${VA_INTEL_IOCL_ROOT})" ELSE NO)
|
||||
status(" Intel VA-API/OpenCL:" HAVE_VA_INTEL THEN "YES (OpenCL: ${VA_INTEL_IOCL_ROOT})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_LAPACK OR HAVE_LAPACK)
|
||||
@@ -1407,8 +1398,22 @@ if(WITH_HALIDE OR HAVE_HALIDE)
|
||||
status(" Halide:" HAVE_HALIDE THEN "YES (${HALIDE_LIBRARIES} ${HALIDE_INCLUDE_DIRS})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_INF_ENGINE OR HAVE_INF_ENGINE)
|
||||
status(" Inference Engine:" HAVE_INF_ENGINE THEN "YES (${INF_ENGINE_LIBRARIES} ${INF_ENGINE_INCLUDE_DIRS})" ELSE NO)
|
||||
if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
|
||||
if(INF_ENGINE_TARGET)
|
||||
set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
|
||||
get_target_property(_lib ${INF_ENGINE_TARGET} IMPORTED_LOCATION)
|
||||
if(NOT _lib)
|
||||
get_target_property(_lib_rel ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_lib_dbg ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_DEBUG)
|
||||
set(_lib "${_lib_rel} / ${_lib_dbg}")
|
||||
endif()
|
||||
get_target_property(_inc ${INF_ENGINE_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
status(" Inference Engine:" "${__msg}")
|
||||
status(" libs:" "${_lib}")
|
||||
status(" includes:" "${_inc}")
|
||||
else()
|
||||
status(" Inference Engine:" "NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_EIGEN OR HAVE_EIGEN)
|
||||
@@ -1502,15 +1507,7 @@ if(BUILD_JAVA OR BUILD_opencv_java)
|
||||
status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
# ========================= matlab =========================
|
||||
if(WITH_MATLAB OR MATLAB_FOUND)
|
||||
status("")
|
||||
status(" Matlab:" MATLAB_FOUND THEN "YES" ELSE "NO")
|
||||
if(MATLAB_FOUND)
|
||||
status(" mex:" MATLAB_MEX_SCRIPT THEN "${MATLAB_MEX_SCRIPT}" ELSE NO)
|
||||
status(" Compiler/generator:" MEX_WORKS THEN "Working" ELSE "Not working (bindings will not be generated)")
|
||||
endif()
|
||||
endif()
|
||||
ocv_cmake_hook(STATUS_DUMP_EXTRA)
|
||||
|
||||
# ========================== auxiliary ==========================
|
||||
status("")
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
### Resources
|
||||
|
||||
* Homepage: <http://opencv.org>
|
||||
* Docs: <http://docs.opencv.org/master/>
|
||||
* Homepage: <https://opencv.org>
|
||||
* Docs: <https://docs.opencv.org/master/>
|
||||
* Q&A forum: <http://answers.opencv.org>
|
||||
* Issue tracking: <https://github.com/opencv/opencv/issues>
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/calib3d.hpp"
|
||||
|
||||
#if defined __GNUC__ && __GNUC__ >= 8
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#endif
|
||||
|
||||
using namespace cv;
|
||||
|
||||
#ifndef PATH_MAX
|
||||
@@ -1040,12 +1044,10 @@ void cvCreateTrainingSamples( const char* filename,
|
||||
output = fopen( filename, "wb" );
|
||||
if( output != NULL )
|
||||
{
|
||||
int hasbg;
|
||||
int i;
|
||||
int inverse;
|
||||
|
||||
hasbg = 0;
|
||||
hasbg = (bgfilename != NULL && icvInitBackgroundReaders( bgfilename,
|
||||
const int hasbg = (bgfilename != NULL && icvInitBackgroundReaders( bgfilename,
|
||||
Size( winwidth,winheight ) ) );
|
||||
|
||||
Mat sample( winheight, winwidth, CV_8UC1 );
|
||||
@@ -1372,7 +1374,7 @@ int icvGetTraininDataFromVec( Mat& img, CvVecFile& userdata )
|
||||
|
||||
size_t elements_read = fread( &tmp, sizeof( tmp ), 1, userdata.input );
|
||||
CV_Assert(elements_read == 1);
|
||||
elements_read = fread( vector, sizeof( short ), userdata.vecsize, userdata.input );
|
||||
elements_read = fread(vector.data(), sizeof(short), userdata.vecsize, userdata.input);
|
||||
CV_Assert(elements_read == (size_t)userdata.vecsize);
|
||||
|
||||
if( feof( userdata.input ) || userdata.last++ >= userdata.count )
|
||||
|
||||
@@ -224,8 +224,10 @@ void calib::calibDataController::filterFrames()
|
||||
cv::Mat newErrorsVec = cv::Mat((int)numberOfFrames - 1, 1, CV_64F);
|
||||
std::copy(mCalibData->perViewErrors.ptr<double>(0),
|
||||
mCalibData->perViewErrors.ptr<double>((int)worstElemIndex), newErrorsVec.ptr<double>(0));
|
||||
std::copy(mCalibData->perViewErrors.ptr<double>((int)worstElemIndex + 1), mCalibData->perViewErrors.ptr<double>((int)numberOfFrames),
|
||||
if((int)worstElemIndex < (int)numberOfFrames-1) {
|
||||
std::copy(mCalibData->perViewErrors.ptr<double>((int)worstElemIndex + 1), mCalibData->perViewErrors.ptr<double>((int)numberOfFrames),
|
||||
newErrorsVec.ptr<double>((int)worstElemIndex));
|
||||
}
|
||||
mCalibData->perViewErrors = newErrorsVec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ bool CalibProcessor::detectAndParseChAruco(const cv::Mat &frame)
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void)frame;
|
||||
CV_UNUSED(frame);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ void calib::Euler(const cv::Mat& src, cv::Mat& dst, int argType)
|
||||
{
|
||||
if((src.rows == 3) && (src.cols == 3))
|
||||
{
|
||||
//convert rotaion matrix to 3 angles (pitch, yaw, roll)
|
||||
//convert rotation matrix to 3 angles (pitch, yaw, roll)
|
||||
dst = cv::Mat(3, 1, CV_64F);
|
||||
double pitch, yaw, roll;
|
||||
|
||||
@@ -55,7 +55,7 @@ void calib::Euler(const cv::Mat& src, cv::Mat& dst, int argType)
|
||||
else if( (src.cols == 1 && src.rows == 3) ||
|
||||
(src.cols == 3 && src.rows == 1 ) )
|
||||
{
|
||||
//convert vector which contains 3 angles (pitch, yaw, roll) to rotaion matrix
|
||||
//convert vector which contains 3 angles (pitch, yaw, roll) to rotation matrix
|
||||
double pitch, yaw, roll;
|
||||
if(src.cols == 1 && src.rows == 3)
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ void CvHOGEvaluator::integralHistogram(const Mat &img, vector<Mat> &histogram, M
|
||||
Mat qangle(gradSize, CV_8U);
|
||||
|
||||
AutoBuffer<int> mapbuf(gradSize.width + gradSize.height + 4);
|
||||
int* xmap = (int*)mapbuf + 1;
|
||||
int* xmap = mapbuf.data() + 1;
|
||||
int* ymap = xmap + gradSize.width + 2;
|
||||
|
||||
const int borderType = (int)BORDER_REPLICATE;
|
||||
@@ -177,7 +177,7 @@ void CvHOGEvaluator::integralHistogram(const Mat &img, vector<Mat> &histogram, M
|
||||
|
||||
int width = gradSize.width;
|
||||
AutoBuffer<float> _dbuf(width*4);
|
||||
float* dbuf = _dbuf;
|
||||
float* dbuf = _dbuf.data();
|
||||
Mat Dx(1, width, CV_32F, dbuf);
|
||||
Mat Dy(1, width, CV_32F, dbuf + width);
|
||||
Mat Mag(1, width, CV_32F, dbuf + width*2);
|
||||
|
||||
@@ -30,7 +30,6 @@ using cv::ParallelLoopBody;
|
||||
#include "boost.h"
|
||||
#include "cascadeclassifier.h"
|
||||
#include <queue>
|
||||
#include "cxmisc.h"
|
||||
|
||||
#include "cvconfig.h"
|
||||
|
||||
@@ -383,7 +382,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
int ci = get_var_type(vi);
|
||||
CV_Assert( ci < 0 );
|
||||
|
||||
int *src_idx_buf = (int*)(uchar*)inn_buf;
|
||||
int *src_idx_buf = (int*)inn_buf.data();
|
||||
float *src_val_buf = (float*)(src_idx_buf + sample_count);
|
||||
int* sample_indices_buf = (int*)(src_val_buf + sample_count);
|
||||
const int* src_idx = 0;
|
||||
@@ -423,7 +422,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
}
|
||||
|
||||
// subsample cv_lables
|
||||
const int* src_lbls = get_cv_labels(data_root, (int*)(uchar*)inn_buf);
|
||||
const int* src_lbls = get_cv_labels(data_root, (int*)inn_buf.data());
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* udst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
@@ -440,7 +439,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
}
|
||||
|
||||
// subsample sample_indices
|
||||
const int* sample_idx_src = get_sample_indices(data_root, (int*)(uchar*)inn_buf);
|
||||
const int* sample_idx_src = get_sample_indices(data_root, (int*)inn_buf.data());
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
@@ -543,7 +542,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
|
||||
featureEvaluator = _featureEvaluator;
|
||||
|
||||
max_c_count = MAX( 2, featureEvaluator->getMaxCatCount() );
|
||||
_resp = featureEvaluator->getCls();
|
||||
_resp = cvMat(featureEvaluator->getCls());
|
||||
responses = &_resp;
|
||||
// TODO: check responses: elements must be 0 or 1
|
||||
|
||||
@@ -815,7 +814,7 @@ struct FeatureIdxOnlyPrecalc : ParallelLoopBody
|
||||
void operator()( const Range& range ) const
|
||||
{
|
||||
cv::AutoBuffer<float> valCache(sample_count);
|
||||
float* valCachePtr = (float*)valCache;
|
||||
float* valCachePtr = valCache.data();
|
||||
for ( int fi = range.start; fi < range.end; fi++)
|
||||
{
|
||||
for( int si = 0; si < sample_count; si++ )
|
||||
@@ -1084,7 +1083,7 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
|
||||
CvMat* buf = data->buf;
|
||||
size_t length_buf_row = data->get_length_subbuf();
|
||||
cv::AutoBuffer<uchar> inn_buf(n*(3*sizeof(int)+sizeof(float)));
|
||||
int* tempBuf = (int*)(uchar*)inn_buf;
|
||||
int* tempBuf = (int*)inn_buf.data();
|
||||
bool splitInputData;
|
||||
|
||||
complete_node_dir(node);
|
||||
@@ -1398,7 +1397,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
|
||||
int inn_buf_size = ((params.boost_type == LOGIT) || (params.boost_type == GENTLE) ? n*sizeof(int) : 0) +
|
||||
( !tree ? n*sizeof(int) : 0 );
|
||||
cv::AutoBuffer<uchar> inn_buf(inn_buf_size);
|
||||
uchar* cur_inn_buf_pos = (uchar*)inn_buf;
|
||||
uchar* cur_inn_buf_pos = inn_buf.data();
|
||||
if ( (params.boost_type == LOGIT) || (params.boost_type == GENTLE) )
|
||||
{
|
||||
step = CV_IS_MAT_CONT(data->responses_copy->type) ?
|
||||
|
||||
@@ -2033,7 +2033,8 @@ typedef CvANN_MLP NeuralNet_MLP;
|
||||
typedef CvGBTreesParams GradientBoostingTreeParams;
|
||||
typedef CvGBTrees GradientBoostingTrees;
|
||||
|
||||
template<> void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const;
|
||||
template<> struct DefaultDeleter<CvDTreeSplit>{ void operator ()(CvDTreeSplit* obj) const; };
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -168,7 +168,7 @@ CvBoostTree::try_split_node( CvDTreeNode* node )
|
||||
// store the responses for the corresponding training samples
|
||||
double* weak_eval = ensemble->get_weak_response()->data.db;
|
||||
cv::AutoBuffer<int> inn_buf(node->sample_count);
|
||||
const int* labels = data->get_cv_labels( node, (int*)inn_buf );
|
||||
const int* labels = data->get_cv_labels(node, inn_buf.data());
|
||||
int i, count = node->sample_count;
|
||||
double value = node->value;
|
||||
|
||||
@@ -191,7 +191,7 @@ CvBoostTree::calc_node_dir( CvDTreeNode* node )
|
||||
if( data->get_var_type(vi) >= 0 ) // split on categorical var
|
||||
{
|
||||
cv::AutoBuffer<int> inn_buf(n);
|
||||
const int* cat_labels = data->get_cat_var_data( node, vi, (int*)inn_buf );
|
||||
const int* cat_labels = data->get_cat_var_data(node, vi, inn_buf.data());
|
||||
const int* subset = node->split->subset;
|
||||
double sum = 0, sum_abs = 0;
|
||||
|
||||
@@ -210,7 +210,7 @@ CvBoostTree::calc_node_dir( CvDTreeNode* node )
|
||||
else // split on ordered var
|
||||
{
|
||||
cv::AutoBuffer<uchar> inn_buf(2*n*sizeof(int)+n*sizeof(float));
|
||||
float* values_buf = (float*)(uchar*)inn_buf;
|
||||
float* values_buf = (float*)inn_buf.data();
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = sorted_indices_buf + n;
|
||||
const float* values = 0;
|
||||
@@ -260,7 +260,7 @@ CvBoostTree::find_split_ord_class( CvDTreeNode* node, int vi, float init_quality
|
||||
cv::AutoBuffer<uchar> inn_buf;
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(n*(3*sizeof(int)+sizeof(float)));
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = sorted_indices_buf + n;
|
||||
@@ -369,7 +369,7 @@ CvBoostTree::find_split_cat_class( CvDTreeNode* node, int vi, float init_quality
|
||||
cv::AutoBuffer<uchar> inn_buf((2*mi+3)*sizeof(double) + mi*sizeof(double*));
|
||||
if( !_ext_buf)
|
||||
inn_buf.allocate( base_size + 2*n*sizeof(int) );
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
|
||||
int* cat_labels_buf = (int*)ext_buf;
|
||||
@@ -490,7 +490,7 @@ CvBoostTree::find_split_ord_reg( CvDTreeNode* node, int vi, float init_quality,
|
||||
cv::AutoBuffer<uchar> inn_buf;
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(2*n*(sizeof(int)+sizeof(float)));
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* indices_buf = (int*)(values_buf + n);
|
||||
@@ -559,7 +559,7 @@ CvBoostTree::find_split_cat_reg( CvDTreeNode* node, int vi, float init_quality,
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + n*(2*sizeof(int) + sizeof(float)));
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
|
||||
int* cat_labels_buf = (int*)ext_buf;
|
||||
@@ -652,7 +652,7 @@ CvBoostTree::find_surrogate_split_ord( CvDTreeNode* node, int vi, uchar* _ext_bu
|
||||
cv::AutoBuffer<uchar> inn_buf;
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(n*(2*sizeof(int)+sizeof(float)));
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = indices_buf + n;
|
||||
@@ -733,7 +733,7 @@ CvBoostTree::find_surrogate_split_cat( CvDTreeNode* node, int vi, uchar* _ext_bu
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + n*sizeof(int));
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
int* cat_labels_buf = (int*)ext_buf;
|
||||
const int* cat_labels = data->get_cat_var_data(node, vi, cat_labels_buf);
|
||||
|
||||
@@ -797,7 +797,7 @@ CvBoostTree::calc_node_value( CvDTreeNode* node )
|
||||
int i, n = node->sample_count;
|
||||
const double* weights = ensemble->get_weights()->data.db;
|
||||
cv::AutoBuffer<uchar> inn_buf(n*(sizeof(int) + ( data->is_classifier ? sizeof(int) : sizeof(int) + sizeof(float))));
|
||||
int* labels_buf = (int*)(uchar*)inn_buf;
|
||||
int* labels_buf = (int*)inn_buf.data();
|
||||
const int* labels = data->get_cv_labels(node, labels_buf);
|
||||
double* subtree_weights = ensemble->get_subtree_weights()->data.db;
|
||||
double rcw[2] = {0,0};
|
||||
@@ -1147,7 +1147,7 @@ CvBoost::update_weights( CvBoostTree* tree )
|
||||
_buf_size += data->get_length_subbuf()*(sizeof(float)+sizeof(uchar));
|
||||
}
|
||||
inn_buf.allocate(_buf_size);
|
||||
uchar* cur_buf_pos = (uchar*)inn_buf;
|
||||
uchar* cur_buf_pos = inn_buf.data();
|
||||
|
||||
if ( (params.boost_type == LOGIT) || (params.boost_type == GENTLE) )
|
||||
{
|
||||
@@ -2122,12 +2122,12 @@ CvBoost::train( const Mat& _train_data, int _tflag,
|
||||
const Mat& _missing_mask,
|
||||
CvBoostParams _params, bool _update )
|
||||
{
|
||||
train_data_hdr = _train_data;
|
||||
train_data_hdr = cvMat(_train_data);
|
||||
train_data_mat = _train_data;
|
||||
responses_hdr = _responses;
|
||||
responses_hdr = cvMat(_responses);
|
||||
responses_mat = _responses;
|
||||
|
||||
CvMat vidx = _var_idx, sidx = _sample_idx, vtype = _var_type, mmask = _missing_mask;
|
||||
CvMat vidx = cvMat(_var_idx), sidx = cvMat(_sample_idx), vtype = cvMat(_var_type), mmask = cvMat(_missing_mask);
|
||||
|
||||
return train(&train_data_hdr, _tflag, &responses_hdr, vidx.data.ptr ? &vidx : 0,
|
||||
sidx.data.ptr ? &sidx : 0, vtype.data.ptr ? &vtype : 0,
|
||||
@@ -2138,7 +2138,7 @@ float
|
||||
CvBoost::predict( const Mat& _sample, const Mat& _missing,
|
||||
const Range& slice, bool raw_mode, bool return_sum ) const
|
||||
{
|
||||
CvMat sample = _sample, mmask = _missing;
|
||||
CvMat sample = cvMat(_sample), mmask = cvMat(_missing);
|
||||
/*if( weak_responses )
|
||||
{
|
||||
int weak_count = cvSliceLength( slice, weak );
|
||||
|
||||
@@ -780,7 +780,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
|
||||
if( ci >= 0 || vi >= var_count )
|
||||
{
|
||||
int num_valid = 0;
|
||||
const int* src = CvDTreeTrainData::get_cat_var_data( data_root, vi, (int*)(uchar*)inn_buf );
|
||||
const int* src = CvDTreeTrainData::get_cat_var_data(data_root, vi, (int*)inn_buf.data());
|
||||
|
||||
if (is_buf_16u)
|
||||
{
|
||||
@@ -810,7 +810,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
|
||||
}
|
||||
else
|
||||
{
|
||||
int *src_idx_buf = (int*)(uchar*)inn_buf;
|
||||
int *src_idx_buf = (int*)inn_buf.data();
|
||||
float *src_val_buf = (float*)(src_idx_buf + sample_count);
|
||||
int* sample_indices_buf = (int*)(src_val_buf + sample_count);
|
||||
const int* src_idx = 0;
|
||||
@@ -870,7 +870,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
|
||||
}
|
||||
}
|
||||
// sample indices subsampling
|
||||
const int* sample_idx_src = get_sample_indices(data_root, (int*)(uchar*)inn_buf);
|
||||
const int* sample_idx_src = get_sample_indices(data_root, (int*)inn_buf.data());
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
@@ -943,7 +943,7 @@ void CvDTreeTrainData::get_vectors( const CvMat* _subsample_idx,
|
||||
{
|
||||
float* dst = values + vi;
|
||||
uchar* m = missing ? missing + vi : 0;
|
||||
const int* src = get_cat_var_data(data_root, vi, (int*)(uchar*)inn_buf);
|
||||
const int* src = get_cat_var_data(data_root, vi, (int*)inn_buf.data());
|
||||
|
||||
for( i = 0; i < count; i++, dst += var_count )
|
||||
{
|
||||
@@ -962,7 +962,7 @@ void CvDTreeTrainData::get_vectors( const CvMat* _subsample_idx,
|
||||
float* dst = values + vi;
|
||||
uchar* m = missing ? missing + vi : 0;
|
||||
int count1 = data_root->get_num_valid(vi);
|
||||
float *src_val_buf = (float*)(uchar*)inn_buf;
|
||||
float *src_val_buf = (float*)inn_buf.data();
|
||||
int* src_idx_buf = (int*)(src_val_buf + sample_count);
|
||||
int* sample_indices_buf = src_idx_buf + sample_count;
|
||||
const float *src_val = 0;
|
||||
@@ -999,7 +999,7 @@ void CvDTreeTrainData::get_vectors( const CvMat* _subsample_idx,
|
||||
{
|
||||
if( is_classifier )
|
||||
{
|
||||
const int* src = get_class_labels(data_root, (int*)(uchar*)inn_buf);
|
||||
const int* src = get_class_labels(data_root, (int*)inn_buf.data());
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
int idx = sidx ? sidx[i] : i;
|
||||
@@ -1010,7 +1010,7 @@ void CvDTreeTrainData::get_vectors( const CvMat* _subsample_idx,
|
||||
}
|
||||
else
|
||||
{
|
||||
float* val_buf = (float*)(uchar*)inn_buf;
|
||||
float* val_buf = (float*)inn_buf.data();
|
||||
int* sample_idx_buf = (int*)(val_buf + sample_count);
|
||||
const float* _values = get_ord_responses(data_root, val_buf, sample_idx_buf);
|
||||
for( i = 0; i < count; i++ )
|
||||
@@ -1592,12 +1592,12 @@ bool CvDTree::train( const Mat& _train_data, int _tflag,
|
||||
const Mat& _sample_idx, const Mat& _var_type,
|
||||
const Mat& _missing_mask, CvDTreeParams _params )
|
||||
{
|
||||
train_data_hdr = _train_data;
|
||||
train_data_hdr = cvMat(_train_data);
|
||||
train_data_mat = _train_data;
|
||||
responses_hdr = _responses;
|
||||
responses_hdr = cvMat(_responses);
|
||||
responses_mat = _responses;
|
||||
|
||||
CvMat vidx=_var_idx, sidx=_sample_idx, vtype=_var_type, mmask=_missing_mask;
|
||||
CvMat vidx=cvMat(_var_idx), sidx=cvMat(_sample_idx), vtype=cvMat(_var_type), mmask=cvMat(_missing_mask);
|
||||
|
||||
return train(&train_data_hdr, _tflag, &responses_hdr, vidx.data.ptr ? &vidx : 0, sidx.data.ptr ? &sidx : 0,
|
||||
vtype.data.ptr ? &vtype : 0, mmask.data.ptr ? &mmask : 0, _params);
|
||||
@@ -1780,7 +1780,7 @@ double CvDTree::calc_node_dir( CvDTreeNode* node )
|
||||
if( data->get_var_type(vi) >= 0 ) // split on categorical var
|
||||
{
|
||||
cv::AutoBuffer<int> inn_buf(n*(!data->have_priors ? 1 : 2));
|
||||
int* labels_buf = (int*)inn_buf;
|
||||
int* labels_buf = inn_buf.data();
|
||||
const int* labels = data->get_cat_var_data( node, vi, labels_buf );
|
||||
const int* subset = node->split->subset;
|
||||
if( !data->have_priors )
|
||||
@@ -1824,7 +1824,7 @@ double CvDTree::calc_node_dir( CvDTreeNode* node )
|
||||
int split_point = node->split->ord.split_point;
|
||||
int n1 = node->get_num_valid(vi);
|
||||
cv::AutoBuffer<uchar> inn_buf(n*(sizeof(int)*(data->have_priors ? 3 : 2) + sizeof(float)));
|
||||
float* val_buf = (float*)(uchar*)inn_buf;
|
||||
float* val_buf = (float*)inn_buf.data();
|
||||
int* sorted_buf = (int*)(val_buf + n);
|
||||
int* sample_idx_buf = sorted_buf + n;
|
||||
const float* val = 0;
|
||||
@@ -1880,10 +1880,7 @@ double CvDTree::calc_node_dir( CvDTreeNode* node )
|
||||
namespace cv
|
||||
{
|
||||
|
||||
template<> void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const
|
||||
{
|
||||
fastFree(obj);
|
||||
}
|
||||
void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const { fastFree(obj); }
|
||||
|
||||
DTreeBestSplitFinder::DTreeBestSplitFinder( CvDTree* _tree, CvDTreeNode* _node)
|
||||
{
|
||||
@@ -1929,16 +1926,16 @@ void DTreeBestSplitFinder::operator()(const BlockedRange& range)
|
||||
if( data->is_classifier )
|
||||
{
|
||||
if( ci >= 0 )
|
||||
res = tree->find_split_cat_class( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
|
||||
res = tree->find_split_cat_class( node, vi, bestSplit->quality, split, inn_buf.data() );
|
||||
else
|
||||
res = tree->find_split_ord_class( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
|
||||
res = tree->find_split_ord_class( node, vi, bestSplit->quality, split, inn_buf.data() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ci >= 0 )
|
||||
res = tree->find_split_cat_reg( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
|
||||
res = tree->find_split_cat_reg( node, vi, bestSplit->quality, split, inn_buf.data() );
|
||||
else
|
||||
res = tree->find_split_ord_reg( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
|
||||
res = tree->find_split_ord_reg( node, vi, bestSplit->quality, split, inn_buf.data() );
|
||||
}
|
||||
|
||||
if( res && bestSplit->quality < split->quality )
|
||||
@@ -1982,7 +1979,7 @@ CvDTreeSplit* CvDTree::find_split_ord_class( CvDTreeNode* node, int vi,
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + n*(3*sizeof(int)+sizeof(float)));
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
@@ -2096,7 +2093,7 @@ void CvDTree::cluster_categories( const int* vectors, int n, int m,
|
||||
int iters = 0, max_iters = 100;
|
||||
int i, j, idx;
|
||||
cv::AutoBuffer<double> buf(n + k);
|
||||
double *v_weights = buf, *c_weights = buf + n;
|
||||
double *v_weights = buf.data(), *c_weights = buf.data() + n;
|
||||
bool modified = true;
|
||||
RNG* r = data->rng;
|
||||
|
||||
@@ -2201,7 +2198,7 @@ CvDTreeSplit* CvDTree::find_split_cat_class( CvDTreeNode* node, int vi, float in
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + 2*n*sizeof(int));
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
|
||||
int* lc = (int*)base_buf;
|
||||
@@ -2383,7 +2380,7 @@ CvDTreeSplit* CvDTree::find_split_ord_reg( CvDTreeNode* node, int vi, float init
|
||||
cv::AutoBuffer<uchar> inn_buf;
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(2*n*(sizeof(int) + sizeof(float)));
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = sorted_indices_buf + n;
|
||||
@@ -2443,7 +2440,7 @@ CvDTreeSplit* CvDTree::find_split_cat_reg( CvDTreeNode* node, int vi, float init
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + n*(2*sizeof(int) + sizeof(float)));
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
int* labels_buf = (int*)ext_buf;
|
||||
const int* labels = data->get_cat_var_data(node, vi, labels_buf);
|
||||
@@ -2534,7 +2531,7 @@ CvDTreeSplit* CvDTree::find_surrogate_split_ord( CvDTreeNode* node, int vi, ucha
|
||||
cv::AutoBuffer<uchar> inn_buf;
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate( n*(sizeof(int)*(data->have_priors ? 3 : 2) + sizeof(float)) );
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
|
||||
float* values_buf = (float*)ext_buf;
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = sorted_indices_buf + n;
|
||||
@@ -2658,7 +2655,7 @@ CvDTreeSplit* CvDTree::find_surrogate_split_cat( CvDTreeNode* node, int vi, ucha
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size);
|
||||
if( !_ext_buf )
|
||||
inn_buf.allocate(base_size + n*(sizeof(int) + (data->have_priors ? sizeof(int) : 0)));
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
|
||||
|
||||
int* labels_buf = (int*)ext_buf;
|
||||
@@ -2758,7 +2755,7 @@ void CvDTree::calc_node_value( CvDTreeNode* node )
|
||||
int base_size = data->is_classifier ? m*cv_n*sizeof(int) : 2*cv_n*sizeof(double)+cv_n*sizeof(int);
|
||||
int ext_size = n*(sizeof(int) + (data->is_classifier ? sizeof(int) : sizeof(int)+sizeof(float)));
|
||||
cv::AutoBuffer<uchar> inn_buf(base_size + ext_size);
|
||||
uchar* base_buf = (uchar*)inn_buf;
|
||||
uchar* base_buf = inn_buf.data();
|
||||
uchar* ext_buf = base_buf + base_size;
|
||||
|
||||
int* cv_labels_buf = (int*)ext_buf;
|
||||
@@ -2961,7 +2958,7 @@ void CvDTree::complete_node_dir( CvDTreeNode* node )
|
||||
|
||||
if( data->get_var_type(vi) >= 0 ) // split on categorical var
|
||||
{
|
||||
int* labels_buf = (int*)(uchar*)inn_buf;
|
||||
int* labels_buf = (int*)inn_buf.data();
|
||||
const int* labels = data->get_cat_var_data(node, vi, labels_buf);
|
||||
const int* subset = split->subset;
|
||||
|
||||
@@ -2980,7 +2977,7 @@ void CvDTree::complete_node_dir( CvDTreeNode* node )
|
||||
}
|
||||
else // split on ordered var
|
||||
{
|
||||
float* values_buf = (float*)(uchar*)inn_buf;
|
||||
float* values_buf = (float*)inn_buf.data();
|
||||
int* sorted_indices_buf = (int*)(values_buf + n);
|
||||
int* sample_indices_buf = sorted_indices_buf + n;
|
||||
const float* values = 0;
|
||||
@@ -3042,7 +3039,7 @@ void CvDTree::split_node_data( CvDTreeNode* node )
|
||||
CvMat* buf = data->buf;
|
||||
size_t length_buf_row = data->get_length_subbuf();
|
||||
cv::AutoBuffer<uchar> inn_buf(n*(3*sizeof(int) + sizeof(float)));
|
||||
int* temp_buf = (int*)(uchar*)inn_buf;
|
||||
int* temp_buf = (int*)inn_buf.data();
|
||||
|
||||
complete_node_dir(node);
|
||||
|
||||
@@ -3734,7 +3731,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample,
|
||||
|
||||
CvDTreeNode* CvDTree::predict( const Mat& _sample, const Mat& _missing, bool preprocessed_input ) const
|
||||
{
|
||||
CvMat sample = _sample, mmask = _missing;
|
||||
CvMat sample = cvMat(_sample), mmask = cvMat(_missing);
|
||||
return predict(&sample, mmask.data.ptr ? &mmask : 0, preprocessed_input);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
|
||||
#
|
||||
# CUDA_BUILD_CLEAN_TARGET()
|
||||
# -- Creates a convience target that deletes all the dependency files
|
||||
# -- Creates a convenience target that deletes all the dependency files
|
||||
# generated. You should make clean after running this target to ensure the
|
||||
# dependency files get regenerated.
|
||||
#
|
||||
@@ -473,7 +473,7 @@ else()
|
||||
endif()
|
||||
|
||||
# Propagate the host flags to the host compiler via -Xcompiler
|
||||
option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
|
||||
option(CUDA_PROPAGATE_HOST_FLAGS "Propagate C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
|
||||
|
||||
# Enable CUDA_SEPARABLE_COMPILATION
|
||||
option(CUDA_SEPARABLE_COMPILATION "Compile CUDA objects with separable compilation enabled. Requires CUDA 5.0+" OFF)
|
||||
|
||||
@@ -700,12 +700,21 @@ macro(ocv_compiler_optimization_fill_cpu_config)
|
||||
list(APPEND __dispatch_modes ${CPU_DISPATCH_${OPT}_FORCE} ${OPT})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES __dispatch_modes)
|
||||
set(OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE "")
|
||||
foreach(OPT ${__dispatch_modes})
|
||||
set(OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE "${OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE}
|
||||
#define CV_CPU_DISPATCH_COMPILE_${OPT} 1")
|
||||
endforeach()
|
||||
|
||||
set(OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE "${OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE}
|
||||
\n\n#define CV_CPU_DISPATCH_FEATURES 0 \\")
|
||||
foreach(OPT ${__dispatch_modes})
|
||||
if(NOT DEFINED CPU_${OPT}_FEATURE_ALIAS OR NOT "x${CPU_${OPT}_FEATURE_ALIAS}" STREQUAL "x")
|
||||
set(OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE "${OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE}
|
||||
, CV_CPU_${OPT} \\")
|
||||
endif()
|
||||
endforeach()
|
||||
set(OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE "${OPENCV_CPU_DISPATCH_DEFINITIONS_CONFIGMAKE}\n")
|
||||
|
||||
set(OPENCV_CPU_CONTROL_DEFINITIONS_CONFIGMAKE "// AUTOGENERATED, DO NOT EDIT\n")
|
||||
foreach(OPT ${CPU_ALL_OPTIMIZATIONS})
|
||||
if(NOT DEFINED CPU_${OPT}_FEATURE_ALIAS OR NOT "x${CPU_${OPT}_FEATURE_ALIAS}" STREQUAL "x")
|
||||
@@ -740,7 +749,7 @@ macro(ocv_compiler_optimization_fill_cpu_config)
|
||||
")
|
||||
|
||||
|
||||
set(__file "${CMAKE_SOURCE_DIR}/modules/core/include/opencv2/core/cv_cpu_helper.h")
|
||||
set(__file "${OpenCV_SOURCE_DIR}/modules/core/include/opencv2/core/cv_cpu_helper.h")
|
||||
if(EXISTS "${__file}")
|
||||
file(READ "${__file}" __content)
|
||||
endif()
|
||||
@@ -752,24 +761,24 @@ macro(ocv_compiler_optimization_fill_cpu_config)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_add_dispatched_file filename)
|
||||
macro(__ocv_add_dispatched_file filename target_src_var src_directory dst_directory precomp_hpp optimizations_var)
|
||||
if(NOT OPENCV_INITIAL_PASS)
|
||||
set(__codestr "
|
||||
#include \"${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp\"
|
||||
#include \"${CMAKE_CURRENT_LIST_DIR}/src/${filename}.simd.hpp\"
|
||||
#include \"${src_directory}/${precomp_hpp}\"
|
||||
#include \"${src_directory}/${filename}.simd.hpp\"
|
||||
")
|
||||
|
||||
set(__declarations_str "#define CV_CPU_SIMD_FILENAME \"${CMAKE_CURRENT_LIST_DIR}/src/${filename}.simd.hpp\"")
|
||||
set(__declarations_str "#define CV_CPU_SIMD_FILENAME \"${src_directory}/${filename}.simd.hpp\"")
|
||||
set(__dispatch_modes "BASELINE")
|
||||
|
||||
set(__optimizations "${ARGN}")
|
||||
set(__optimizations "${${optimizations_var}}")
|
||||
if(CV_DISABLE_OPTIMIZATION OR NOT CV_ENABLE_INTRINSICS)
|
||||
set(__optimizations "")
|
||||
endif()
|
||||
|
||||
foreach(OPT ${__optimizations})
|
||||
string(TOLOWER "${OPT}" OPT_LOWER)
|
||||
set(__file "${CMAKE_CURRENT_BINARY_DIR}/${filename}.${OPT_LOWER}.cpp")
|
||||
set(__file "${CMAKE_CURRENT_BINARY_DIR}/${dst_directory}${filename}.${OPT_LOWER}.cpp")
|
||||
if(EXISTS "${__file}")
|
||||
file(READ "${__file}" __content)
|
||||
else()
|
||||
@@ -782,7 +791,11 @@ macro(ocv_add_dispatched_file filename)
|
||||
endif()
|
||||
|
||||
if(";${CPU_DISPATCH};" MATCHES "${OPT}" OR __CPU_DISPATCH_INCLUDE_ALL)
|
||||
list(APPEND OPENCV_MODULE_${the_module}_SOURCES_DISPATCHED "${__file}")
|
||||
if(EXISTS "${src_directory}/${filename}.${OPT_LOWER}.cpp")
|
||||
message(STATUS "Using overrided ${OPT} source: ${src_directory}/${filename}.${OPT_LOWER}.cpp")
|
||||
else()
|
||||
list(APPEND ${target_src_var} "${__file}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(__declarations_str "${__declarations_str}
|
||||
@@ -794,9 +807,11 @@ macro(ocv_add_dispatched_file filename)
|
||||
|
||||
set(__declarations_str "${__declarations_str}
|
||||
#define CV_CPU_DISPATCH_MODES_ALL ${__dispatch_modes}
|
||||
|
||||
#undef CV_CPU_SIMD_FILENAME
|
||||
")
|
||||
|
||||
set(__file "${CMAKE_CURRENT_BINARY_DIR}/${filename}.simd_declarations.hpp")
|
||||
set(__file "${CMAKE_CURRENT_BINARY_DIR}/${dst_directory}${filename}.simd_declarations.hpp")
|
||||
if(EXISTS "${__file}")
|
||||
file(READ "${__file}" __content)
|
||||
endif()
|
||||
@@ -808,6 +823,17 @@ macro(ocv_add_dispatched_file filename)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_add_dispatched_file filename)
|
||||
set(__optimizations "${ARGN}")
|
||||
if(" ${ARGV1}" STREQUAL " TEST")
|
||||
list(REMOVE_AT __optimizations 0)
|
||||
__ocv_add_dispatched_file("${filename}" "OPENCV_MODULE_${the_module}_TEST_SOURCES_DISPATCHED" "${CMAKE_CURRENT_LIST_DIR}/test" "test/" "test_precomp.hpp" __optimizations)
|
||||
else()
|
||||
__ocv_add_dispatched_file("${filename}" "OPENCV_MODULE_${the_module}_SOURCES_DISPATCHED" "${CMAKE_CURRENT_LIST_DIR}/src" "" "precomp.hpp" __optimizations)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Workaround to support code which always require all code paths
|
||||
macro(ocv_add_dispatched_file_force_all)
|
||||
set(__CPU_DISPATCH_INCLUDE_ALL 1)
|
||||
|
||||
@@ -125,8 +125,8 @@ if(CV_GCC OR CV_CLANG)
|
||||
)
|
||||
add_extra_compiler_option(-Wimplicit-fallthrough=3)
|
||||
endif()
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.2.0)
|
||||
add_extra_compiler_option(-Wno-strict-overflow) # Issue is fixed in GCC 7.2.1
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
|
||||
add_extra_compiler_option(-Wno-strict-overflow) # Issue appears when compiling surf.cpp from opencv_contrib/modules/xfeatures2d
|
||||
endif()
|
||||
endif()
|
||||
add_extra_compiler_option(-fdiagnostics-show-option)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
if(WIN32)
|
||||
find_path( CSTRIPES_LIB_DIR
|
||||
NAMES "C=.lib"
|
||||
DOC "The path to C= lib and dll")
|
||||
if(CSTRIPES_LIB_DIR)
|
||||
ocv_include_directories("${CSTRIPES_LIB_DIR}/..")
|
||||
link_directories("${CSTRIPES_LIB_DIR}")
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} "C=")
|
||||
set(HAVE_CSTRIPES 1)
|
||||
endif()
|
||||
endif()
|
||||
@@ -3,19 +3,28 @@ if(WIN32 AND NOT MSVC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND CV_CLANG)
|
||||
if(NOT UNIX AND CV_CLANG)
|
||||
message(STATUS "CUDA compilation is disabled (due to Clang unsupported on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${OpenCV_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
if(ANDROID)
|
||||
set(CUDA_TARGET_OS_VARIANT "Android")
|
||||
if(((NOT CMAKE_VERSION VERSION_LESS "3.9.0") # requires https://gitlab.kitware.com/cmake/cmake/merge_requests/663
|
||||
OR OPENCV_CUDA_FORCE_EXTERNAL_CMAKE_MODULE)
|
||||
AND NOT OPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE)
|
||||
ocv_update(CUDA_LINK_LIBRARIES_KEYWORD "LINK_PRIVATE")
|
||||
find_host_package(CUDA "${MIN_VER_CUDA}" QUIET)
|
||||
else()
|
||||
# Use OpenCV's patched "FindCUDA" module
|
||||
set(CMAKE_MODULE_PATH "${OpenCV_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
if(ANDROID)
|
||||
set(CUDA_TARGET_OS_VARIANT "Android")
|
||||
endif()
|
||||
find_host_package(CUDA "${MIN_VER_CUDA}" QUIET)
|
||||
|
||||
list(REMOVE_AT CMAKE_MODULE_PATH 0)
|
||||
endif()
|
||||
find_host_package(CUDA "${MIN_VER_CUDA}" QUIET)
|
||||
|
||||
list(REMOVE_AT CMAKE_MODULE_PATH 0)
|
||||
|
||||
if(CUDA_FOUND)
|
||||
set(HAVE_CUDA 1)
|
||||
@@ -61,6 +70,12 @@ if(CUDA_FOUND)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
endif()
|
||||
|
||||
SET(DETECT_ARCHS_COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run")
|
||||
if(WIN32 AND CMAKE_LINKER) #Workaround for VS cl.exe not being in the env. path
|
||||
get_filename_component(host_compiler_bindir ${CMAKE_LINKER} DIRECTORY)
|
||||
SET(DETECT_ARCHS_COMMAND ${DETECT_ARCHS_COMMAND} "-ccbin" "${host_compiler_bindir}")
|
||||
endif()
|
||||
|
||||
set(__cuda_arch_ptx "")
|
||||
if(CUDA_GENERATION STREQUAL "Fermi")
|
||||
set(__cuda_arch_bin "2.0")
|
||||
@@ -73,10 +88,11 @@ if(CUDA_FOUND)
|
||||
elseif(CUDA_GENERATION STREQUAL "Volta")
|
||||
set(__cuda_arch_bin "7.0")
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
else()
|
||||
@@ -90,10 +106,11 @@ if(CUDA_FOUND)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
set(__cuda_arch_bin "5.3 6.2 7.0")
|
||||
@@ -179,6 +196,13 @@ if(CUDA_FOUND)
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
set(${var}_backup_in_cuda_compile_ "${${var}}")
|
||||
|
||||
if (CV_CLANG)
|
||||
# we remove -Winconsistent-missing-override and -Qunused-arguments
|
||||
# just in case we are compiling CUDA with gcc but OpenCV with clang
|
||||
string(REPLACE "-Winconsistent-missing-override" "" ${var} "${${var}}")
|
||||
string(REPLACE "-Qunused-arguments" "" ${var} "${${var}}")
|
||||
endif()
|
||||
|
||||
# we remove /EHa as it generates warnings under windows
|
||||
string(REPLACE "/EHa" "" ${var} "${${var}}")
|
||||
|
||||
@@ -224,7 +248,7 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
if(UNIX OR APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC --std=c++11)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
|
||||
|
||||
@@ -166,14 +166,11 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CXX11)
|
||||
#cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
|
||||
@@ -185,3 +182,6 @@ if(NOT HAVE_CXX11)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
message(FATAL_ERROR "OpenCV 4.x requires C++11")
|
||||
endif()
|
||||
|
||||
@@ -1,71 +1,87 @@
|
||||
# The script detects Intel(R) Inference Engine installation
|
||||
#
|
||||
# Parameters:
|
||||
# INTEL_CVSDK_DIR - Path to Inference Engine root folder
|
||||
# IE_PLUGINS_PATH - Path to folder with Inference Engine plugins
|
||||
# Cache variables:
|
||||
# INF_ENGINE_OMP_DIR - directory with OpenMP library to link with (needed by some versions of IE)
|
||||
# INF_ENGINE_RELEASE - a number reflecting IE source interface (linked with OpenVINO release)
|
||||
#
|
||||
# On return this will define:
|
||||
# Detect parameters:
|
||||
# 1. Native cmake IE package:
|
||||
# - enironment variable InferenceEngine_DIR is set to location of cmake module
|
||||
# 2. Custom location:
|
||||
# - INF_ENGINE_INCLUDE_DIRS - headers search location
|
||||
# - INF_ENGINE_LIB_DIRS - library search location
|
||||
# 3. OpenVINO location:
|
||||
# - environment variable INTEL_CVSDK_DIR is set to location of OpenVINO installation dir
|
||||
# - INF_ENGINE_PLATFORM - part of name of library directory representing its platform (default ubuntu_16.04)
|
||||
#
|
||||
# HAVE_INF_ENGINE - True if Intel Inference Engine was found
|
||||
# INF_ENGINE_INCLUDE_DIRS - Inference Engine include folder
|
||||
# INF_ENGINE_LIBRARIES - Inference Engine libraries and it's dependencies
|
||||
# Result:
|
||||
# INF_ENGINE_TARGET - set to name of imported library target representing InferenceEngine
|
||||
#
|
||||
macro(ie_fail)
|
||||
set(HAVE_INF_ENGINE FALSE)
|
||||
return()
|
||||
endmacro()
|
||||
|
||||
if(NOT HAVE_CXX11)
|
||||
ie_fail()
|
||||
message(WARNING "DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT INF_ENGINE_ROOT_DIR OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp")
|
||||
set(ie_root_paths "${INF_ENGINE_ROOT_DIR}")
|
||||
if(DEFINED ENV{INTEL_CVSDK_DIR})
|
||||
list(APPEND ie_root_paths "$ENV{INTEL_CVSDK_DIR}")
|
||||
list(APPEND ie_root_paths "$ENV{INTEL_CVSDK_DIR}/inference_engine")
|
||||
endif()
|
||||
if(DEFINED INTEL_CVSDK_DIR)
|
||||
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}")
|
||||
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/inference_engine")
|
||||
endif()
|
||||
# =======================
|
||||
|
||||
if(NOT ie_root_paths)
|
||||
list(APPEND ie_root_paths "/opt/intel/deeplearning_deploymenttoolkit/deployment_tools/inference_engine")
|
||||
endif()
|
||||
function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg)
|
||||
if(NOT _inc OR NOT (_lib OR _lib_rel OR _lib_dbg))
|
||||
return()
|
||||
endif()
|
||||
add_library(inference_engine UNKNOWN IMPORTED)
|
||||
set_target_properties(inference_engine PROPERTIES
|
||||
IMPORTED_LOCATION "${_lib}"
|
||||
IMPORTED_IMPLIB_RELEASE "${_lib_rel}"
|
||||
IMPORTED_IMPLIB_DEBUG "${_lib_dbg}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_inc}"
|
||||
)
|
||||
find_library(omp_lib iomp5 PATHS "${INF_ENGINE_OMP_DIR}" NO_DEFAULT_PATH)
|
||||
if(NOT omp_lib)
|
||||
message(WARNING "OpenMP for IE have not been found. Set INF_ENGINE_OMP_DIR variable if you experience build errors.")
|
||||
else()
|
||||
set_target_properties(inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${omp_lib}")
|
||||
endif()
|
||||
set(INF_ENGINE_VERSION "Unknown" CACHE STRING "")
|
||||
set(INF_ENGINE_TARGET inference_engine PARENT_SCOPE)
|
||||
message(STATUS "Detected InferenceEngine: ${_msg}")
|
||||
endfunction()
|
||||
|
||||
find_path(INF_ENGINE_ROOT_DIR include/inference_engine.hpp PATHS ${ie_root_paths})
|
||||
# ======================
|
||||
|
||||
find_package(InferenceEngine QUIET)
|
||||
if(InferenceEngine_FOUND)
|
||||
set(INF_ENGINE_TARGET IE::inference_engine)
|
||||
set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}" CACHE STRING "")
|
||||
message(STATUS "Detected InferenceEngine: cmake package")
|
||||
endif()
|
||||
|
||||
set(INF_ENGINE_INCLUDE_DIRS "${INF_ENGINE_ROOT_DIR}/include" CACHE PATH "Path to Inference Engine include directory")
|
||||
|
||||
if(NOT INF_ENGINE_ROOT_DIR
|
||||
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}"
|
||||
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp"
|
||||
)
|
||||
ie_fail()
|
||||
if(NOT INF_ENGINE_TARGET AND INF_ENGINE_LIB_DIRS AND INF_ENGINE_INCLUDE_DIRS)
|
||||
find_path(ie_custom_inc "inference_engine.hpp" PATHS "${INF_ENGINE_INCLUDE_DIRS}" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib_rel "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Release" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib_dbg "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Debug" NO_DEFAULT_PATH)
|
||||
add_custom_ie_build("${ie_custom_inc}" "${ie_custom_lib}" "${ie_custom_lib_rel}" "${ie_custom_lib_dbg}" "INF_ENGINE_{INCLUDE,LIB}_DIRS")
|
||||
endif()
|
||||
|
||||
set(INF_ENGINE_LIBRARIES "")
|
||||
set(_loc "$ENV{INTEL_CVSDK_DIR}")
|
||||
if(NOT INF_ENGINE_TARGET AND _loc)
|
||||
set(INF_ENGINE_PLATFORM "ubuntu_16.04" CACHE STRING "InferenceEngine platform (library dir)")
|
||||
find_path(ie_custom_env_inc "inference_engine.hpp" PATHS "${_loc}/deployment_tools/inference_engine/include" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/${INF_ENGINE_PLATFORM}/intel64" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib_rel "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Release" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib_dbg "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Debug" NO_DEFAULT_PATH)
|
||||
add_custom_ie_build("${ie_custom_env_inc}" "${ie_custom_env_lib}" "${ie_custom_env_lib_rel}" "${ie_custom_env_lib_dbg}" "OpenVINO (${_loc})")
|
||||
endif()
|
||||
|
||||
set(ie_lib_list inference_engine)
|
||||
# Add more features to the target
|
||||
|
||||
link_directories(
|
||||
${INTEL_CVSDK_DIR}/inference_engine/external/mkltiny_lnx/lib
|
||||
${INTEL_CVSDK_DIR}/inference_engine/external/cldnn/lib
|
||||
)
|
||||
|
||||
foreach(lib ${ie_lib_list})
|
||||
find_library(${lib}
|
||||
NAMES ${lib}
|
||||
# For inference_engine
|
||||
HINTS ${IE_PLUGINS_PATH}
|
||||
HINTS "$ENV{IE_PLUGINS_PATH}"
|
||||
)
|
||||
if(NOT ${lib})
|
||||
ie_fail()
|
||||
endif()
|
||||
list(APPEND INF_ENGINE_LIBRARIES ${${lib}})
|
||||
endforeach()
|
||||
|
||||
set(HAVE_INF_ENGINE TRUE)
|
||||
if(INF_ENGINE_TARGET)
|
||||
if(NOT INF_ENGINE_RELEASE)
|
||||
message(WARNING "InferenceEngine version have not been set, 2018R3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "2018030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
|
||||
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -254,10 +254,12 @@ find_python(3.4 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
|
||||
|
||||
if(PYTHON_DEFAULT_EXECUTABLE)
|
||||
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
|
||||
elseif(PYTHON2INTERP_FOUND) # Use Python 2 as default Python interpreter
|
||||
elseif(PYTHON2_EXECUTABLE AND PYTHON2INTERP_FOUND)
|
||||
# Use Python 2 as default Python interpreter
|
||||
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
|
||||
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
|
||||
elseif(PYTHON3INTERP_FOUND) # Use Python 3 as fallback Python interpreter (if there is no Python 2)
|
||||
elseif(PYTHON3_EXECUTABLE AND PYTHON3INTERP_FOUND)
|
||||
# Use Python 3 as fallback Python interpreter (if there is no Python 2)
|
||||
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
|
||||
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
@@ -52,5 +52,18 @@ if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION}
|
||||
endif()
|
||||
endif()
|
||||
|
||||
try_compile(VTK_COMPILE_STATUS
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VTK_INCLUDE_DIRS}"
|
||||
LINK_LIBRARIES ${VTK_LIBRARIES}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
if(NOT ${VTK_COMPILE_STATUS})
|
||||
message(STATUS "VTK support is disabled. Compilation of the sample code has failed.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(HAVE_VTK ON)
|
||||
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
||||
|
||||
@@ -20,16 +20,19 @@ if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
|
||||
endif()
|
||||
set(OPENCV_DOWNLOAD_PATH "${OpenCV_SOURCE_DIR}/.cache" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
|
||||
set(OPENCV_DOWNLOAD_LOG "${OpenCV_BINARY_DIR}/CMakeDownloadLog.txt")
|
||||
set(OPENCV_DOWNLOAD_WITH_CURL "${OpenCV_BINARY_DIR}/download_with_curl.sh")
|
||||
set(OPENCV_DOWNLOAD_WITH_WGET "${OpenCV_BINARY_DIR}/download_with_wget.sh")
|
||||
|
||||
# Init download cache directory and log file
|
||||
# Init download cache directory and log file and helper scripts
|
||||
if(NOT EXISTS "${OPENCV_DOWNLOAD_PATH}")
|
||||
file(MAKE_DIRECTORY ${OPENCV_DOWNLOAD_PATH})
|
||||
endif()
|
||||
if(NOT EXISTS "${OPENCV_DOWNLOAD_PATH}/.gitignore")
|
||||
file(WRITE "${OPENCV_DOWNLOAD_PATH}/.gitignore" "*\n")
|
||||
endif()
|
||||
file(WRITE "${OPENCV_DOWNLOAD_LOG}" "use_cache \"${OPENCV_DOWNLOAD_PATH}\"\n")
|
||||
|
||||
file(WRITE "${OPENCV_DOWNLOAD_LOG}" "#use_cache \"${OPENCV_DOWNLOAD_PATH}\"\n")
|
||||
file(REMOVE "${OPENCV_DOWNLOAD_WITH_CURL}")
|
||||
file(REMOVE "${OPENCV_DOWNLOAD_WITH_WGET}")
|
||||
|
||||
function(ocv_download)
|
||||
cmake_parse_arguments(DL "UNPACK;RELATIVE_URL" "FILENAME;HASH;DESTINATION_DIR;ID;STATUS" "URL" ${ARGN})
|
||||
@@ -103,7 +106,7 @@ function(ocv_download)
|
||||
endif()
|
||||
|
||||
# Log all calls to file
|
||||
ocv_download_log("do_${mode} \"${DL_FILENAME}\" \"${DL_HASH}\" \"${DL_URL}\" \"${DL_DESTINATION_DIR}\"")
|
||||
ocv_download_log("#do_${mode} \"${DL_FILENAME}\" \"${DL_HASH}\" \"${DL_URL}\" \"${DL_DESTINATION_DIR}\"")
|
||||
# ... and to console
|
||||
set(__msg_prefix "")
|
||||
if(DL_ID)
|
||||
@@ -191,6 +194,9 @@ function(ocv_download)
|
||||
For details please refer to the download log file:
|
||||
${OPENCV_DOWNLOAD_LOG}
|
||||
")
|
||||
# write helper scripts for failed downloads
|
||||
file(APPEND "${OPENCV_DOWNLOAD_WITH_CURL}" "curl --output \"${CACHE_CANDIDATE}\" \"${DL_URL}\"\n")
|
||||
file(APPEND "${OPENCV_DOWNLOAD_WITH_WGET}" "wget -O \"${CACHE_CANDIDATE}\" \"${DL_URL}\"\n")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
# Main variables:
|
||||
# IPP_A_LIBRARIES and IPP_A_INCLUDE to use IPP Async
|
||||
# HAVE_IPP_A for conditional compilation OpenCV with/without IPP Async
|
||||
|
||||
# IPP_ASYNC_ROOT - root of IPP Async installation
|
||||
|
||||
if(X86_64)
|
||||
find_path(
|
||||
IPP_A_INCLUDE_DIR
|
||||
NAMES ipp_async_defs.h
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel IPP Async interface headers")
|
||||
|
||||
find_file(
|
||||
IPP_A_LIBRARIES
|
||||
NAMES ipp_async_preview.lib
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES lib/intel64
|
||||
DOC "Path to Intel IPP Async interface libraries")
|
||||
|
||||
else()
|
||||
find_path(
|
||||
IPP_A_INCLUDE_DIR
|
||||
NAMES ipp_async_defs.h
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel IPP Async interface headers")
|
||||
|
||||
find_file(
|
||||
IPP_A_LIBRARIES
|
||||
NAMES ipp_async_preview.lib
|
||||
PATHS $ENV{IPP_ASYNC_ROOT}
|
||||
PATH_SUFFIXES lib/ia32
|
||||
DOC "Path to Intel IPP Async interface libraries")
|
||||
endif()
|
||||
|
||||
if(IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES)
|
||||
set(HAVE_IPP_A TRUE)
|
||||
else()
|
||||
set(HAVE_IPP_A FALSE)
|
||||
message(WARNING "Intel IPP Async library directory (set by IPP_A_LIBRARIES_DIR variable) is not found or does not have Intel IPP Async libraries.")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE IPP_A_LIBRARIES IPP_A_INCLUDE_DIR)
|
||||
@@ -0,0 +1,15 @@
|
||||
# Main variables:
|
||||
# LIBREALSENSE_LIBRARIES and LIBREALSENSE_INCLUDE to link Intel librealsense modules
|
||||
# HAVE_LIBREALSENSE for conditional compilation OpenCV with/without librealsense
|
||||
|
||||
find_path(LIBREALSENSE_INCLUDE_DIR "librealsense2/rs.hpp" PATHS "$ENV{LIBREALSENSE_INCLUDE}" DOC "Path to librealsense interface headers")
|
||||
find_library(LIBREALSENSE_LIBRARIES "realsense2" PATHS "$ENV{LIBREALSENSE_LIB}" DOC "Path to librealsense interface libraries")
|
||||
|
||||
if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
|
||||
set(HAVE_LIBREALSENSE TRUE)
|
||||
else()
|
||||
set(HAVE_LIBREALSENSE FALSE)
|
||||
message( WARNING, " librealsense include directory (set by LIBREALSENSE_INCLUDE_DIR variable) is not found or does not have librealsense include files." )
|
||||
endif() #if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
|
||||
|
||||
mark_as_advanced(FORCE LIBREALSENSE_LIBRARIES LIBREALSENSE_INCLUDE_DIR)
|
||||
@@ -268,3 +268,8 @@ if(WITH_IMGCODEC_PXM)
|
||||
elseif(DEFINED WITH_IMGCODEC_PXM)
|
||||
set(HAVE_IMGCODEC_PXM OFF)
|
||||
endif()
|
||||
if(WITH_IMGCODEC_PFM)
|
||||
set(HAVE_IMGCODEC_PFM ON)
|
||||
elseif(DEFINED WITH_IMGCODEC_PFM)
|
||||
set(HAVE_IMGCODEC_PFM OFF)
|
||||
endif()
|
||||
@@ -7,6 +7,13 @@ if(WITH_TBB)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectTBB.cmake")
|
||||
endif(WITH_TBB)
|
||||
|
||||
# --- HPX ---
|
||||
if(WITH_HPX)
|
||||
find_package(HPX REQUIRED)
|
||||
ocv_include_directories(${HPX_INCLUDE_DIRS})
|
||||
set(HAVE_HPX TRUE)
|
||||
endif(WITH_HPX)
|
||||
|
||||
# --- IPP ---
|
||||
if(WITH_IPP)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPP.cmake")
|
||||
@@ -28,17 +35,6 @@ if(WITH_IPP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- IPP Async ---
|
||||
|
||||
if(WITH_IPP_A)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPPAsync.cmake")
|
||||
if(IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES)
|
||||
ocv_include_directories(${IPP_A_INCLUDE_DIR})
|
||||
link_directories(${IPP_A_LIBRARIES})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_A_LIBRARIES})
|
||||
endif()
|
||||
endif(WITH_IPP_A)
|
||||
|
||||
# --- CUDA ---
|
||||
if(WITH_CUDA)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCUDA.cmake")
|
||||
@@ -104,22 +100,15 @@ if(WITH_CLP)
|
||||
endif()
|
||||
endif(WITH_CLP)
|
||||
|
||||
# --- C= ---
|
||||
if(WITH_CSTRIPES AND NOT HAVE_TBB)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCStripes.cmake")
|
||||
else()
|
||||
set(HAVE_CSTRIPES 0)
|
||||
endif()
|
||||
|
||||
# --- GCD ---
|
||||
if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
if(APPLE AND NOT HAVE_TBB)
|
||||
set(HAVE_GCD 1)
|
||||
else()
|
||||
set(HAVE_GCD 0)
|
||||
endif()
|
||||
|
||||
# --- Concurrency ---
|
||||
if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
if(MSVC AND NOT HAVE_TBB)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
|
||||
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
|
||||
@@ -310,6 +310,11 @@ if(APPLE)
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
# --- Intel librealsense ---
|
||||
if(WITH_LIBREALSENSE)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindLibRealsense.cmake")
|
||||
endif(WITH_LIBREALSENSE)
|
||||
|
||||
# --- Intel Perceptual Computing SDK ---
|
||||
if(WITH_INTELPERC)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIntelPerCSDK.cmake")
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
# ----- Find Matlab/Octave -----
|
||||
#
|
||||
# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
|
||||
# to extract the mex headers, libraries and shell scripts. If found
|
||||
# successfully, the following variables will be defined
|
||||
#
|
||||
# MATLAB_FOUND: true/false
|
||||
# MATLAB_ROOT_DIR: Root of Matlab installation
|
||||
# MATLAB_BIN: The main Matlab "executable" (shell script)
|
||||
# MATLAB_MEX_SCRIPT: The mex script used to compile mex files
|
||||
# MATLAB_INCLUDE_DIRS:Path to "mex.h"
|
||||
# MATLAB_LIBRARY_DIRS:Path to mex and matrix libraries
|
||||
# MATLAB_LIBRARIES: The Matlab libs, usually mx, mex, mat
|
||||
# MATLAB_MEXEXT: The mex library extension. It will be one of:
|
||||
# mexwin32, mexwin64, mexglx, mexa64, mexmac,
|
||||
# mexmaci, mexmaci64, mexsol, mexs64
|
||||
# MATLAB_ARCH: The installation architecture. It is **usually**
|
||||
# the MEXEXT with the preceding "mex" removed,
|
||||
# though it's different for linux distros.
|
||||
#
|
||||
# There doesn't appear to be an elegant way to detect all versions of Matlab
|
||||
# across different platforms. If you know the matlab path and want to avoid
|
||||
# the search, you can define the path to the Matlab root when invoking cmake:
|
||||
#
|
||||
# cmake -DMATLAB_ROOT_DIR='/PATH/TO/ROOT_DIR' ..
|
||||
|
||||
|
||||
|
||||
# ----- set_library_presuffix -----
|
||||
#
|
||||
# Matlab tends to use some non-standard prefixes and suffixes on its libraries.
|
||||
# For example, libmx.dll on Windows (Windows does not add prefixes) and
|
||||
# mkl.dylib on OS X (OS X uses "lib" prefixes).
|
||||
# On some versions of Windows the .dll suffix also appears to not be checked.
|
||||
#
|
||||
# This function modifies the library prefixes and suffixes used by
|
||||
# find_library when finding Matlab libraries. It does not affect scopes
|
||||
# outside of this file.
|
||||
function(set_libarch_prefix_suffix)
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
|
||||
elseif (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
|
||||
elseif (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----- locate_matlab_root -----
|
||||
#
|
||||
# Attempt to find the path to the Matlab installation. If successful, sets
|
||||
# the absolute path in the variable MATLAB_ROOT_DIR
|
||||
function(locate_matlab_root)
|
||||
|
||||
# --- UNIX/APPLE ---
|
||||
if (UNIX)
|
||||
# possible root locations, in order of likelihood
|
||||
set(SEARCH_DIRS_ /Applications /usr/local /opt/local /usr /opt)
|
||||
foreach (DIR_ ${SEARCH_DIRS_})
|
||||
file(GLOB MATLAB_ROOT_DIR_ ${DIR_}/MATLAB/R* ${DIR_}/MATLAB_R*)
|
||||
if (MATLAB_ROOT_DIR_)
|
||||
# sort in order from highest to lowest
|
||||
# normally it's in the format MATLAB_R[20XX][A/B]
|
||||
# TODO: numerical rather than lexicographic sort. However,
|
||||
# CMake does not support floating-point MATH(EXPR ...) at this time.
|
||||
list(SORT MATLAB_ROOT_DIR_)
|
||||
list(REVERSE MATLAB_ROOT_DIR_)
|
||||
list(GET MATLAB_ROOT_DIR_ 0 MATLAB_ROOT_DIR_)
|
||||
set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# --- WINDOWS ---
|
||||
elseif (WIN32)
|
||||
# 1. search the path environment variable
|
||||
find_program(MATLAB_ROOT_DIR_ matlab PATHS ENV PATH)
|
||||
if (MATLAB_ROOT_DIR_)
|
||||
# get the root directory from the full path
|
||||
# /path/to/matlab/rootdir/bin/matlab.exe
|
||||
get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
|
||||
get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
|
||||
set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# 2. search the registry
|
||||
# determine the available Matlab versions
|
||||
set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
|
||||
set(REG_ROOTS_ "HKEY_LOCAL_MACHINE" "HKEY_CURRENT_USER")
|
||||
foreach(REG_ROOT_ ${REG_ROOTS_})
|
||||
execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_ ERROR_VARIABLE UNUSED_)
|
||||
if (QUERY_RESPONSE_)
|
||||
string(REGEX MATCHALL "[0-9]\\.[0-9]" VERSION_STRINGS_ ${QUERY_RESPONSE_})
|
||||
list(APPEND VERSIONS_ ${VERSION_STRINGS_})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# select the highest version
|
||||
list(APPEND VERSIONS_ "0.0")
|
||||
list(SORT VERSIONS_)
|
||||
list(REVERSE VERSIONS_)
|
||||
list(GET VERSIONS_ 0 VERSION_)
|
||||
|
||||
# request the MATLABROOT from the registry
|
||||
foreach(REG_ROOT_ ${REG_ROOTS_})
|
||||
get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
|
||||
if (NOT ${QUERY_RESPONSE_} MATCHES "registry$")
|
||||
set(MATLAB_ROOT_DIR ${QUERY_RESPONSE_} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----- locate_matlab_components -----
|
||||
#
|
||||
# Given a directory MATLAB_ROOT_DIR, attempt to find the Matlab components
|
||||
# (include directory and libraries) under the root. If everything is found,
|
||||
# sets the variable MATLAB_FOUND to TRUE
|
||||
function(locate_matlab_components MATLAB_ROOT_DIR)
|
||||
# get the mex extension
|
||||
find_file(MATLAB_MEXEXT_SCRIPT_ NAMES mexext mexext.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
execute_process(COMMAND ${MATLAB_MEXEXT_SCRIPT_}
|
||||
OUTPUT_VARIABLE MATLAB_MEXEXT_
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (NOT MATLAB_MEXEXT_)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# map the mexext to an architecture extension
|
||||
set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" )
|
||||
foreach(ARCHITECTURE_ ${ARCHITECTURES_})
|
||||
if(EXISTS ${MATLAB_ROOT_DIR}/bin/${ARCHITECTURE_})
|
||||
set(MATLAB_ARCH_ ${ARCHITECTURE_})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# get the path to the libraries
|
||||
set(MATLAB_LIBRARY_DIRS_ ${MATLAB_ROOT_DIR}/bin/${MATLAB_ARCH_})
|
||||
|
||||
# get the libraries
|
||||
set_libarch_prefix_suffix()
|
||||
find_library(MATLAB_LIB_MX_ mx PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
find_library(MATLAB_LIB_MEX_ mex PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
find_library(MATLAB_LIB_MAT_ mat PATHS ${MATLAB_LIBRARY_DIRS_} NO_DEFAULT_PATH)
|
||||
set(MATLAB_LIBRARIES_ ${MATLAB_LIB_MX_} ${MATLAB_LIB_MEX_} ${MATLAB_LIB_MAT_})
|
||||
|
||||
# get the include path
|
||||
find_path(MATLAB_INCLUDE_DIRS_ mex.h ${MATLAB_ROOT_DIR}/extern/include)
|
||||
|
||||
# get the mex shell script
|
||||
find_program(MATLAB_MEX_SCRIPT_ NAMES mex mex.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
|
||||
# get the Matlab executable
|
||||
find_program(MATLAB_BIN_ NAMES matlab PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
|
||||
|
||||
# export into parent scope
|
||||
if (MATLAB_MEX_SCRIPT_ AND MATLAB_LIBRARIES_ AND MATLAB_INCLUDE_DIRS_)
|
||||
set(MATLAB_BIN ${MATLAB_BIN_} PARENT_SCOPE)
|
||||
set(MATLAB_MEX_SCRIPT ${MATLAB_MEX_SCRIPT_} PARENT_SCOPE)
|
||||
set(MATLAB_INCLUDE_DIRS ${MATLAB_INCLUDE_DIRS_} PARENT_SCOPE)
|
||||
set(MATLAB_LIBRARIES ${MATLAB_LIBRARIES_} PARENT_SCOPE)
|
||||
set(MATLAB_LIBRARY_DIRS ${MATLAB_LIBRARY_DIRS_} PARENT_SCOPE)
|
||||
set(MATLAB_MEXEXT ${MATLAB_MEXEXT_} PARENT_SCOPE)
|
||||
set(MATLAB_ARCH ${MATLAB_ARCH_} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# FIND MATLAB COMPONENTS
|
||||
# ----------------------------------------------------------------------------
|
||||
if (NOT MATLAB_FOUND)
|
||||
|
||||
# attempt to find the Matlab root folder
|
||||
if (NOT MATLAB_ROOT_DIR)
|
||||
locate_matlab_root()
|
||||
endif()
|
||||
|
||||
# given the matlab root folder, find the library locations
|
||||
if (MATLAB_ROOT_DIR)
|
||||
locate_matlab_components(${MATLAB_ROOT_DIR})
|
||||
endif()
|
||||
find_package_handle_standard_args(Matlab DEFAULT_MSG
|
||||
MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS
|
||||
MATLAB_ROOT_DIR MATLAB_LIBRARIES
|
||||
MATLAB_LIBRARY_DIRS MATLAB_MEXEXT
|
||||
MATLAB_ARCH MATLAB_BIN)
|
||||
endif()
|
||||
@@ -50,7 +50,8 @@ else()
|
||||
add_library(libprotobuf UNKNOWN IMPORTED)
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
IMPORTED_LOCATION "${Protobuf_LIBRARY}"
|
||||
INTERFACE_INCLUDE_SYSTEM_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
)
|
||||
get_protobuf_version(Protobuf_VERSION "${Protobuf_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
@@ -12,7 +12,9 @@ endif()
|
||||
|
||||
if(VA_INCLUDE_DIR)
|
||||
set(HAVE_VA TRUE)
|
||||
set(VA_LIBRARIES "-lva" "-lva-drm")
|
||||
if(NOT DEFINED VA_LIBRARIES)
|
||||
set(VA_LIBRARIES "va" "va-drm")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_VA FALSE)
|
||||
message(WARNING "libva installation is not found.")
|
||||
|
||||
@@ -1,30 +1,16 @@
|
||||
# Main variables:
|
||||
# VA_INTEL_MSDK_INCLUDE_DIR and VA_INTEL_IOCL_INCLUDE_DIR to use VA_INTEL
|
||||
# VA_INTEL_IOCL_INCLUDE_DIR to use VA_INTEL
|
||||
# HAVE_VA_INTEL for conditional compilation OpenCV with/without VA_INTEL
|
||||
|
||||
# VA_INTEL_MSDK_ROOT - root of Intel MSDK installation
|
||||
# VA_INTEL_IOCL_ROOT - root of Intel OCL installation
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
if($ENV{VA_INTEL_MSDK_ROOT})
|
||||
set(VA_INTEL_MSDK_ROOT $ENV{VA_INTEL_MSDK_ROOT})
|
||||
else()
|
||||
set(VA_INTEL_MSDK_ROOT "/opt/intel/mediasdk")
|
||||
endif()
|
||||
|
||||
if($ENV{VA_INTEL_IOCL_ROOT})
|
||||
set(VA_INTEL_IOCL_ROOT $ENV{VA_INTEL_IOCL_ROOT})
|
||||
else()
|
||||
set(VA_INTEL_IOCL_ROOT "/opt/intel/opencl")
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
VA_INTEL_MSDK_INCLUDE_DIR
|
||||
NAMES mfxdefs.h
|
||||
PATHS ${VA_INTEL_MSDK_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel MSDK headers")
|
||||
|
||||
find_path(
|
||||
VA_INTEL_IOCL_INCLUDE_DIR
|
||||
NAMES CL/va_ext.h
|
||||
@@ -33,12 +19,14 @@ if(UNIX AND NOT ANDROID)
|
||||
DOC "Path to Intel OpenCL headers")
|
||||
endif()
|
||||
|
||||
if(VA_INTEL_MSDK_INCLUDE_DIR AND VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
if(VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
set(HAVE_VA_INTEL TRUE)
|
||||
set(VA_INTEL_LIBRARIES "-lva" "-lva-drm")
|
||||
if(NOT DEFINED VA_INTEL_LIBRARIES)
|
||||
set(VA_INTEL_LIBRARIES "va" "va-drm")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_VA_INTEL FALSE)
|
||||
message(WARNING "Intel MSDK & OpenCL installation is not found.")
|
||||
message(WARNING "Intel OpenCL installation is not found.")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE VA_INTEL_MSDK_INCLUDE_DIR VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
mark_as_advanced(FORCE VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
|
||||
@@ -48,7 +48,7 @@ if(ANDROID)
|
||||
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java3)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java4)
|
||||
else()
|
||||
set(OPENCV_LIBS_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
endif()
|
||||
|
||||
@@ -33,7 +33,7 @@ endif()
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\"")
|
||||
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(EXISTS "${OPENCV_MODULE_${m}_LOCATION}/include")
|
||||
@@ -68,7 +68,7 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
file(RELATIVE_PATH OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${CMAKE_INSTALL_PREFIX})
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\" \"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"")
|
||||
|
||||
if(USE_IPPICV)
|
||||
file(RELATIVE_PATH IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}" "${IPPICV_INSTALL_PATH}")
|
||||
|
||||
@@ -43,9 +43,9 @@ endmacro()
|
||||
if(NOT DEFINED CMAKE_HELPER_SCRIPT)
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
|
||||
ocv_update(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
|
||||
else()
|
||||
set(OPENCV_PC_FILE_NAME opencv.pc)
|
||||
ocv_update(OPENCV_PC_FILE_NAME opencv4.pc)
|
||||
endif()
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
set(MIN_VER_CMAKE 2.8.12.2)
|
||||
set(MIN_VER_CMAKE 3.5.1)
|
||||
set(MIN_VER_CUDA 6.5)
|
||||
set(MIN_VER_PYTHON2 2.6)
|
||||
set(MIN_VER_PYTHON3 3.2)
|
||||
|
||||
@@ -296,28 +296,29 @@ endfunction()
|
||||
# Calls 'add_subdirectory' for each location.
|
||||
# Note: both input lists should have same length.
|
||||
# Usage: _add_modules_1(<list with paths> <list with names>)
|
||||
function(_add_modules_1 paths names)
|
||||
list(LENGTH ${paths} len)
|
||||
if(len EQUAL 0)
|
||||
return()
|
||||
macro(_add_modules_1 paths names)
|
||||
ocv_debug_message("_add_modules_1(paths=${paths}, names=${names}, ... " ${ARGN} ")")
|
||||
list(LENGTH ${paths} __len)
|
||||
if(NOT __len EQUAL 0)
|
||||
list(LENGTH ${names} __len_verify)
|
||||
if(NOT __len EQUAL __len_verify)
|
||||
message(FATAL_ERROR "Bad configuration! ${__len} != ${__len_verify}")
|
||||
endif()
|
||||
math(EXPR __len "${__len} - 1")
|
||||
foreach(i RANGE ${__len})
|
||||
list(GET ${paths} ${i} __path)
|
||||
list(GET ${names} ${i} __name)
|
||||
#message(STATUS "First pass: ${__name} => ${__path}")
|
||||
include("${__path}/cmake/init.cmake" OPTIONAL)
|
||||
add_subdirectory("${__path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${__name}")
|
||||
endforeach()
|
||||
endif()
|
||||
list(LENGTH ${names} len_verify)
|
||||
if(NOT len EQUAL len_verify)
|
||||
message(FATAL_ERROR "Bad configuration! ${len} != ${len_verify}")
|
||||
endif()
|
||||
math(EXPR len "${len} - 1")
|
||||
foreach(i RANGE ${len})
|
||||
list(GET ${paths} ${i} path)
|
||||
list(GET ${names} ${i} name)
|
||||
#message(STATUS "First pass: ${name} => ${path}")
|
||||
include("${path}/cmake/init.cmake" OPTIONAL)
|
||||
add_subdirectory("${path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${name}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
# Calls 'add_subdirectory' for each module name.
|
||||
# Usage: _add_modules_2([<module> ...])
|
||||
function(_add_modules_2)
|
||||
macro(_add_modules_2)
|
||||
ocv_debug_message("_add_modules_2(" ${ARGN} ")")
|
||||
foreach(m ${ARGN})
|
||||
set(the_module "${m}")
|
||||
ocv_cmake_hook(PRE_MODULES_CREATE_${the_module})
|
||||
@@ -333,7 +334,8 @@ function(_add_modules_2)
|
||||
endif()
|
||||
ocv_cmake_hook(POST_MODULES_CREATE_${the_module})
|
||||
endforeach()
|
||||
endfunction()
|
||||
unset(the_module)
|
||||
endmacro()
|
||||
|
||||
# Check if list of input items is unique.
|
||||
# Usage: _assert_uniqueness(<failure message> <element> [<element> ...])
|
||||
@@ -1132,9 +1134,14 @@ function(ocv_add_perf_tests)
|
||||
source_group("Src" FILES "${${the_target}_pch}")
|
||||
ocv_add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
ocv_target_include_modules(${the_target} ${perf_deps} "${perf_path}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${perf_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS})
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${perf_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_PERF_${the_module}_DEPS})
|
||||
add_dependencies(opencv_perf_tests ${the_target})
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE "${HPX_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};PerfTest")
|
||||
set_source_files_properties(${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch}
|
||||
PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};PerfTest")
|
||||
@@ -1175,7 +1182,7 @@ function(ocv_add_perf_tests)
|
||||
endfunction()
|
||||
|
||||
# this is a command for adding OpenCV accuracy/regression tests to the module
|
||||
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>)
|
||||
# ocv_add_accuracy_tests(<list of extra dependencies>)
|
||||
function(ocv_add_accuracy_tests)
|
||||
ocv_debug_message("ocv_add_accuracy_tests(" ${ARGN} ")")
|
||||
|
||||
@@ -1202,6 +1209,9 @@ function(ocv_add_accuracy_tests)
|
||||
set(OPENCV_TEST_${the_module}_SOURCES ${test_srcs} ${test_hdrs})
|
||||
endif()
|
||||
|
||||
if(OPENCV_MODULE_${the_module}_TEST_SOURCES_DISPATCHED)
|
||||
list(APPEND OPENCV_TEST_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_TEST_SOURCES_DISPATCHED})
|
||||
endif()
|
||||
ocv_compiler_optimization_process_sources(OPENCV_TEST_${the_module}_SOURCES OPENCV_TEST_${the_module}_DEPS ${the_target})
|
||||
|
||||
if(NOT BUILD_opencv_world)
|
||||
@@ -1211,9 +1221,17 @@ function(ocv_add_accuracy_tests)
|
||||
source_group("Src" FILES "${${the_target}_pch}")
|
||||
ocv_add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
ocv_target_include_modules(${the_target} ${test_deps} "${test_path}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${test_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS})
|
||||
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/test")
|
||||
ocv_target_include_directories(${the_target} "${CMAKE_CURRENT_BINARY_DIR}/test")
|
||||
endif()
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${test_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_TEST_${the_module}_DEPS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE "${HPX_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};AccuracyTest")
|
||||
set_source_files_properties(${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch}
|
||||
PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};AccuracyTest")
|
||||
|
||||
@@ -362,7 +362,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
#also include ${oldProps} to have the same compile options
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
if (oldProps MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
|
||||
@@ -121,8 +121,10 @@ macro(ocv_assert)
|
||||
endmacro()
|
||||
|
||||
macro(ocv_debug_message)
|
||||
# string(REPLACE ";" " " __msg "${ARGN}")
|
||||
# message(STATUS "${__msg}")
|
||||
if(OPENCV_CMAKE_DEBUG_MESSAGES)
|
||||
string(REPLACE ";" " " __msg "${ARGN}")
|
||||
message(STATUS "${__msg}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_check_environment_variables)
|
||||
@@ -259,7 +261,7 @@ function(ocv_include_directories)
|
||||
ocv_is_opencv_directory(__is_opencv_dir "${dir}")
|
||||
if(__is_opencv_dir)
|
||||
list(APPEND __add_before "${dir}")
|
||||
elseif(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
elseif(((CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0") OR CV_CLANG) AND
|
||||
dir MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
@@ -1087,7 +1089,7 @@ function(ocv_install_3rdparty_licenses library)
|
||||
get_filename_component(name "${filename}" NAME)
|
||||
install(
|
||||
FILES "${filename}"
|
||||
DESTINATION "${OPENCV_OTHER_INSTALL_PATH}/licenses"
|
||||
DESTINATION "${OPENCV_LICENSES_INSTALL_PATH}"
|
||||
COMPONENT licenses
|
||||
RENAME "${library}-${name}"
|
||||
OPTIONAL)
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream arch;
|
||||
std::list<std::string> archs;
|
||||
|
||||
int count = 0;
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)){return -1;}
|
||||
if (count == 0) {return -1;}
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)){ return -1; }
|
||||
if (count == 0) { return -1; }
|
||||
for (int device = 0; device < count; ++device)
|
||||
{
|
||||
cudaDeviceProp prop;
|
||||
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue;}
|
||||
printf("%d.%d ", prop.major, prop.minor);
|
||||
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue; }
|
||||
arch << prop.major << "." << prop.minor;
|
||||
archs.push_back(arch.str());
|
||||
arch.str("");
|
||||
}
|
||||
archs.unique(); #Some devices might have the same arch
|
||||
for (std::list<std::string>::iterator it=archs.begin(); it!=archs.end(); ++it)
|
||||
std::cout << *it << " ";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTransform.h>
|
||||
#include <vtkMath.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
|
||||
return 0;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ endif()
|
||||
set(OpenCV_LIBRARIES ${OpenCV_LIBS})
|
||||
|
||||
#
|
||||
# Some macroses for samples
|
||||
# Some macros for samples
|
||||
#
|
||||
macro(ocv_check_dependencies)
|
||||
set(OCV_DEPENDENCIES_FOUND TRUE)
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
/* Cocoa API */
|
||||
#cmakedefine HAVE_COCOA
|
||||
|
||||
/* C= */
|
||||
#cmakedefine HAVE_CSTRIPES
|
||||
|
||||
/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/
|
||||
#cmakedefine HAVE_CUBLAS
|
||||
|
||||
@@ -106,9 +103,6 @@
|
||||
#cmakedefine HAVE_IPP_ICV
|
||||
#cmakedefine HAVE_IPP_IW
|
||||
|
||||
/* Intel IPP Async */
|
||||
#cmakedefine HAVE_IPP_A
|
||||
|
||||
/* JPEG-2000 codec */
|
||||
#cmakedefine HAVE_JASPER
|
||||
|
||||
@@ -150,6 +144,9 @@
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI2
|
||||
|
||||
/* librealsense library */
|
||||
#cmakedefine HAVE_LIBREALSENSE
|
||||
|
||||
/* PNG codec */
|
||||
#cmakedefine HAVE_PNG
|
||||
|
||||
@@ -174,6 +171,9 @@
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
/* Ste||ar Group High Performance ParallelX */
|
||||
#cmakedefine HAVE_HPX
|
||||
|
||||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
|
||||
@@ -227,7 +227,6 @@ SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = __cplusplus=1 \
|
||||
HAVE_IPP_A=1 \
|
||||
CVAPI(x)=x \
|
||||
CV_DOXYGEN= \
|
||||
CV_EXPORTS= \
|
||||
@@ -241,6 +240,9 @@ PREDEFINED = __cplusplus=1 \
|
||||
CV_PROP_RW= \
|
||||
CV_WRAP= \
|
||||
CV_WRAP_AS(x)= \
|
||||
CV_WRAP_MAPPABLE(x)= \
|
||||
CV_WRAP_PHANTOM(x)= \
|
||||
CV_WRAP_DEFAULT(x)= \
|
||||
CV_CDECL= \
|
||||
CV_Func = \
|
||||
CV_DO_PRAGMA(x)= \
|
||||
|
||||
@@ -29,7 +29,7 @@ What happens in background ?
|
||||
objects). Everything inside rectangle is unknown. Similarly any user input specifying
|
||||
foreground and background are considered as hard-labelling which means they won't change in
|
||||
the process.
|
||||
- Computer does an initial labelling depeding on the data we gave. It labels the foreground and
|
||||
- Computer does an initial labelling depending on the data we gave. It labels the foreground and
|
||||
background pixels (or it hard-labels)
|
||||
- Now a Gaussian Mixture Model(GMM) is used to model the foreground and background.
|
||||
- Depending on the data we gave, GMM learns and create new pixel distribution. That is, the
|
||||
|
||||
@@ -129,7 +129,7 @@ function onOpenCvReady() {
|
||||
</html>
|
||||
@endcode
|
||||
|
||||
@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memeory management of Emscripten](https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details.
|
||||
@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memory management of Emscripten](https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details.
|
||||
|
||||
Try it
|
||||
------
|
||||
|
||||
@@ -1016,3 +1016,56 @@
|
||||
year = {2017},
|
||||
organization = {IEEE}
|
||||
}
|
||||
@ARTICLE{gonzalez,
|
||||
title={Digital Image Fundamentals, Digital Imaging Processing},
|
||||
author={Gonzalez, Rafael C and others},
|
||||
year={1987},
|
||||
publisher={Addison Wesley Publishing Company}
|
||||
}
|
||||
@ARTICLE{gruzman,
|
||||
title={Цифровая обработка изображений в информационных системах},
|
||||
author={Грузман, И.С. and Киричук, В.С. and Косых, В.П. and Перетягин, Г.И. and Спектор, А.А.},
|
||||
year={2000},
|
||||
publisher={Изд-во НГТУ Новосибирск}
|
||||
}
|
||||
@INPROCEEDINGS{duda2018,
|
||||
title = {Accurate Detection and Localization of Checkerboard Corners for Calibration},
|
||||
year = {2018},
|
||||
booktitle = {29th British Machine Vision Conference. British Machine Vision Conference (BMVC-29), September 3-6, Newcastle, United Kingdom},
|
||||
publisher = {BMVA Press},
|
||||
author = {Alexander Duda and Udo Frese},
|
||||
}
|
||||
|
||||
@book{jahne2000computer,
|
||||
title={Computer vision and applications: a guide for students and practitioners},
|
||||
author={Jahne, Bernd},
|
||||
year={2000},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@book{bigun2006vision,
|
||||
title={Vision with direction},
|
||||
author={Bigun, Josef},
|
||||
year={2006},
|
||||
publisher={Springer}
|
||||
}
|
||||
|
||||
@inproceedings{van1995estimators,
|
||||
title={Estimators for orientation and anisotropy in digitized images},
|
||||
author={Van Vliet, Lucas J and Verbeek, Piet W},
|
||||
booktitle={ASCI},
|
||||
volume={95},
|
||||
pages={16--18},
|
||||
year={1995}
|
||||
}
|
||||
|
||||
@article{yang1996structure,
|
||||
title={Structure adaptive anisotropic image filtering},
|
||||
author={Yang, Guang-Zhong and Burger, Peter and Firmin, David N and Underwood, SR},
|
||||
journal={Image and Vision Computing},
|
||||
volume={14},
|
||||
number={2},
|
||||
pages={135--145},
|
||||
year={1996},
|
||||
publisher={Elsevier}
|
||||
}
|
||||
|
||||
@@ -20,20 +20,20 @@ A simple example on extending C++ functions to Python can be found in official P
|
||||
documentation[1]. So extending all functions in OpenCV to Python by writing their wrapper functions
|
||||
manually is a time-consuming task. So OpenCV does it in a more intelligent way. OpenCV generates
|
||||
these wrapper functions automatically from the C++ headers using some Python scripts which are
|
||||
located in modules/python/src2. We will look into what they do.
|
||||
located in `modules/python/src2`. We will look into what they do.
|
||||
|
||||
First, modules/python/CMakeFiles.txt is a CMake script which checks the modules to be extended to
|
||||
First, `modules/python/CMakeFiles.txt` is a CMake script which checks the modules to be extended to
|
||||
Python. It will automatically check all the modules to be extended and grab their header files.
|
||||
These header files contain list of all classes, functions, constants etc. for that particular
|
||||
modules.
|
||||
|
||||
Second, these header files are passed to a Python script, modules/python/src2/gen2.py. This is the
|
||||
Python bindings generator script. It calls another Python script modules/python/src2/hdr_parser.py.
|
||||
Second, these header files are passed to a Python script, `modules/python/src2/gen2.py`. This is the
|
||||
Python bindings generator script. It calls another Python script `modules/python/src2/hdr_parser.py`.
|
||||
This is the header parser script. This header parser splits the complete header file into small
|
||||
Python lists. So these lists contain all details about a particular function, class etc. For
|
||||
example, a function will be parsed to get a list containing function name, return type, input
|
||||
arguments, argument types etc. Final list contains details of all the functions, structs, classes
|
||||
etc. in that header file.
|
||||
arguments, argument types etc. Final list contains details of all the functions, enums, structs,
|
||||
classes etc. in that header file.
|
||||
|
||||
But header parser doesn't parse all the functions/classes in the header file. The developer has to
|
||||
specify which functions should be exported to Python. For that, there are certain macros added to
|
||||
@@ -44,15 +44,15 @@ macros will be given in next session.
|
||||
|
||||
So header parser returns a final big list of parsed functions. Our generator script (gen2.py) will
|
||||
create wrapper functions for all the functions/classes/enums/structs parsed by header parser (You
|
||||
can find these header files during compilation in the build/modules/python/ folder as
|
||||
can find these header files during compilation in the `build/modules/python/` folder as
|
||||
pyopencv_generated_\*.h files). But there may be some basic OpenCV datatypes like Mat, Vec4i,
|
||||
Size. They need to be extended manually. For example, a Mat type should be extended to Numpy array,
|
||||
Size should be extended to a tuple of two integers etc. Similarly, there may be some complex
|
||||
structs/classes/functions etc. which need to be extended manually. All such manual wrapper functions
|
||||
are placed in modules/python/src2/cv2.cpp.
|
||||
are placed in `modules/python/src2/cv2.cpp`.
|
||||
|
||||
So now only thing left is the compilation of these wrapper files which gives us **cv2** module. So
|
||||
when you call a function, say res = equalizeHist(img1,img2) in Python, you pass two numpy arrays and
|
||||
when you call a function, say `res = equalizeHist(img1,img2)` in Python, you pass two numpy arrays and
|
||||
you expect another numpy array as the output. So these numpy arrays are converted to cv::Mat and
|
||||
then calls the equalizeHist() function in C++. Final result, res will be converted back into a Numpy
|
||||
array. So in short, almost all operations are done in C++ which gives us almost same speed as that
|
||||
@@ -67,19 +67,19 @@ Header parser parse the header files based on some wrapper macros added to funct
|
||||
Enumeration constants don't need any wrapper macros. They are automatically wrapped. But remaining
|
||||
functions, classes etc. need wrapper macros.
|
||||
|
||||
Functions are extended using CV_EXPORTS_W macro. An example is shown below.
|
||||
Functions are extended using `CV_EXPORTS_W` macro. An example is shown below.
|
||||
@code{.cpp}
|
||||
CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
|
||||
@endcode
|
||||
Header parser can understand the input and output arguments from keywords like
|
||||
InputArray, OutputArray etc. But sometimes, we may need to hardcode inputs and outputs. For that,
|
||||
macros like CV_OUT, CV_IN_OUT etc. are used.
|
||||
macros like `CV_OUT`, `CV_IN_OUT` etc. are used.
|
||||
@code{.cpp}
|
||||
CV_EXPORTS_W void minEnclosingCircle( InputArray points,
|
||||
CV_OUT Point2f& center, CV_OUT float& radius );
|
||||
@endcode
|
||||
For large classes also, CV_EXPORTS_W is used. To extend class methods, CV_WRAP is used.
|
||||
Similarly, CV_PROP is used for class fields.
|
||||
For large classes also, `CV_EXPORTS_W` is used. To extend class methods, `CV_WRAP` is used.
|
||||
Similarly, `CV_PROP` is used for class fields.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W CLAHE : public Algorithm
|
||||
{
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
CV_WRAP virtual double getClipLimit() const = 0;
|
||||
}
|
||||
@endcode
|
||||
Overloaded functions can be extended using CV_EXPORTS_AS. But we need to pass a new name so that
|
||||
Overloaded functions can be extended using `CV_EXPORTS_AS`. But we need to pass a new name so that
|
||||
each function will be called by that name in Python. Take the case of integral function below. Three
|
||||
functions are available, so each one is named with a suffix in Python. Similarly CV_WRAP_AS can be
|
||||
functions are available, so each one is named with a suffix in Python. Similarly `CV_WRAP_AS` can be
|
||||
used to wrap overloaded methods.
|
||||
@code{.cpp}
|
||||
//! computes the integral image
|
||||
@@ -107,9 +107,9 @@ CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
|
||||
OutputArray sqsum, OutputArray tilted,
|
||||
int sdepth = -1, int sqdepth = -1 );
|
||||
@endcode
|
||||
Small classes/structs are extended using CV_EXPORTS_W_SIMPLE. These structs are passed by value
|
||||
to C++ functions. Examples are KeyPoint, Match etc. Their methods are extended by CV_WRAP and
|
||||
fields are extended by CV_PROP_RW.
|
||||
Small classes/structs are extended using `CV_EXPORTS_W_SIMPLE`. These structs are passed by value
|
||||
to C++ functions. Examples are `KeyPoint`, `Match` etc. Their methods are extended by `CV_WRAP` and
|
||||
fields are extended by `CV_PROP_RW`.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W_SIMPLE DMatch
|
||||
{
|
||||
@@ -125,8 +125,8 @@ public:
|
||||
CV_PROP_RW float distance;
|
||||
};
|
||||
@endcode
|
||||
Some other small classes/structs can be exported using CV_EXPORTS_W_MAP where it is exported to a
|
||||
Python native dictionary. Moments() is an example of it.
|
||||
Some other small classes/structs can be exported using `CV_EXPORTS_W_MAP` where it is exported to a
|
||||
Python native dictionary. `Moments()` is an example of it.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W_MAP Moments
|
||||
{
|
||||
@@ -142,6 +142,41 @@ public:
|
||||
So these are the major extension macros available in OpenCV. Typically, a developer has to put
|
||||
proper macros in their appropriate positions. Rest is done by generator scripts. Sometimes, there
|
||||
may be an exceptional cases where generator scripts cannot create the wrappers. Such functions need
|
||||
to be handled manually, to do this write your own pyopencv_*.hpp extending headers and put them into
|
||||
to be handled manually, to do this write your own `pyopencv_*.hpp` extending headers and put them into
|
||||
misc/python subdirectory of your module. But most of the time, a code written according to OpenCV
|
||||
coding guidelines will be automatically wrapped by generator scripts.
|
||||
coding guidelines will be automatically wrapped by generator scripts.
|
||||
|
||||
More advanced cases involves providing Python with additional features that does not exist
|
||||
in the C++ interface such as extra methods, type mappings, or to provide default arguments.
|
||||
We will take `UMat` datatype as an example of such cases later on.
|
||||
First, to provide Python-specific methods, `CV_WRAP_PHANTOM` is utilized in a similar manner to
|
||||
`CV_WRAP`, except that it takes the method header as its argument, and you would need to provide
|
||||
the method body in your own `pyopencv_*.hpp` extension. `UMat::queue()` and `UMat::context()` are
|
||||
an example of such phantom methods that does not exist in C++ interface, but are needed to handle
|
||||
OpenCL functionalities at the Python side.
|
||||
Second, if an already-existing datatype(s) is mappable to your class, it is highly preferable to
|
||||
indicate such capacity using `CV_WRAP_MAPPABLE` with the source type as its argument,
|
||||
rather than crafting your own binding function(s). This is the case of `UMat` which maps from `Mat`.
|
||||
Finally, if a default argument is needed, but it is not provided in the native C++ interface,
|
||||
you can provide it for Python side as the argument of `CV_WRAP_DEFAULT`. As per the `UMat::getMat`
|
||||
example below:
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W UMat
|
||||
{
|
||||
public:
|
||||
//! Mat is mappable to UMat.
|
||||
// You would need to provide `static bool cv_mappable_to(const Ptr<Mat>& src, Ptr<UMat>& dst)`
|
||||
CV_WRAP_MAPPABLE(Ptr<Mat>);
|
||||
|
||||
/! returns the OpenCL queue used by OpenCV UMat.
|
||||
// You would need to provide the method body in the binder code
|
||||
CV_WRAP_PHANTOM(static void* queue());
|
||||
|
||||
//! returns the OpenCL context used by OpenCV UMat
|
||||
// You would need to provide the method body in the binder code
|
||||
CV_WRAP_PHANTOM(static void* context());
|
||||
|
||||
//! The wrapped method become equvalent to `get(int flags = ACCESS_RW)`
|
||||
CV_WRAP_AS(get) Mat getMat(int flags CV_WRAP_DEFAULT(ACCESS_RW)) const;
|
||||
};
|
||||
@endcode
|
||||
|
||||
@@ -153,15 +153,15 @@ padding etc. This function takes following arguments:
|
||||
|
||||
- **borderType** - Flag defining what kind of border to be added. It can be following types:
|
||||
- **cv.BORDER_CONSTANT** - Adds a constant colored border. The value should be given
|
||||
as next argument.
|
||||
- **cv.BORDER_REFLECT** - Border will be mirror reflection of the border elements,
|
||||
like this : *fedcba|abcdefgh|hgfedcb*
|
||||
- **cv.BORDER_REFLECT_101** or **cv.BORDER_DEFAULT** - Same as above, but with a
|
||||
slight change, like this : *gfedcb|abcdefgh|gfedcba*
|
||||
- **cv.BORDER_REPLICATE** - Last element is replicated throughout, like this:
|
||||
*aaaaaa|abcdefgh|hhhhhhh*
|
||||
- **cv.BORDER_WRAP** - Can't explain, it will look like this :
|
||||
*cdefgh|abcdefgh|abcdefg*
|
||||
as next argument.
|
||||
- **cv.BORDER_REFLECT** - Border will be mirror reflection of the border elements,
|
||||
like this : *fedcba|abcdefgh|hgfedcb*
|
||||
- **cv.BORDER_REFLECT_101** or **cv.BORDER_DEFAULT** - Same as above, but with a
|
||||
slight change, like this : *gfedcb|abcdefgh|gfedcba*
|
||||
- **cv.BORDER_REPLICATE** - Last element is replicated throughout, like this:
|
||||
*aaaaaa|abcdefgh|hhhhhhh*
|
||||
- **cv.BORDER_WRAP** - Can't explain, it will look like this :
|
||||
*cdefgh|abcdefgh|abcdefg*
|
||||
|
||||
- **value** - Color of border if border type is cv.BORDER_CONSTANT
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ cv.namedWindow('image')
|
||||
|
||||
# create trackbars for color change
|
||||
cv.createTrackbar('R','image',0,255,nothing)
|
||||
|
||||
cv.createTrackbar('G','image',0,255,nothing)
|
||||
cv.createTrackbar('B','image',0,255,nothing)
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ So what happens in background ?
|
||||
objects). Everything inside rectangle is unknown. Similarly any user input specifying
|
||||
foreground and background are considered as hard-labelling which means they won't change in
|
||||
the process.
|
||||
- Computer does an initial labelling depeding on the data we gave. It labels the foreground and
|
||||
- Computer does an initial labelling depending on the data we gave. It labels the foreground and
|
||||
background pixels (or it hard-labels)
|
||||
- Now a Gaussian Mixture Model(GMM) is used to model the foreground and background.
|
||||
- Depending on the data we gave, GMM learns and create new pixel distribution. That is, the
|
||||
|
||||
@@ -36,7 +36,7 @@ gives us a feature vector containing 64 values. This is the feature vector we us
|
||||
|
||||
Finally, as in the previous case, we start by splitting our big dataset into individual cells. For
|
||||
every digit, 250 cells are reserved for training data and remaining 250 data is reserved for
|
||||
testing. Full code is given below, you also can download it from [here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py):
|
||||
testing. Full code is given below, you also can download it from [here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py):
|
||||
|
||||
@include samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py
|
||||
|
||||
|
||||
@@ -77,13 +77,13 @@ Source code
|
||||
|
||||
You may also find the source code in the `samples/cpp/tutorial_code/calib3d/camera_calibration/`
|
||||
folder of the OpenCV source library or [download it from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp). The program has a
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp). The program has a
|
||||
single argument: the name of its configuration file. If none is given then it will try to open the
|
||||
one named "default.xml". [Here's a sample configuration file
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml) in XML format. In the
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml) in XML format. In the
|
||||
configuration file you may choose to use camera as an input, a video file or an image list. If you
|
||||
opt for the last one, you will need to create a configuration file where you enumerate the images to
|
||||
use. Here's [an example of this ](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml).
|
||||
use. Here's [an example of this ](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml).
|
||||
The important part to remember is that the images need to be specified using the absolute path or
|
||||
the relative one from your application's working directory. You may find all this in the samples
|
||||
directory mentioned above.
|
||||
|
||||
@@ -16,7 +16,7 @@ In this tutorial is explained how to build a real time application to estimate t
|
||||
order to track a textured object with six degrees of freedom given a 2D image and its 3D textured
|
||||
model.
|
||||
|
||||
The application will have the followings parts:
|
||||
The application will have the following parts:
|
||||
|
||||
- Read 3D textured object model and object mesh.
|
||||
- Take input from Camera or Video.
|
||||
@@ -426,16 +426,16 @@ Here is explained in detail the code for the real time application:
|
||||
@endcode
|
||||
OpenCV provides four PnP methods: ITERATIVE, EPNP, P3P and DLS. Depending on the application type,
|
||||
the estimation method will be different. In the case that we want to make a real time application,
|
||||
the more suitable methods are EPNP and P3P due to that are faster than ITERATIVE and DLS at
|
||||
the more suitable methods are EPNP and P3P since they are faster than ITERATIVE and DLS at
|
||||
finding an optimal solution. However, EPNP and P3P are not especially robust in front of planar
|
||||
surfaces and sometimes the pose estimation seems to have a mirror effect. Therefore, in this this
|
||||
tutorial is used ITERATIVE method due to the object to be detected has planar surfaces.
|
||||
surfaces and sometimes the pose estimation seems to have a mirror effect. Therefore, in this
|
||||
tutorial an ITERATIVE method is used due to the object to be detected has planar surfaces.
|
||||
|
||||
The OpenCV RANSAC implementation wants you to provide three parameters: the maximum number of
|
||||
iterations until stop the algorithm, the maximum allowed distance between the observed and
|
||||
computed point projections to consider it an inlier and the confidence to obtain a good result.
|
||||
The OpenCV RANSAC implementation wants you to provide three parameters: 1) the maximum number of
|
||||
iterations until the algorithm stops, 2) the maximum allowed distance between the observed and
|
||||
computed point projections to consider it an inlier and 3) the confidence to obtain a good result.
|
||||
You can tune these parameters in order to improve your algorithm performance. Increasing the
|
||||
number of iterations you will have a more accurate solution, but will take more time to find a
|
||||
number of iterations will have a more accurate solution, but will take more time to find a
|
||||
solution. Increasing the reprojection error will reduce the computation time, but your solution
|
||||
will be unaccurate. Decreasing the confidence your algorithm will be faster, but the obtained
|
||||
solution will be unaccurate.
|
||||
|
||||
@@ -33,19 +33,19 @@ Source Code
|
||||
|
||||
@add_toggle_cpp
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/AddingImages/AddingImages.cpp).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/AddingImages/AddingImages.cpp).
|
||||
@include cpp/tutorial_code/core/AddingImages/AddingImages.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/AddingImages/AddingImages.java).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/AddingImages/AddingImages.java).
|
||||
@include java/tutorial_code/core/AddingImages/AddingImages.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/AddingImages/adding_images.py).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/AddingImages/adding_images.py).
|
||||
@include python/tutorial_code/core/AddingImages/adding_images.py
|
||||
@end_toggle
|
||||
|
||||
@@ -69,7 +69,7 @@ We need two source images (\f$f_{0}(x)\f$ and \f$f_{1}(x)\f$). So, we load them
|
||||
@snippet python/tutorial_code/core/AddingImages/adding_images.py load
|
||||
@end_toggle
|
||||
|
||||
We used the following images: [LinuxLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/LinuxLogo.jpg) and [WindowsLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/WindowsLogo.jpg)
|
||||
We used the following images: [LinuxLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/LinuxLogo.jpg) and [WindowsLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/WindowsLogo.jpg)
|
||||
|
||||
@warning Since we are *adding* *src1* and *src2*, they both have to be of the same size
|
||||
(width and height) and type.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Changing the contrast and brightness of an image! {#tutorial_basic_linear_transform}
|
||||
=================================================
|
||||
|
||||
@prev_tutorial{tutorial_adding_images}
|
||||
@next_tutorial{tutorial_discrete_fourier_transform}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -53,48 +56,143 @@ Theory
|
||||
Code
|
||||
----
|
||||
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include BasicLinearTransforms.cpp
|
||||
@include samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py
|
||||
@end_toggle
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
-# We begin by creating parameters to save \f$\alpha\f$ and \f$\beta\f$ to be entered by the user:
|
||||
@snippet BasicLinearTransforms.cpp basic-linear-transform-parameters
|
||||
- We load an image using @ref cv::imread and save it in a Mat object:
|
||||
|
||||
-# We load an image using @ref cv::imread and save it in a Mat object:
|
||||
@snippet BasicLinearTransforms.cpp basic-linear-transform-load
|
||||
-# Now, since we will make some transformations to this image, we need a new Mat object to store
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp basic-linear-transform-load
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java basic-linear-transform-load
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py basic-linear-transform-load
|
||||
@end_toggle
|
||||
|
||||
- Now, since we will make some transformations to this image, we need a new Mat object to store
|
||||
it. Also, we want this to have the following features:
|
||||
|
||||
- Initial pixel values equal to zero
|
||||
- Same size and type as the original image
|
||||
@snippet BasicLinearTransforms.cpp basic-linear-transform-output
|
||||
We observe that @ref cv::Mat::zeros returns a Matlab-style zero initializer based on
|
||||
*image.size()* and *image.type()*
|
||||
|
||||
-# Now, to perform the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ we will access to each
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp basic-linear-transform-output
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java basic-linear-transform-output
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py basic-linear-transform-output
|
||||
@end_toggle
|
||||
|
||||
We observe that @ref cv::Mat::zeros returns a Matlab-style zero initializer based on
|
||||
*image.size()* and *image.type()*
|
||||
|
||||
- We ask now the values of \f$\alpha\f$ and \f$\beta\f$ to be entered by the user:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp basic-linear-transform-parameters
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java basic-linear-transform-parameters
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py basic-linear-transform-parameters
|
||||
@end_toggle
|
||||
|
||||
- Now, to perform the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ we will access to each
|
||||
pixel in image. Since we are operating with BGR images, we will have three values per pixel (B,
|
||||
G and R), so we will also access them separately. Here is the piece of code:
|
||||
@snippet BasicLinearTransforms.cpp basic-linear-transform-operation
|
||||
Notice the following:
|
||||
- To access each pixel in the images we are using this syntax: *image.at\<Vec3b\>(y,x)[c]*
|
||||
where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2).
|
||||
- Since the operation \f$\alpha \cdot p(i,j) + \beta\f$ can give values out of range or not
|
||||
integers (if \f$\alpha\f$ is float), we use cv::saturate_cast to make sure the
|
||||
values are valid.
|
||||
|
||||
-# Finally, we create windows and show the images, the usual way.
|
||||
@snippet BasicLinearTransforms.cpp basic-linear-transform-display
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp basic-linear-transform-operation
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java basic-linear-transform-operation
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py basic-linear-transform-operation
|
||||
@end_toggle
|
||||
|
||||
Notice the following (**C++ code only**):
|
||||
- To access each pixel in the images we are using this syntax: *image.at\<Vec3b\>(y,x)[c]*
|
||||
where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2).
|
||||
- Since the operation \f$\alpha \cdot p(i,j) + \beta\f$ can give values out of range or not
|
||||
integers (if \f$\alpha\f$ is float), we use cv::saturate_cast to make sure the
|
||||
values are valid.
|
||||
|
||||
- Finally, we create windows and show the images, the usual way.
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp basic-linear-transform-display
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java basic-linear-transform-display
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py basic-linear-transform-display
|
||||
@end_toggle
|
||||
|
||||
@note
|
||||
Instead of using the **for** loops to access each pixel, we could have simply used this command:
|
||||
@code{.cpp}
|
||||
image.convertTo(new_image, -1, alpha, beta);
|
||||
@endcode
|
||||
where @ref cv::Mat::convertTo would effectively perform *new_image = a*image + beta\*. However, we
|
||||
wanted to show you how to access each pixel. In any case, both methods give the same result but
|
||||
convertTo is more optimized and works a lot faster.
|
||||
|
||||
@add_toggle_cpp
|
||||
@code{.cpp}
|
||||
image.convertTo(new_image, -1, alpha, beta);
|
||||
@endcode
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@code{.java}
|
||||
image.convertTo(newImage, -1, alpha, beta);
|
||||
@endcode
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@code{.py}
|
||||
new_image = cv.convertScaleAbs(image, alpha=alpha, beta=beta)
|
||||
@endcode
|
||||
@end_toggle
|
||||
|
||||
where @ref cv::Mat::convertTo would effectively perform *new_image = a*image + beta\*. However, we
|
||||
wanted to show you how to access each pixel. In any case, both methods give the same result but
|
||||
convertTo is more optimized and works a lot faster.
|
||||
|
||||
Result
|
||||
------
|
||||
@@ -185,10 +283,31 @@ and are not intended to be used as a replacement of a raster graphics editor!**
|
||||
|
||||
### Code
|
||||
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp).
|
||||
@add_toggle_cpp
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp).
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/ChangingContrastBrightnessImageDemo.java).
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.py).
|
||||
@end_toggle
|
||||
|
||||
Code for the gamma correction:
|
||||
|
||||
@snippet changing_contrast_brightness_image.cpp changing-contrast-brightness-gamma-correction
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp changing-contrast-brightness-gamma-correction
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/ChangingContrastBrightnessImageDemo.java changing-contrast-brightness-gamma-correction
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.py changing-contrast-brightness-gamma-correction
|
||||
@end_toggle
|
||||
|
||||
A look-up table is used to improve the performance of the computation as only 256 values needs to be calculated once.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Discrete Fourier Transform {#tutorial_discrete_fourier_transform}
|
||||
==========================
|
||||
|
||||
@prev_tutorial{tutorial_random_generator_and_text}
|
||||
@prev_tutorial{tutorial_basic_linear_transform}
|
||||
@next_tutorial{tutorial_file_input_output_with_xml_yml}
|
||||
|
||||
Goal
|
||||
@@ -19,7 +19,7 @@ Source code
|
||||
|
||||
@add_toggle_cpp
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp) or
|
||||
find it in the
|
||||
`samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp` of the
|
||||
OpenCV source code library.
|
||||
@@ -27,7 +27,7 @@ OpenCV source code library.
|
||||
|
||||
@add_toggle_java
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java) or
|
||||
find it in the
|
||||
`samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java` of the
|
||||
OpenCV source code library.
|
||||
@@ -35,7 +35,7 @@ OpenCV source code library.
|
||||
|
||||
@add_toggle_python
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py) or
|
||||
find it in the
|
||||
`samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py` of the
|
||||
OpenCV source code library.
|
||||
@@ -222,7 +222,7 @@ An application idea would be to determine the geometrical orientation present in
|
||||
example, let us find out if a text is horizontal or not? Looking at some text you'll notice that the
|
||||
text lines sort of form also horizontal lines and the letters form sort of vertical lines. These two
|
||||
main components of a text snippet may be also seen in case of the Fourier transform. Let us use
|
||||
[this horizontal ](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/imageTextN.png) and [this rotated](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/imageTextR.png)
|
||||
[this horizontal ](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/imageTextN.png) and [this rotated](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/imageTextR.png)
|
||||
image about a text.
|
||||
|
||||
In case of the horizontal text:
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
File Input and Output using XML and YAML files {#tutorial_file_input_output_with_xml_yml}
|
||||
==============================================
|
||||
|
||||
@prev_tutorial{tutorial_discrete_fourier_transform}
|
||||
@next_tutorial{tutorial_interoperability_with_OpenCV_1}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -16,7 +19,7 @@ Source code
|
||||
-----------
|
||||
|
||||
You can [download this from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp) or find it in the
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp) or find it in the
|
||||
`samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp` of the OpenCV source code
|
||||
library.
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
How to scan images, lookup tables and time measurement with OpenCV {#tutorial_how_to_scan_images}
|
||||
==================================================================
|
||||
|
||||
@prev_tutorial{tutorial_mat_the_basic_image_container}
|
||||
@next_tutorial{tutorial_mat_mask_operations}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -51,7 +54,7 @@ three major ways of going through an image pixel by pixel. To make things a litt
|
||||
will make the scanning for each image using all of these methods, and print out how long it took.
|
||||
|
||||
You can download the full source code [here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp) or look it up in
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp) or look it up in
|
||||
the samples directory of OpenCV at the cpp tutorial code for the core section. Its basic usage is:
|
||||
@code{.bash}
|
||||
how_to_scan_images imageName.jpg intValueToReduce [G]
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_}
|
||||
==================================================================
|
||||
|
||||
@prev_tutorial{tutorial_interoperability_with_OpenCV_1}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
The goal of this tutorial is to show you how to use the OpenCV `parallel_for_` framework to easily
|
||||
parallelize your code. To illustrate the concept, we will write a program to draw a Mandelbrot set
|
||||
exploiting almost all the CPU load available.
|
||||
The full tutorial code is [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
The full tutorial code is [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
If you want more information about multithreading, you will have to refer to a reference book or course as this tutorial is intended
|
||||
to remain simple.
|
||||
|
||||
@@ -175,7 +177,7 @@ C++ 11 standard allows to simplify the parallel implementation by get rid of the
|
||||
Results
|
||||
-----------
|
||||
|
||||
You can find the full tutorial code [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
You can find the full tutorial code [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
The performance of the parallel implementation depends of the type of CPU you have. For instance, on 4 cores / 8 threads
|
||||
CPU, you can expect a speed-up of around 6.9X. There are many factors to explain why we do not achieve a speed-up of almost 8X.
|
||||
Main reasons should be mostly due to:
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
Intel® IPP Asynchronous C/C++ library in OpenCV {#tutorial_how_to_use_ippa_conversion}
|
||||
===============================================
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
The tutorial demonstrates the [Intel® IPP Asynchronous
|
||||
C/C++](http://software.intel.com/en-us/intel-ipp-preview) library usage with OpenCV. The code
|
||||
example below illustrates implementation of the Sobel operation, accelerated with Intel® IPP
|
||||
Asynchronous C/C++ functions. In this code example, @ref cv::hpp::getMat and @ref cv::hpp::getHpp
|
||||
functions are used for data conversion between
|
||||
[hppiMatrix](http://software.intel.com/en-us/node/501660) and Mat matrices.
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
You may also find the source code in the
|
||||
`samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp` file of the OpenCV source library or
|
||||
download it from [here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp).
|
||||
|
||||
@include cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
-# Create parameters for OpenCV:
|
||||
@code{.cpp}
|
||||
VideoCapture cap;
|
||||
Mat image, gray, result;
|
||||
@endcode
|
||||
and IPP Async:
|
||||
@code{.cpp}
|
||||
hppiMatrix* src,* dst;
|
||||
hppAccel accel = 0;
|
||||
hppAccelType accelType;
|
||||
hppStatus sts;
|
||||
hppiVirtualMatrix * virtMatrix;
|
||||
@endcode
|
||||
-# Load input image or video. How to open and read video stream you can see in the
|
||||
@ref tutorial_video_input_psnr_ssim tutorial.
|
||||
@code{.cpp}
|
||||
if( useCamera )
|
||||
{
|
||||
printf("used camera\n");
|
||||
cap.open(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("used image %s\n", file.c_str());
|
||||
cap.open(file.c_str());
|
||||
}
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
printf("can not open camera or video file\n");
|
||||
return -1;
|
||||
}
|
||||
@endcode
|
||||
-# Create accelerator instance using
|
||||
[hppCreateInstance](http://software.intel.com/en-us/node/501686):
|
||||
@code{.cpp}
|
||||
accelType = sAccel == "cpu" ? HPP_ACCEL_TYPE_CPU:
|
||||
sAccel == "gpu" ? HPP_ACCEL_TYPE_GPU:
|
||||
HPP_ACCEL_TYPE_ANY;
|
||||
|
||||
//Create accelerator instance
|
||||
sts = hppCreateInstance(accelType, 0, &accel);
|
||||
CHECK_STATUS(sts, "hppCreateInstance");
|
||||
@endcode
|
||||
-# Create an array of virtual matrices using
|
||||
[hppiCreateVirtualMatrices](http://software.intel.com/en-us/node/501700) function.
|
||||
@code{.cpp}
|
||||
virtMatrix = hppiCreateVirtualMatrices(accel, 1);
|
||||
@endcode
|
||||
-# Prepare a matrix for input and output data:
|
||||
@code{.cpp}
|
||||
cap >> image;
|
||||
if(image.empty())
|
||||
break;
|
||||
|
||||
cvtColor( image, gray, COLOR_BGR2GRAY );
|
||||
|
||||
result.create( image.rows, image.cols, CV_8U);
|
||||
@endcode
|
||||
-# Convert Mat to [hppiMatrix](http://software.intel.com/en-us/node/501660) using @ref cv::hpp::getHpp
|
||||
and call [hppiSobel](http://software.intel.com/en-us/node/474701) function.
|
||||
@code{.cpp}
|
||||
//convert Mat to hppiMatrix
|
||||
src = getHpp(gray, accel);
|
||||
dst = getHpp(result, accel);
|
||||
|
||||
sts = hppiSobel(accel,src, HPP_MASK_SIZE_3X3,HPP_NORM_L1,virtMatrix[0]);
|
||||
CHECK_STATUS(sts,"hppiSobel");
|
||||
|
||||
sts = hppiConvert(accel, virtMatrix[0], 0, HPP_RND_MODE_NEAR, dst, HPP_DATA_TYPE_8U);
|
||||
CHECK_STATUS(sts,"hppiConvert");
|
||||
|
||||
// Wait for tasks to complete
|
||||
sts = hppWait(accel, HPP_TIME_OUT_INFINITE);
|
||||
CHECK_STATUS(sts, "hppWait");
|
||||
@endcode
|
||||
We use [hppiConvert](http://software.intel.com/en-us/node/501746) because
|
||||
[hppiSobel](http://software.intel.com/en-us/node/474701) returns destination matrix with
|
||||
HPP_DATA_TYPE_16S data type for source matrix with HPP_DATA_TYPE_8U type. You should check
|
||||
hppStatus after each call IPP Async function.
|
||||
|
||||
-# Create windows and show the images, the usual way.
|
||||
@code{.cpp}
|
||||
imshow("image", image);
|
||||
imshow("rez", result);
|
||||
|
||||
waitKey(15);
|
||||
@endcode
|
||||
-# Delete hpp matrices.
|
||||
@code{.cpp}
|
||||
sts = hppiFreeMatrix(src);
|
||||
CHECK_DEL_STATUS(sts,"hppiFreeMatrix");
|
||||
|
||||
sts = hppiFreeMatrix(dst);
|
||||
CHECK_DEL_STATUS(sts,"hppiFreeMatrix");
|
||||
@endcode
|
||||
-# Delete virtual matrices and accelerator instance.
|
||||
@code{.cpp}
|
||||
if (virtMatrix)
|
||||
{
|
||||
sts = hppiDeleteVirtualMatrices(accel, virtMatrix);
|
||||
CHECK_DEL_STATUS(sts,"hppiDeleteVirtualMatrices");
|
||||
}
|
||||
|
||||
if (accel)
|
||||
{
|
||||
sts = hppDeleteInstance(accel);
|
||||
CHECK_DEL_STATUS(sts, "hppDeleteInstance");
|
||||
}
|
||||
@endcode
|
||||
|
||||
Result
|
||||
------
|
||||
|
||||
After compiling the code above we can execute it giving an image or video path and accelerator type
|
||||
as an argument. For this tutorial we use baboon.png image as input. The result is below.
|
||||
|
||||

|
||||
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
@@ -1,6 +1,9 @@
|
||||
Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
|
||||
==============================
|
||||
|
||||
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
|
||||
@next_tutorial{tutorial_how_to_use_OpenCV_parallel_for_}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -85,7 +88,7 @@ L = Mat(pI);
|
||||
A case study
|
||||
------------
|
||||
|
||||
Now that you have the basics done [here's](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
Now that you have the basics done [here's](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
an example that mixes the usage of the C interface with the C++ one. You will also find it in the
|
||||
sample directory of the OpenCV source code library at the
|
||||
`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp` .
|
||||
@@ -132,7 +135,7 @@ output:
|
||||
|
||||
You may observe a runtime instance of this on the [YouTube
|
||||
here](https://www.youtube.com/watch?v=qckm-zvo31w) and you can [download the source code from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
or find it in the
|
||||
`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp`
|
||||
of the OpenCV source code library.
|
||||
|
||||
@@ -33,7 +33,7 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp`.
|
||||
@include samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp
|
||||
@@ -41,7 +41,7 @@ OpenCV source code libraries sample directory at
|
||||
|
||||
@add_toggle_java
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java`.
|
||||
@include samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java
|
||||
@@ -49,7 +49,7 @@ OpenCV source code libraries sample directory at
|
||||
|
||||
@add_toggle_python
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py`.
|
||||
@include samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py
|
||||
|
||||
@@ -1,31 +1,59 @@
|
||||
Operations with images {#tutorial_mat_operations}
|
||||
======================
|
||||
|
||||
@prev_tutorial{tutorial_mat_mask_operations}
|
||||
@next_tutorial{tutorial_adding_images}
|
||||
|
||||
Input/Output
|
||||
------------
|
||||
|
||||
### Images
|
||||
|
||||
Load an image from a file:
|
||||
@code{.cpp}
|
||||
Mat img = imread(filename)
|
||||
@endcode
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Load an image from a file
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Load an image from a file
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Load an image from a file
|
||||
@end_toggle
|
||||
|
||||
If you read a jpg file, a 3 channel image is created by default. If you need a grayscale image, use:
|
||||
|
||||
@code{.cpp}
|
||||
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
||||
@endcode
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Load an image from a file in grayscale
|
||||
@end_toggle
|
||||
|
||||
@note format of the file is determined by its content (first few bytes) Save an image to a file:
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Load an image from a file in grayscale
|
||||
@end_toggle
|
||||
|
||||
@code{.cpp}
|
||||
imwrite(filename, img);
|
||||
@endcode
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Load an image from a file in grayscale
|
||||
@end_toggle
|
||||
|
||||
@note format of the file is determined by its extension.
|
||||
@note Format of the file is determined by its content (first few bytes). To save an image to a file:
|
||||
|
||||
@note use imdecode and imencode to read and write image from/to memory rather than a file.
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Save image
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Save image
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Save image
|
||||
@end_toggle
|
||||
|
||||
@note Format of the file is determined by its extension.
|
||||
|
||||
@note Use cv::imdecode and cv::imencode to read and write an image from/to memory rather than a file.
|
||||
|
||||
Basic operations with images
|
||||
----------------------------
|
||||
@@ -35,49 +63,65 @@ Basic operations with images
|
||||
In order to get pixel intensity value, you have to know the type of an image and the number of
|
||||
channels. Here is an example for a single channel grey scale image (type 8UC1) and pixel coordinates
|
||||
x and y:
|
||||
@code{.cpp}
|
||||
Scalar intensity = img.at<uchar>(y, x);
|
||||
@endcode
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Pixel access 1
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Pixel access 1
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Pixel access 1
|
||||
@end_toggle
|
||||
|
||||
C++ version only:
|
||||
intensity.val[0] contains a value from 0 to 255. Note the ordering of x and y. Since in OpenCV
|
||||
images are represented by the same structure as matrices, we use the same convention for both
|
||||
cases - the 0-based row index (or y-coordinate) goes first and the 0-based column index (or
|
||||
x-coordinate) follows it. Alternatively, you can use the following notation:
|
||||
@code{.cpp}
|
||||
Scalar intensity = img.at<uchar>(Point(x, y));
|
||||
@endcode
|
||||
x-coordinate) follows it. Alternatively, you can use the following notation (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Pixel access 2
|
||||
|
||||
Now let us consider a 3 channel image with BGR color ordering (the default format returned by
|
||||
imread):
|
||||
@code{.cpp}
|
||||
Vec3b intensity = img.at<Vec3b>(y, x);
|
||||
uchar blue = intensity.val[0];
|
||||
uchar green = intensity.val[1];
|
||||
uchar red = intensity.val[2];
|
||||
@endcode
|
||||
|
||||
**C++ code**
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Pixel access 3
|
||||
|
||||
**Python Python**
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Pixel access 3
|
||||
|
||||
You can use the same method for floating-point images (for example, you can get such an image by
|
||||
running Sobel on a 3 channel image):
|
||||
@code{.cpp}
|
||||
Vec3f intensity = img.at<Vec3f>(y, x);
|
||||
float blue = intensity.val[0];
|
||||
float green = intensity.val[1];
|
||||
float red = intensity.val[2];
|
||||
@endcode
|
||||
running Sobel on a 3 channel image) (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Pixel access 4
|
||||
|
||||
The same method can be used to change pixel intensities:
|
||||
@code{.cpp}
|
||||
img.at<uchar>(y, x) = 128;
|
||||
@endcode
|
||||
There are functions in OpenCV, especially from calib3d module, such as projectPoints, that take an
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Pixel access 5
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Pixel access 5
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Pixel access 5
|
||||
@end_toggle
|
||||
|
||||
There are functions in OpenCV, especially from calib3d module, such as cv::projectPoints, that take an
|
||||
array of 2D or 3D points in the form of Mat. Matrix should contain exactly one column, each row
|
||||
corresponds to a point, matrix type should be 32FC2 or 32FC3 correspondingly. Such a matrix can be
|
||||
easily constructed from `std::vector`:
|
||||
@code{.cpp}
|
||||
vector<Point2f> points;
|
||||
//... fill the array
|
||||
Mat pointsMat = Mat(points);
|
||||
@endcode
|
||||
One can access a point in this matrix using the same method Mat::at :
|
||||
@code{.cpp}
|
||||
Point2f point = pointsMat.at<Point2f>(i, 0);
|
||||
@endcode
|
||||
easily constructed from `std::vector` (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Mat from points vector
|
||||
|
||||
One can access a point in this matrix using the same method `Mat::at` (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Point access
|
||||
|
||||
### Memory management and reference counting
|
||||
|
||||
@@ -85,91 +129,141 @@ Mat is a structure that keeps matrix/image characteristics (rows and columns num
|
||||
and a pointer to data. So nothing prevents us from having several instances of Mat corresponding to
|
||||
the same data. A Mat keeps a reference count that tells if data has to be deallocated when a
|
||||
particular instance of Mat is destroyed. Here is an example of creating two matrices without copying
|
||||
data:
|
||||
@code{.cpp}
|
||||
std::vector<Point3f> points;
|
||||
// .. fill the array
|
||||
Mat pointsMat = Mat(points).reshape(1);
|
||||
@endcode
|
||||
As a result we get a 32FC1 matrix with 3 columns instead of 32FC3 matrix with 1 column. pointsMat
|
||||
data (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Reference counting 1
|
||||
|
||||
As a result, we get a 32FC1 matrix with 3 columns instead of 32FC3 matrix with 1 column. `pointsMat`
|
||||
uses data from points and will not deallocate the memory when destroyed. In this particular
|
||||
instance, however, developer has to make sure that lifetime of points is longer than of pointsMat.
|
||||
instance, however, developer has to make sure that lifetime of `points` is longer than of `pointsMat`
|
||||
If we need to copy the data, this is done using, for example, cv::Mat::copyTo or cv::Mat::clone:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
Mat img1 = img.clone();
|
||||
@endcode
|
||||
To the contrary with C API where an output image had to be created by developer, an empty output Mat
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Reference counting 2
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Reference counting 2
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Reference counting 2
|
||||
@end_toggle
|
||||
|
||||
To the contrary with C API where an output image had to be created by the developer, an empty output Mat
|
||||
can be supplied to each function. Each implementation calls Mat::create for a destination matrix.
|
||||
This method allocates data for a matrix if it is empty. If it is not empty and has the correct size
|
||||
and type, the method does nothing. If, however, size or type are different from input arguments, the
|
||||
and type, the method does nothing. If however, size or type are different from the input arguments, the
|
||||
data is deallocated (and lost) and a new data is allocated. For example:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
Mat sobelx;
|
||||
Sobel(img, sobelx, CV_32F, 1, 0);
|
||||
@endcode
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Reference counting 3
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Reference counting 3
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Reference counting 3
|
||||
@end_toggle
|
||||
|
||||
### Primitive operations
|
||||
|
||||
There is a number of convenient operators defined on a matrix. For example, here is how we can make
|
||||
a black image from an existing greyscale image \`img\`:
|
||||
@code{.cpp}
|
||||
img = Scalar(0);
|
||||
@endcode
|
||||
a black image from an existing greyscale image `img`
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Set image to black
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Set image to black
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Set image to black
|
||||
@end_toggle
|
||||
|
||||
Selecting a region of interest:
|
||||
@code{.cpp}
|
||||
Rect r(10, 10, 100, 100);
|
||||
Mat smallImg = img(r);
|
||||
@endcode
|
||||
A conversion from Mat to C API data structures:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
IplImage img1 = img;
|
||||
CvMat m = img;
|
||||
@endcode
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Select ROI
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Select ROI
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Select ROI
|
||||
@end_toggle
|
||||
|
||||
A conversion from Mat to C API data structures (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp C-API conversion
|
||||
|
||||
Note that there is no data copying here.
|
||||
|
||||
Conversion from color to grey scale:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg"); // loading a 8UC3 image
|
||||
Mat grey;
|
||||
cvtColor(img, grey, COLOR_BGR2GRAY);
|
||||
@endcode
|
||||
Conversion from color to greyscale:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp BGR to Gray
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java BGR to Gray
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py BGR to Gray
|
||||
@end_toggle
|
||||
|
||||
Change image type from 8UC1 to 32FC1:
|
||||
@code{.cpp}
|
||||
src.convertTo(dst, CV_32F);
|
||||
@endcode
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Convert to CV_32F
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java Convert to CV_32F
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Convert to CV_32F
|
||||
@end_toggle
|
||||
|
||||
### Visualizing images
|
||||
|
||||
It is very useful to see intermediate results of your algorithm during development process. OpenCV
|
||||
provides a convenient way of visualizing images. A 8U image can be shown using:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
|
||||
namedWindow("image", WINDOW_AUTOSIZE);
|
||||
imshow("image", img);
|
||||
waitKey();
|
||||
@endcode
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp imshow 1
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java imshow 1
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py imshow 1
|
||||
@end_toggle
|
||||
|
||||
A call to waitKey() starts a message passing cycle that waits for a key stroke in the "image"
|
||||
window. A 32F image needs to be converted to 8U type. For example:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
Mat grey;
|
||||
cvtColor(img, grey, COLOR_BGR2GRAY);
|
||||
|
||||
Mat sobelx;
|
||||
Sobel(grey, sobelx, CV_32F, 1, 0);
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp imshow 2
|
||||
@end_toggle
|
||||
|
||||
double minVal, maxVal;
|
||||
minMaxLoc(sobelx, &minVal, &maxVal); //find minimum and maximum intensities
|
||||
Mat draw;
|
||||
sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
|
||||
@add_toggle_java
|
||||
@snippet samples/java/tutorial_code/core/mat_operations/MatOperations.java imshow 2
|
||||
@end_toggle
|
||||
|
||||
namedWindow("image", WINDOW_AUTOSIZE);
|
||||
imshow("image", draw);
|
||||
waitKey();
|
||||
@endcode
|
||||
@add_toggle_python
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py imshow 2
|
||||
@end_toggle
|
||||
|
||||
@note Here cv::namedWindow is not necessary since it is immediately followed by cv::imshow.
|
||||
Nevertheless, it can be used to change the window properties or when using cv::createTrackbar
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Mat - The Basic Image Container {#tutorial_mat_the_basic_image_container}
|
||||
===============================
|
||||
|
||||
@next_tutorial{tutorial_how_to_scan_images}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -260,7 +262,7 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||

|
||||
|
||||
Most of the samples here have been included in a small console application. You can download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
or in the core section of the cpp samples.
|
||||
|
||||
You can also find a quick video demonstration of this on
|
||||
|
||||
@@ -36,6 +36,10 @@ understanding how to manipulate the images on a pixel level.
|
||||
|
||||
- @subpage tutorial_mat_operations
|
||||
|
||||
*Languages:* C++, Java, Python
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
Reading/writing images from file, accessing pixels, primitive operations, visualizing images.
|
||||
|
||||
- @subpage tutorial_adding_images
|
||||
@@ -50,29 +54,13 @@ understanding how to manipulate the images on a pixel level.
|
||||
|
||||
- @subpage tutorial_basic_linear_transform
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
*Author:* Ana Huamán
|
||||
|
||||
We will learn how to change our image appearance!
|
||||
|
||||
- @subpage tutorial_basic_geometric_drawing
|
||||
|
||||
*Languages:* C++, Java, Python
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
*Author:* Ana Huamán
|
||||
|
||||
We will learn how to draw simple geometry with OpenCV!
|
||||
|
||||
- @subpage tutorial_random_generator_and_text
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
*Author:* Ana Huamán
|
||||
|
||||
We will draw some *fancy-looking* stuff using OpenCV!
|
||||
We will learn how to change our image appearance!
|
||||
|
||||
- @subpage tutorial_discrete_fourier_transform
|
||||
|
||||
@@ -105,15 +93,6 @@ understanding how to manipulate the images on a pixel level.
|
||||
Look here to shed light on all this questions.
|
||||
|
||||
|
||||
- @subpage tutorial_how_to_use_ippa_conversion
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
*Author:* Elena Gvozdeva
|
||||
|
||||
You will see how to use the IPP Async with OpenCV.
|
||||
|
||||
|
||||
- @subpage tutorial_how_to_use_OpenCV_parallel_for_
|
||||
|
||||
*Compatibility:* \>= OpenCV 2.4.3
|
||||
|
||||
@@ -12,7 +12,7 @@ Tutorial was written for the following versions of corresponding software:
|
||||
|
||||
- Download and install Android Studio from https://developer.android.com/studio.
|
||||
|
||||
- Get the latest pre-built OpenCV for Android release from https://github.com/opencv/opencv/releases and unpack it (for example, `opencv-3.4.2-android-sdk.zip`).
|
||||
- Get the latest pre-built OpenCV for Android release from https://github.com/opencv/opencv/releases and unpack it (for example, `opencv-3.4.3-android-sdk.zip`).
|
||||
|
||||
- Download MobileNet object detection model from https://github.com/chuanqi305/MobileNet-SSD. We need a configuration file `MobileNetSSD_deploy.prototxt` and weights `MobileNetSSD_deploy.caffemodel`.
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ a centric one.
|
||||
@snippet dnn/edge_detection.py Register
|
||||
|
||||
That's it! We've replaced an implemented OpenCV's layer to a custom one.
|
||||
You may find a full script in the [source code](https://github.com/opencv/opencv/tree/3.4/samples/dnn/edge_detection.py).
|
||||
You may find a full script in the [source code](https://github.com/opencv/opencv/tree/master/samples/dnn/edge_detection.py).
|
||||
|
||||
<table border="0">
|
||||
<tr>
|
||||
|
||||
@@ -13,7 +13,7 @@ We will demonstrate results of this example on the following picture.
|
||||
Source Code
|
||||
-----------
|
||||
|
||||
We will be using snippets from the example application, that can be downloaded [here](https://github.com/opencv/opencv/blob/3.4/samples/dnn/classification.cpp).
|
||||
We will be using snippets from the example application, that can be downloaded [here](https://github.com/opencv/opencv/blob/master/samples/dnn/classification.cpp).
|
||||
|
||||
@include dnn/classification.cpp
|
||||
|
||||
@@ -25,7 +25,7 @@ Explanation
|
||||
[bvlc_googlenet.caffemodel](http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel)
|
||||
|
||||
Also you need file with names of [ILSVRC2012](http://image-net.org/challenges/LSVRC/2012/browse-synsets) classes:
|
||||
[classification_classes_ILSVRC2012.txt](https://github.com/opencv/opencv/tree/3.4/samples/dnn/classification_classes_ILSVRC2012.txt).
|
||||
[classification_classes_ILSVRC2012.txt](https://github.com/opencv/opencv/tree/master/samples/dnn/classification_classes_ILSVRC2012.txt).
|
||||
|
||||
Put these files into working dir of this program example.
|
||||
|
||||
|
||||
@@ -68,8 +68,6 @@ MSBuild.exe /m:4 /t:Build /p:Configuration=Release .\\ALL_BUILD.vcxproj
|
||||
## Build OpenCV with Halide backend
|
||||
When you build OpenCV add the following configuration flags:
|
||||
|
||||
- `ENABLE_CXX11` - enable C++11 standard
|
||||
|
||||
- `WITH_HALIDE` - enable Halide linkage
|
||||
|
||||
- `HALIDE_ROOT_DIR` - path to Halide build directory
|
||||
|
||||
@@ -19,8 +19,8 @@ Source Code
|
||||
-----------
|
||||
|
||||
Use a universal sample for object detection models written
|
||||
[in C++](https://github.com/opencv/opencv/blob/3.4/samples/dnn/object_detection.cpp) and
|
||||
[in Python](https://github.com/opencv/opencv/blob/3.4/samples/dnn/object_detection.py) languages
|
||||
[in C++](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.cpp) and
|
||||
[in Python](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.py) languages
|
||||
|
||||
Usage examples
|
||||
--------------
|
||||
|
||||
@@ -32,7 +32,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/features2D/AKAZE_match.cpp)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/features2D/AKAZE_match.cpp)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/cpp/tutorial_code/features2D/AKAZE_match.cpp
|
||||
@@ -40,7 +40,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_java
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java
|
||||
@@ -48,7 +48,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_python
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py
|
||||
|
||||
@@ -24,19 +24,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -45,19 +45,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ For detailed explanations about the theory, please refer to a computer vision co
|
||||
* An Invitation to 3-D Vision: From Images to Geometric Models, @cite Ma:2003:IVI
|
||||
* Computer Vision: Algorithms and Applications, @cite RS10
|
||||
|
||||
The tutorial code can be found [here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/Homography).
|
||||
The images used in this tutorial can be found [here](https://github.com/opencv/opencv/tree/3.4/samples/data) (`left*.jpg`).
|
||||
The tutorial code can be found [here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/Homography).
|
||||
The images used in this tutorial can be found [here](https://github.com/opencv/opencv/tree/master/samples/data) (`left*.jpg`).
|
||||
|
||||
Basic theory {#tutorial_homography_Basic_theory}
|
||||
------------
|
||||
|
||||
@@ -17,19 +17,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp)
|
||||
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java)
|
||||
|
||||
@include samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py)
|
||||
|
||||
@include samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py
|
||||
@end_toggle
|
||||
|
||||
@@ -16,19 +16,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -120,19 +120,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ The source code
|
||||
|
||||
You may also find the source code and the video file in the
|
||||
`samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity` directory of the OpenCV
|
||||
source library or download it from [here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp).
|
||||
source library or download it from [here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp).
|
||||
The full source code is quite long (due to the controlling of the application via the command line
|
||||
arguments and performance measurement). Therefore, to avoid cluttering up these sections with those
|
||||
you'll find here only the functions itself.
|
||||
|
||||
@@ -27,19 +27,19 @@ Let's modify the program made in the tutorial @ref tutorial_adding_images. We wi
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp)
|
||||
@include cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/highgui/trackbar/AddingImagesTrackbar.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/highgui/trackbar/AddingImagesTrackbar.java)
|
||||
@include java/tutorial_code/highgui/trackbar/AddingImagesTrackbar.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/highgui/trackbar/AddingImagesTrackbar.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/highgui/trackbar/AddingImagesTrackbar.py)
|
||||
@include python/tutorial_code/highgui/trackbar/AddingImagesTrackbar.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
Anisotropic image segmentation by a gradient structure tensor {#tutorial_anisotropic_image_segmentation_by_a_gst}
|
||||
==========================
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
In this tutorial you will learn:
|
||||
|
||||
- what the gradient structure tensor is
|
||||
- how to estimate orientation and coherency of an anisotropic image by a gradient structure tensor
|
||||
- how to segment an anisotropic image with a single local orientation by a gradient structure tensor
|
||||
|
||||
Theory
|
||||
------
|
||||
|
||||
@note The explanation is based on the books @cite jahne2000computer, @cite bigun2006vision and @cite van1995estimators. Good physical explanation of a gradient structure tensor is given in @cite yang1996structure. Also, you can refer to a wikipedia page [Structure tensor].
|
||||
@note A anisotropic image on this page is a real world image.
|
||||
|
||||
### What is the gradient structure tensor?
|
||||
|
||||
In mathematics, the gradient structure tensor (also referred to as the second-moment matrix, the second order moment tensor, the inertia tensor, etc.) is a matrix derived from the gradient of a function. It summarizes the predominant directions of the gradient in a specified neighborhood of a point, and the degree to which those directions are coherent (coherency). The gradient structure tensor is widely used in image processing and computer vision for 2D/3D image segmentation, motion detection, adaptive filtration, local image features detection, etc.
|
||||
|
||||
Important features of anisotropic images include orientation and coherency of a local anisotropy. In this paper we will show how to estimate orientation and coherency, and how to segment an anisotropic image with a single local orientation by a gradient structure tensor.
|
||||
|
||||
The gradient structure tensor of an image is a 2x2 symmetric matrix. Eigenvectors of the gradient structure tensor indicate local orientation, whereas eigenvalues give coherency (a measure of anisotropism).
|
||||
|
||||
The gradient structure tensor \f$J\f$ of an image \f$Z\f$ can be written as:
|
||||
|
||||
\f[J = \begin{bmatrix}
|
||||
J_{11} & J_{12} \\
|
||||
J_{12} & J_{22}
|
||||
\end{bmatrix}\f]
|
||||
|
||||
where \f$J_{11} = M[Z_{x}^{2}]\f$, \f$J_{22} = M[Z_{y}^{2}]\f$, \f$J_{12} = M[Z_{x}Z_{y}]\f$ - components of the tensor, \f$M[]\f$ is a symbol of mathematical expectation (we can consider this operation as averaging in a window w), \f$Z_{x}\f$ and \f$Z_{y}\f$ are partial derivatives of an image \f$Z\f$ with respect to \f$x\f$ and \f$y\f$.
|
||||
|
||||
The eigenvalues of the tensor can be found in the below formula:
|
||||
\f[\lambda_{1,2} = J_{11} + J_{22} \pm \sqrt{(J_{11} - J_{22})^{2} + 4J_{12}^{2}}\f]
|
||||
where \f$\lambda_1\f$ - largest eigenvalue, \f$\lambda_2\f$ - smallest eigenvalue.
|
||||
|
||||
### How to estimate orientation and coherency of an anisotropic image by gradient structure tensor?
|
||||
|
||||
The orientation of an anisotropic image:
|
||||
\f[\alpha = 0.5arctg\frac{2J_{12}}{J_{22} - J_{11}}\f]
|
||||
|
||||
Coherency:
|
||||
\f[C = \frac{\lambda_1 - \lambda_2}{\lambda_1 + \lambda_2}\f]
|
||||
|
||||
The coherency ranges from 0 to 1. For ideal local orientation (\f$\lambda_2\f$ = 0, \f$\lambda_1\f$ > 0) it is one, for an isotropic gray value structure (\f$\lambda_1\f$ = \f$\lambda_2\f$ > 0) it is zero.
|
||||
|
||||
Source code
|
||||
-----------
|
||||
|
||||
You can find source code in the `samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp` of the OpenCV source code library.
|
||||
|
||||
@include cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
An anisotropic image segmentation algorithm consists of a gradient structure tensor calculation, an orientation calculation, a coherency calculation and an orientation and coherency thresholding:
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp main
|
||||
|
||||
A function calcGST() calculates orientation and coherency by using a gradient structure tensor. An input parameter w defines a window size:
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp calcGST
|
||||
|
||||
The below code applies a thresholds LowThr and HighThr to image orientation and a threshold C_Thr to image coherency calculated by the previous function. LowThr and HighThr define orientation range:
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp thresholding
|
||||
|
||||
And finally we combine thresholding results:
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp combining
|
||||
|
||||
Result
|
||||
------
|
||||
|
||||
Below you can see the real anisotropic image with single direction:
|
||||

|
||||
|
||||
Below you can see the orientation and coherency of the anisotropic image:
|
||||

|
||||

|
||||
|
||||
Below you can see the segmentation result:
|
||||

|
||||
|
||||
The result has been computed with w = 52, C_Thr = 0.43, LowThr = 35, HighThr = 57. We can see that the algorithm selected only the areas with one single direction.
|
||||
|
||||
References
|
||||
------
|
||||
- [Structure tensor] - structure tensor description on the wikipedia
|
||||
|
||||
<!-- invisible references list -->
|
||||
[Structure tensor]: https://en.wikipedia.org/wiki/Structure_tensor
|
||||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 32 KiB |
@@ -1,7 +1,6 @@
|
||||
Basic Drawing {#tutorial_basic_geometric_drawing}
|
||||
=============
|
||||
|
||||
@prev_tutorial{tutorial_basic_linear_transform}
|
||||
@next_tutorial{tutorial_random_generator_and_text}
|
||||
|
||||
Goals
|
||||
@@ -82,20 +81,20 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
- This code is in your OpenCV sample folder. Otherwise you can grab it from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp)
|
||||
@include samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp)
|
||||
@include samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
- This code is in your OpenCV sample folder. Otherwise you can grab it from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java)
|
||||
@include samples/java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java)
|
||||
@include samples/java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
- This code is in your OpenCV sample folder. Otherwise you can grab it from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py)
|
||||
@include samples/python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py)
|
||||
@include samples/python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py
|
||||
@end_toggle
|
||||
|
||||
Explanation
|
||||
@@ -104,42 +103,42 @@ Explanation
|
||||
Since we plan to draw two examples (an atom and a rook), we have to create two images and two
|
||||
windows to display them.
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp create_images
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp create_images
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java create_images
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java create_images
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py create_images
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py create_images
|
||||
@end_toggle
|
||||
|
||||
We created functions to draw different geometric shapes. For instance, to draw the atom we used
|
||||
**MyEllipse** and **MyFilledCircle**:
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp draw_atom
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp draw_atom
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java draw_atom
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java draw_atom
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py draw_atom
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py draw_atom
|
||||
@end_toggle
|
||||
|
||||
And to draw the rook we employed **MyLine**, **rectangle** and a **MyPolygon**:
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp draw_rook
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp draw_rook
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java draw_rook
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java draw_rook
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py draw_rook
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py draw_rook
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -149,15 +148,15 @@ Let's check what is inside each of these functions:
|
||||
|
||||
<H4>MyLine</H4>
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_line
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_line
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_line
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_line
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_line
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_line
|
||||
@end_toggle
|
||||
|
||||
- As we can see, **MyLine** just call the function **line()** , which does the following:
|
||||
@@ -170,15 +169,15 @@ Let's check what is inside each of these functions:
|
||||
|
||||
<H4>MyEllipse</H4>
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_ellipse
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_ellipse
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_ellipse
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_ellipse
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_ellipse
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_ellipse
|
||||
@end_toggle
|
||||
|
||||
- From the code above, we can observe that the function **ellipse()** draws an ellipse such
|
||||
@@ -194,15 +193,15 @@ Let's check what is inside each of these functions:
|
||||
|
||||
<H4>MyFilledCircle</H4>
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_filled_circle
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_filled_circle
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_filled_circle
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_filled_circle
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_filled_circle
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_filled_circle
|
||||
@end_toggle
|
||||
|
||||
- Similar to the ellipse function, we can observe that *circle* receives as arguments:
|
||||
@@ -215,15 +214,15 @@ Let's check what is inside each of these functions:
|
||||
|
||||
<H4>MyPolygon</H4>
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_polygon
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_polygon
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_polygon
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_polygon
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_polygon
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_polygon
|
||||
@end_toggle
|
||||
|
||||
- To draw a filled polygon we use the function **fillPoly()** . We note that:
|
||||
@@ -235,15 +234,15 @@ Let's check what is inside each of these functions:
|
||||
|
||||
<H4>rectangle</H4>
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp rectangle
|
||||
@snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp rectangle
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java rectangle
|
||||
@snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java rectangle
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py rectangle
|
||||
@snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py rectangle
|
||||
@end_toggle
|
||||
|
||||
- Finally we have the @ref cv::rectangle function (we did not create a special function for
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,6 +1,9 @@
|
||||
Eroding and Dilating {#tutorial_erosion_dilatation}
|
||||
====================
|
||||
|
||||
@prev_tutorial{tutorial_gausian_median_blur_bilateral_filter}
|
||||
@next_tutorial{tutorial_opening_closing_hats}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -62,19 +65,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial's code is shown below. You can also download it
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp)
|
||||
@include samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial's code is shown below. You can also download it
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/ImgProc/erosion_dilatation/MorphologyDemo1.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/ImgProc/erosion_dilatation/MorphologyDemo1.java)
|
||||
@include samples/java/tutorial_code/ImgProc/erosion_dilatation/MorphologyDemo1.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial's code is shown below. You can also download it
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/imgProc/erosion_dilatation/morphology_1.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/imgProc/erosion_dilatation/morphology_1.py)
|
||||
@include samples/python/tutorial_code/imgProc/erosion_dilatation/morphology_1.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Smoothing Images {#tutorial_gausian_median_blur_bilateral_filter}
|
||||
================
|
||||
|
||||
@prev_tutorial{tutorial_random_generator_and_text}
|
||||
@next_tutorial{tutorial_erosion_dilatation}
|
||||
|
||||
Goal
|
||||
@@ -97,7 +98,7 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.cpp)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.cpp)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.cpp
|
||||
@@ -105,7 +106,7 @@ Code
|
||||
|
||||
@add_toggle_java
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/ImgProc/Smoothing/Smoothing.java)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/ImgProc/Smoothing/Smoothing.java)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/java/tutorial_code/ImgProc/Smoothing/Smoothing.java
|
||||
@@ -113,7 +114,7 @@ Code
|
||||
|
||||
@add_toggle_python
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/python/tutorial_code/imgProc/Smoothing/smoothing.py
|
||||
@@ -220,7 +221,7 @@ already known by now.
|
||||
Results
|
||||
-------
|
||||
|
||||
- The code opens an image (in this case [lena.jpg](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/lena.jpg))
|
||||
- The code opens an image (in this case [lena.jpg](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/lena.jpg))
|
||||
and display it under the effects of the 4 filters explained.
|
||||
- Here is a snapshot of the image smoothed using *medianBlur*:
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Back Projection {#tutorial_back_projection}
|
||||
===============
|
||||
|
||||
@prev_tutorial{tutorial_histogram_comparison}
|
||||
@next_tutorial{tutorial_template_matching}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
@@ -71,13 +74,13 @@ Code
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**:
|
||||
- Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp)
|
||||
for the basic version (explained in this tutorial).
|
||||
- For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the
|
||||
skin area) you can check the [improved
|
||||
demo](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp)
|
||||
demo](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp)
|
||||
- ...or you can always check out the classical
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/3.4/samples/cpp/camshiftdemo.cpp)
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/master/samples/cpp/camshiftdemo.cpp)
|
||||
in samples.
|
||||
|
||||
- **Code at glance:**
|
||||
@@ -87,13 +90,13 @@ Code
|
||||
@add_toggle_java
|
||||
- **Downloadable code**:
|
||||
- Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/Histograms_Matching/back_projection/CalcBackProjectDemo1.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/Histograms_Matching/back_projection/CalcBackProjectDemo1.java)
|
||||
for the basic version (explained in this tutorial).
|
||||
- For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the
|
||||
skin area) you can check the [improved
|
||||
demo](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/Histograms_Matching/back_projection/CalcBackProjectDemo2.java)
|
||||
demo](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/Histograms_Matching/back_projection/CalcBackProjectDemo2.java)
|
||||
- ...or you can always check out the classical
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/3.4/samples/cpp/camshiftdemo.cpp)
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/master/samples/cpp/camshiftdemo.cpp)
|
||||
in samples.
|
||||
|
||||
- **Code at glance:**
|
||||
@@ -103,13 +106,13 @@ Code
|
||||
@add_toggle_python
|
||||
- **Downloadable code**:
|
||||
- Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/Histograms_Matching/back_projection/calcBackProject_Demo1.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/Histograms_Matching/back_projection/calcBackProject_Demo1.py)
|
||||
for the basic version (explained in this tutorial).
|
||||
- For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the
|
||||
skin area) you can check the [improved
|
||||
demo](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/Histograms_Matching/back_projection/calcBackProject_Demo2.py)
|
||||
demo](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/Histograms_Matching/back_projection/calcBackProject_Demo2.py)
|
||||
- ...or you can always check out the classical
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/3.4/samples/cpp/camshiftdemo.cpp)
|
||||
[camshiftdemo](https://github.com/opencv/opencv/tree/master/samples/cpp/camshiftdemo.cpp)
|
||||
in samples.
|
||||
|
||||
- **Code at glance:**
|
||||
|
||||