mirror of
https://github.com/opencv/opencv.git
synced 2026-07-23 12:23:02 +04:00
Compare commits
696 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59975db6a4 | |||
| ec2ff7f0c0 | |||
| 5d038686b1 | |||
| 6084901610 | |||
| e58c28974b | |||
| 1b4bd6a905 | |||
| 67fe57a0a3 | |||
| db0ae2ca50 | |||
| de164b0ccf | |||
| 194f1beae8 | |||
| 3bd6912e01 | |||
| 1a41ed2fda | |||
| 9d71c19939 | |||
| 5b73f3a316 | |||
| 96d747f030 | |||
| 5164c4ba31 | |||
| 13858cd561 | |||
| 772d9689e9 | |||
| ff3bb9f4e6 | |||
| e90b697cb0 | |||
| 70bc268c1a | |||
| b6d8c9d990 | |||
| a7ce9a176b | |||
| 52ba3778e3 | |||
| c7b6353a3c | |||
| 34b3d31f54 | |||
| 6f139b4f8e | |||
| 86a725933a | |||
| 64f02aa72d | |||
| 12a8f5486d | |||
| 97ac59cb73 | |||
| 762965897a | |||
| ea3746bd15 | |||
| ef2a376baf | |||
| dc8bb23a7d | |||
| 24361733e4 | |||
| b5fbb2b1c8 | |||
| b8ce65bec8 | |||
| 96903dc4ad | |||
| da669569e1 | |||
| eb40afa26a | |||
| 421fcf9e35 | |||
| d142c05d61 | |||
| 9a5d7f1a0b | |||
| 9d49cef29e | |||
| 1fbc6ab05d | |||
| 93c4dfb16d | |||
| 52b9207105 | |||
| d2e451e877 | |||
| 00e91fd3d0 | |||
| afc62f076a | |||
| 9c4204b89e | |||
| 3afb5a6006 | |||
| 7e44faf635 | |||
| 8cfc87cf01 | |||
| ea049e147d | |||
| 60f73eee7e | |||
| c1f3c41bab | |||
| d29eb2938c | |||
| a61b19b524 | |||
| 25b4d8a1b5 | |||
| aaa30dc5b6 | |||
| e0f426f78b | |||
| 8a09d95eab | |||
| 068769263e | |||
| 21e9edd1a3 | |||
| 544824ffc1 | |||
| d6e2097435 | |||
| cf43790a27 | |||
| 69eaa89e22 | |||
| e835878661 | |||
| 912592de4c | |||
| 85793d0138 | |||
| a57b03c356 | |||
| 5a5378b3bf | |||
| f01f1bc5e6 | |||
| 85c7190e41 | |||
| f2e4bec925 | |||
| 4a8d1147c2 | |||
| bb1c2d71a8 | |||
| be565c2235 | |||
| 389f176a67 | |||
| 5c21ca2697 | |||
| 4f5d585184 | |||
| c01fd16291 | |||
| 537d1322b4 | |||
| 8a803865cf | |||
| 6e22020dad | |||
| f91ada572a | |||
| f7c8f74ac1 | |||
| c4e80952ce | |||
| 178ed63e1a | |||
| 46edb54ac3 | |||
| 7cb78451d1 | |||
| 2897da037e | |||
| 4fa14f75b8 | |||
| 0886f6fe62 | |||
| 681df84036 | |||
| 07a58c47cb | |||
| 53ed1a8c03 | |||
| 4d598719da | |||
| 130d4b1bdf | |||
| 42001234ab | |||
| 6e885e5775 | |||
| 5c0cdd4d2d | |||
| 969f0c4456 | |||
| 739d7caa32 | |||
| 6148c3525e | |||
| df55aaec1e | |||
| eebd4cad66 | |||
| 0050df8750 | |||
| 01b5971c94 | |||
| 8d3850ac02 | |||
| 1862d1995f | |||
| fc1694c97c | |||
| 2799829bc9 | |||
| d5e6503fe5 | |||
| 6441620f45 | |||
| 0f288d1082 | |||
| 82c1c68560 | |||
| 780b713016 | |||
| 1b6dd03fd7 | |||
| 28974e7290 | |||
| ffb9e877e9 | |||
| 1e879e1ab1 | |||
| 57829d81ea | |||
| a20a273982 | |||
| e9b31a70bf | |||
| a1532582a6 | |||
| 68bcff26fb | |||
| 433bc81b30 | |||
| c8bf176558 | |||
| cfd5caf29d | |||
| f461d0cb7a | |||
| 09b0193186 | |||
| 252feb4774 | |||
| 537a978dcf | |||
| 33dc41056f | |||
| b6e8a47fca | |||
| ed0065266e | |||
| c21ed69731 | |||
| 03e7b71707 | |||
| e06c696b3c | |||
| 40ce9f97d6 | |||
| 0bc44376a5 | |||
| fdf549b921 | |||
| 021ff0efa6 | |||
| 1e869c5e49 | |||
| f49936a849 | |||
| 4552ca98c4 | |||
| 9e2395e7e0 | |||
| 05945bf00e | |||
| 9d78a1ea9f | |||
| 8e40becab1 | |||
| 60eda6f25c | |||
| 2e78a3e5e9 | |||
| 966d35a9fb | |||
| 42447a7610 | |||
| ca50969c2b | |||
| 2d3e170370 | |||
| 8a37fc8223 | |||
| a5c20f8592 | |||
| 96a2edb375 | |||
| 15b313ce4b | |||
| 1ea6568951 | |||
| 56654ae360 | |||
| 9a3e53e738 | |||
| 2243bfa181 | |||
| 33cd7f38a8 | |||
| 2fc0ce5c24 | |||
| c5d009d6c4 | |||
| 7d28541bbe | |||
| 95d6002f16 | |||
| e245aed6bb | |||
| 497d92e7d1 | |||
| 1cb0dfa669 | |||
| 4dc2313527 | |||
| 938d42a89f | |||
| 937a096bf1 | |||
| 78a566611d | |||
| 73240b736b | |||
| bf41e791ff | |||
| bac151675a | |||
| 341e7b3be2 | |||
| 98c26d95e5 | |||
| bba8c0beac | |||
| bd34f6dd98 | |||
| 55a9fdf051 | |||
| d16fb30512 | |||
| 8b23d1ec64 | |||
| ff00220302 | |||
| 8ed25ad75f | |||
| 408107ce6d | |||
| 3558da9ab7 | |||
| 9d24b3c3b0 | |||
| 779dad12fb | |||
| 297a92cd94 | |||
| 0d5b739d35 | |||
| ec5244a73a | |||
| 454e5e5fa4 | |||
| bb9bd3132a | |||
| e539a9632d | |||
| 406cfc48c9 | |||
| 59082c8ee8 | |||
| cb1dc7cb6e | |||
| 58a11ac079 | |||
| 69d84c8f3e | |||
| 79ab6567ee | |||
| 60a689d27c | |||
| 5df2713b16 | |||
| 134a3f165d | |||
| 4a68cc1675 | |||
| f838a832b2 | |||
| 6f2fb383e6 | |||
| e1b0d341e4 | |||
| 08ad3b500b | |||
| 56f17e4921 | |||
| 293ea03dcc | |||
| bef1b5322e | |||
| e6f3f3c029 | |||
| 7746d9b7cc | |||
| 3494d640df | |||
| c22cc67ba8 | |||
| 558054a53d | |||
| c7b471f10f | |||
| f4ffcae8d9 | |||
| 0422054aa1 | |||
| a81f0a5123 | |||
| c36582d2df | |||
| d50c07e303 | |||
| 54693b3fa7 | |||
| 3c3bc123fc | |||
| ac33cd688c | |||
| b5e42d8cc1 | |||
| 7e4e8921bc | |||
| 6dcd455ac4 | |||
| 1d58e1a14a | |||
| d122510c4f | |||
| 6613d14261 | |||
| a14e524b32 | |||
| 226ff93917 | |||
| d28e6c9b36 | |||
| c16f465ff5 | |||
| 3231c2f995 | |||
| 16bcc30e42 | |||
| 69c50e0181 | |||
| 486c40f578 | |||
| 08e38e9ff9 | |||
| ba3b902da7 | |||
| bf94e6a91c | |||
| ecc53dd7a4 | |||
| fc0e0239b8 | |||
| 7825cbeb7d | |||
| d38fee7599 | |||
| fb4b4cbf58 | |||
| b23e536894 | |||
| 8b33c6fa8f | |||
| 1c3d83df54 | |||
| b29cde552a | |||
| 3ef067cc65 | |||
| f903192c17 | |||
| e2a9df408f | |||
| cba401fe53 | |||
| f3af90c6c7 | |||
| 036c3b4e6d | |||
| 9df5400200 | |||
| 6fefc53e56 | |||
| 76235cbb70 | |||
| 9d006f6a1d | |||
| 6a05939e1c | |||
| 7b1eb3af7b | |||
| 3934d61de7 | |||
| a98ee0d3b2 | |||
| 73a8e65cbd | |||
| ae0d428b62 | |||
| 32d7c1950a | |||
| 5603617b7c | |||
| 43aae3fee8 | |||
| a7a4a2ae30 | |||
| 1b8c2589c0 | |||
| 887736bcd4 | |||
| 5b1967f80c | |||
| 3a1bb93340 | |||
| dfb49097e3 | |||
| d7bb1025f3 | |||
| dc441f50cd | |||
| be499b42d9 | |||
| 74f5eaf70c | |||
| 7ddc0bdd37 | |||
| 94cf5430d0 | |||
| 4ab2771957 | |||
| bef2b27155 | |||
| 702afcd760 | |||
| 9734abdc1a | |||
| 3b97549bb1 | |||
| fc0b997064 | |||
| 4722b2d0e5 | |||
| f100cdb6d4 | |||
| a00b37d209 | |||
| b757359ff8 | |||
| 3172e6d54b | |||
| 75fcedf0ed | |||
| c19ed39a78 | |||
| 793bdaada7 | |||
| dbd7912b88 | |||
| 370d1ff21a | |||
| 47cee8715b | |||
| b70e27e076 | |||
| d1b882ddcf | |||
| b2489d31d6 | |||
| 7719da9552 | |||
| 8d264d9f64 | |||
| 855765986e | |||
| d0210f510e | |||
| 34aa4e4578 | |||
| 447b8bf58a | |||
| e9539061db | |||
| 98078c231e | |||
| 1d92a73a55 | |||
| ba7bf1ef68 | |||
| 5a53f41622 | |||
| 80844fd554 | |||
| 5262371660 | |||
| a96a6bf149 | |||
| b7c9aaa471 | |||
| 1245cd1752 | |||
| 1f5fd865aa | |||
| 9a3dccab20 | |||
| ac6ca660f4 | |||
| 6f47c26acf | |||
| 945663bc9b | |||
| 0263b49298 | |||
| c2f59a0f73 | |||
| 9eda260495 | |||
| 3ed54b9008 | |||
| 6b954cd24e | |||
| 42ba5c7d16 | |||
| 72ddeea479 | |||
| 869dda4117 | |||
| 07de67c32f | |||
| c467d0d553 | |||
| 0906744788 | |||
| 67158b12cd | |||
| 9e50cf5375 | |||
| 4bf82e50d0 | |||
| 2e86d46cf2 | |||
| 707d10f115 | |||
| 83a4ad5f51 | |||
| e7b82a8561 | |||
| 546e68dc65 | |||
| b7c2a46830 | |||
| 719099ad6d | |||
| 2e9004813e | |||
| 50842b9036 | |||
| 3d6413cfc6 | |||
| 799622affd | |||
| 57ab0d4d17 | |||
| 02f8b85dd9 | |||
| 1fbdca0c9b | |||
| 9eaac6105f | |||
| 83ace8d580 | |||
| 851ce27240 | |||
| 70f8d807c8 | |||
| daa21a4385 | |||
| 13cef0cdfc | |||
| 083aced3b4 | |||
| 72ec9c159e | |||
| 5b00d9da49 | |||
| 74bb0beeb0 | |||
| 08714c510f | |||
| acfbed8654 | |||
| 6212084046 | |||
| d89b6226a3 | |||
| 11d1909e6b | |||
| 3c6fe75149 | |||
| 00d9f690f6 | |||
| ae79fe10dc | |||
| 62fc342d35 | |||
| 36924d6dbb | |||
| ede4943d7e | |||
| 9d148c76ca | |||
| 21d8b588a2 | |||
| 5d66b1130b | |||
| 0550b2c1fe | |||
| d58d277707 | |||
| 95eed59f2d | |||
| 62bc647731 | |||
| 7f63776395 | |||
| b9792fdc14 | |||
| 0410fe6978 | |||
| 242e64c08d | |||
| cc94b393c5 | |||
| 58dd70e8dc | |||
| 53ff537f1c | |||
| a5814871d9 | |||
| 1aa03cecf1 | |||
| f10537cdd6 | |||
| 9d294cbcf5 | |||
| f1bec940b1 | |||
| dd93d48be4 | |||
| ad3123adfd | |||
| f939d80f4c | |||
| ee316758ca | |||
| 6d7a61cbdc | |||
| b44b1ab47b | |||
| 2e47a1a61b | |||
| 72685cf01c | |||
| 612888c066 | |||
| e7b55f4982 | |||
| 3004f5fa30 | |||
| 9682d2afff | |||
| 87d655325c | |||
| db25e44a17 | |||
| b7a9e672c5 | |||
| 8e49ab1d3b | |||
| 00c36e88ef | |||
| cde697dd14 | |||
| e49e75da06 | |||
| 1d40946959 | |||
| 2598392295 | |||
| 17cc5e2c40 | |||
| 4b14400976 | |||
| 4704a254f7 | |||
| 7708e9882e | |||
| fe1bd0cc2f | |||
| a752f25944 | |||
| bb44316028 | |||
| 0b2cfcfda2 | |||
| 9c02caf392 | |||
| d87c30dc84 | |||
| 63d6cc5ca6 | |||
| 9682430a69 | |||
| b69ffe6376 | |||
| 1f72815637 | |||
| 90c3d7d361 | |||
| f4eebc46b2 | |||
| 2b1103c1d3 | |||
| 007a3ef8b6 | |||
| 83eb1d3608 | |||
| 5c12c92243 | |||
| 9e29762838 | |||
| da229cce9a | |||
| 36af97d00c | |||
| d705c651f2 | |||
| 08848c56b7 | |||
| ebe979090e | |||
| 901d4995e3 | |||
| aad95c7d8c | |||
| d9b7b300b4 | |||
| 044de4105e | |||
| 7a5aa06b9e | |||
| a21fb63c28 | |||
| eaa9b78121 | |||
| fd4df0f67d | |||
| 6decc2596d | |||
| 41b920344d | |||
| 82668e06d4 | |||
| a81374c1d7 | |||
| 66fc6126d2 | |||
| 8b58b59df4 | |||
| f0595b8254 | |||
| 1e01441767 | |||
| c797746b6e | |||
| 1bf4427a5c | |||
| ac3ec0d96d | |||
| 5c6c537044 | |||
| f8c82fc214 | |||
| 40b762bceb | |||
| 89e3c508d8 | |||
| cbdddb473c | |||
| b4c2891ef3 | |||
| 1325213303 | |||
| fb15bdfb21 | |||
| 9d2d173485 | |||
| 26e3bcb9de | |||
| 960dee8ab8 | |||
| 847976de4e | |||
| ceec0eb33a | |||
| 4840c4ae6f | |||
| 02e29fc99c | |||
| 7ce116695d | |||
| c879b1ab09 | |||
| a984da911b | |||
| df55be3c3d | |||
| 55339de684 | |||
| f08dd510fa | |||
| de8d8720a2 | |||
| d308ed3712 | |||
| 6d0f8aa893 | |||
| bea98bd22a | |||
| 4539607ab1 | |||
| b320138dba | |||
| 95ea12588e | |||
| bcd08b5d18 | |||
| 19298ae3cb | |||
| 5e06da3050 | |||
| 17ac18a7b9 | |||
| c259590b26 | |||
| 3f3ca85103 | |||
| 05ddc16eaa | |||
| 2ba77614aa | |||
| ef347aa6a4 | |||
| b1cdb91139 | |||
| a09ad35d98 | |||
| 1b5835cd35 | |||
| 9932bbad3a | |||
| 39ac84ff04 | |||
| fcbefaff86 | |||
| bf2256fb89 | |||
| b0b2fc9e3f | |||
| 1ccd64e102 | |||
| 23bf3e337a | |||
| 3cf265992f | |||
| a855d230ec | |||
| 6a6619ec1e | |||
| 8c2bde2af4 | |||
| d22516872c | |||
| 17608f7ade | |||
| 81ebe28c24 | |||
| f7792f0be2 | |||
| 27302c367c | |||
| a153948a19 | |||
| 4273534c92 | |||
| 7274e2ff1a | |||
| 0e8bfff386 | |||
| 8c55d7be5e | |||
| f6de017171 | |||
| cc63452f65 | |||
| eeae81e903 | |||
| e30139edc3 | |||
| f01b2413c3 | |||
| 772fcf4088 | |||
| b8c00854fe | |||
| ba0a8dc723 | |||
| 100c2dd91c | |||
| 58c9135626 | |||
| 6e121b2e29 | |||
| e6619cf580 | |||
| 122b9f8e17 | |||
| d948b2a235 | |||
| ebd7d08408 | |||
| 140051b18c | |||
| b7276359e9 | |||
| 83d6d70a56 | |||
| a9d4e05346 | |||
| e5e6367223 | |||
| 5678ba1227 | |||
| b01f067614 | |||
| 65b0ecfec5 | |||
| d1902a1276 | |||
| 56cae1b293 | |||
| 7c740b6a31 | |||
| d430664791 | |||
| d057828ee3 | |||
| c9bb18b9f7 | |||
| 297e2b6f1a | |||
| 3853a18e0e | |||
| 226b4e3ed5 | |||
| 756c1a22d9 | |||
| a7bf1d53d8 | |||
| 7711cd284b | |||
| 8755ffbf31 | |||
| 69344f175b | |||
| d14a1de947 | |||
| 514b3b520c | |||
| 4a6b1805e0 | |||
| 4ab525c880 | |||
| 7d665a4754 | |||
| f7d52c774e | |||
| 8efdfd9dfc | |||
| cd42e38013 | |||
| 339e6aa782 | |||
| 309eb3c122 | |||
| 2594e5e384 | |||
| 3a7ea37090 | |||
| 9f0cd9ee10 | |||
| 13694c8ae8 | |||
| dde7c22fad | |||
| 29e7eb7719 | |||
| 3419c704a9 | |||
| cdbb661eab | |||
| afdf319f36 | |||
| 488babf3b3 | |||
| 2c57717ca2 | |||
| e9b4813bb2 | |||
| 9185b62a1d | |||
| ac8045b9c6 | |||
| 417f1e51a4 | |||
| b595812bd0 | |||
| 0172bd6beb | |||
| e02d6e2c8f | |||
| 7458dfc082 | |||
| bed8cb42be | |||
| c849492dfa | |||
| 4f5d30a865 | |||
| 2c0ef660bf | |||
| 21bbed7baf | |||
| 1e95c964f3 | |||
| a5b293b412 | |||
| 7d4cbbd7aa | |||
| b7be49426d | |||
| 42b1c6440c | |||
| 35a89b1541 | |||
| 8ae6402799 | |||
| 67635c6d65 | |||
| a26e496d00 | |||
| d579d3e596 | |||
| 5a77176654 | |||
| e929dd4d98 | |||
| 10a2c51c52 | |||
| 4664a339ae | |||
| fb81e4df1c | |||
| cb1e9adc63 | |||
| 562796e41b | |||
| bb93c53948 | |||
| 00575b346d | |||
| 7316676c41 | |||
| 77585bf8af | |||
| c821cb1489 | |||
| 86c1babd03 | |||
| 2205b2f5bc | |||
| 975e40f1c0 | |||
| 628b23acc8 | |||
| f8758da289 | |||
| ca9c52ac97 | |||
| b2790973a3 | |||
| e650d87e47 | |||
| feb74b125d | |||
| 3c0b0b0f94 | |||
| 942401de16 | |||
| f9ff9c5618 | |||
| b4845d8c9f | |||
| ea51396731 | |||
| aa82f921cc | |||
| 2da7eae2c4 | |||
| 25159d8e81 | |||
| f40ffe4763 | |||
| 116311b7b4 | |||
| f1ef3a4865 | |||
| 9997aa8187 | |||
| f15b42018c | |||
| f9e9ae85bd | |||
| a49beb7c73 | |||
| 51dff5b9e8 | |||
| 826fc00374 | |||
| c10692deff | |||
| daa7b9ce5f | |||
| 1ab02631b0 | |||
| 3e755b2290 | |||
| f15a167df4 | |||
| f6367a2ea5 | |||
| 5f88e2b496 | |||
| 2c7cf52e3b | |||
| b7c5083a87 | |||
| d5d88efd5d | |||
| 6cb7a7be18 | |||
| cdea6b532f | |||
| d01e3529a6 | |||
| 7c13d3277c | |||
| 345b3b0bdd | |||
| a65d7d4dd3 | |||
| 5e986f3347 | |||
| 27a8bb471b | |||
| 7868733002 | |||
| 469aef2e5e | |||
| 5e00fc6afe | |||
| 5170f0b5da | |||
| dc2dbb4173 | |||
| 79e4f7eb78 | |||
| cc73c7000f | |||
| 8bb26fa5de | |||
| 48612d7c58 | |||
| 8ba84f4b47 | |||
| bc653add74 | |||
| 215f78eee2 | |||
| 4425dac7f4 | |||
| 4f79b9de48 | |||
| 397ac5e68f | |||
| 43c75c64b5 | |||
| c319625a07 | |||
| a7d0448faa | |||
| ca10e5e8ae | |||
| 32414afe72 | |||
| ed10f50d25 | |||
| 48d9be70d5 | |||
| c6b31481b6 | |||
| 514b714cc2 | |||
| 7fec87d3f6 | |||
| 00d555f051 | |||
| 6cf7d6ef4e | |||
| 3ebdcafdd3 | |||
| a348f3eeaa | |||
| 33f423de04 | |||
| d6ba52c3f9 | |||
| e9638d0997 | |||
| 5cb0084547 |
Vendored
+2
@@ -3,9 +3,11 @@ set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
set(HAVE_FFMPEG_RESAMPLE 0)
|
||||
set(HAVE_GENTOO_FFMPEG 1)
|
||||
|
||||
set(ALIASOF_libavcodec_VERSION 55.18.102)
|
||||
set(ALIASOF_libavformat_VERSION 55.12.100)
|
||||
set(ALIASOF_libavutil_VERSION 52.38.100)
|
||||
set(ALIASOF_libswscale_VERSION 2.3.100)
|
||||
set(ALIASOF_libavresample_VERSION 1.0.1)
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow -Wunused)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wshift-negative-value) # clang
|
||||
|
||||
set_target_properties(${JPEG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||
|
||||
Vendored
+1
@@ -93,6 +93,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
|
||||
|
||||
|
||||
Vendored
+2
@@ -38,10 +38,12 @@ source_group("Include" FILES ${lib_hdrs} )
|
||||
source_group("Src" FILES ${lib_srcs})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
|
||||
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
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267) # vs2008 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
|
||||
|
||||
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
||||
Vendored
+1
-1
@@ -82,7 +82,7 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshift-negative-value)
|
||||
|
||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
||||
OUTPUT_NAME ${ZLIB_LIBRARY}
|
||||
|
||||
+14
-2
@@ -52,6 +52,11 @@ if(POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0042)
|
||||
# silence cmake 3.0+ warnings about MACOSX_RPATH
|
||||
cmake_policy(SET CMP0042 OLD)
|
||||
endif()
|
||||
|
||||
# must go before the project command
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
||||
if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||
@@ -135,7 +140,7 @@ OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
|
||||
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
|
||||
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" OFF IF (NOT ANDROID AND NOT IOS AND NOT CMAKE_CROSSCOMPILING) )
|
||||
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) )
|
||||
@@ -189,6 +194,7 @@ OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for sta
|
||||
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
|
||||
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
|
||||
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
|
||||
OCV_OPTION(BUILD_TINY_GPU_MODULE "Build tiny gpu module with limited image format support" OFF )
|
||||
|
||||
# 3rd party libs
|
||||
OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE )
|
||||
@@ -625,7 +631,11 @@ if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
|
||||
if(BUILD_opencv_python)
|
||||
file(GLOB py_tests modules/python/test/*.py)
|
||||
install(PROGRAMS ${py_tests} DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||
set(OPENCV_PYTHON_TESTS_LIST "test2.py")
|
||||
if(BUILD_opencv_nonfree)
|
||||
file(GLOB py_nonfree_tests modules/python/test/nonfree_tests/*.py)
|
||||
install(PROGRAMS ${py_nonfree_tests} DESTINATION ${OPENCV_TEST_INSTALL_PATH}/nonfree_tests COMPONENT tests)
|
||||
endif()
|
||||
set(OPENCV_PYTHON_TESTS_LIST "test.py")
|
||||
endif()
|
||||
if(WIN32)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
|
||||
@@ -883,6 +893,7 @@ if(DEFINED WITH_FFMPEG)
|
||||
status(" format:" HAVE_FFMPEG_FORMAT THEN "YES (ver ${ALIASOF_libavformat_VERSION})" ELSE NO)
|
||||
status(" util:" HAVE_FFMPEG_UTIL THEN "YES (ver ${ALIASOF_libavutil_VERSION})" ELSE NO)
|
||||
status(" swscale:" HAVE_FFMPEG_SWSCALE THEN "YES (ver ${ALIASOF_libswscale_VERSION})" ELSE NO)
|
||||
status(" resample:" HAVE_FFMPEG_RESAMPLE THEN "YES (ver ${ALIASOF_libavresample_VERSION})" ELSE NO)
|
||||
status(" gentoo-style:" HAVE_GENTOO_FFMPEG THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_FFMPEG)
|
||||
|
||||
@@ -991,6 +1002,7 @@ if(HAVE_CUDA)
|
||||
status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN})
|
||||
status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX})
|
||||
status(" Use fast math:" CUDA_FAST_MATH THEN YES ELSE NO)
|
||||
status(" Tiny gpu module:" BUILD_TINY_GPU_MODULE THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(HAVE_OPENCL)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
## Contributing guidelines
|
||||
|
||||
All guidelines for contributing to the OpenCV repository can be found at [`How to contribute guideline`](https://github.com/Itseez/opencv/wiki/How_to_contribute).
|
||||
@@ -1,7 +1,5 @@
|
||||
### OpenCV: Open Source Computer Vision Library
|
||||
|
||||
[](https://www.gittip.com/OpenCV/)
|
||||
|
||||
#### Resources
|
||||
|
||||
* Homepage: <http://opencv.org>
|
||||
|
||||
@@ -3,3 +3,4 @@ link_libraries(${OPENCV_LINKER_LIBS})
|
||||
add_subdirectory(haartraining)
|
||||
add_subdirectory(traincascade)
|
||||
add_subdirectory(annotation)
|
||||
add_subdirectory(visualisation)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
SET(deps opencv_core opencv_highgui opencv_imgproc)
|
||||
ocv_check_dependencies(${deps})
|
||||
SET(OPENCV_ANNOTATION_DEPS opencv_core opencv_highgui opencv_imgproc)
|
||||
ocv_check_dependencies(${OPENCV_ANNOTATION_DEPS})
|
||||
|
||||
if(NOT OCV_DEPENDENCIES_FOUND)
|
||||
return()
|
||||
@@ -8,18 +8,18 @@ endif()
|
||||
project(annotation)
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${deps})
|
||||
ocv_include_modules(${OPENCV_ANNOTATION_DEPS})
|
||||
|
||||
set(annotation_files opencv_annotation.cpp)
|
||||
set(the_target opencv_annotation)
|
||||
|
||||
add_executable(${the_target} opencv_annotation.cpp)
|
||||
target_link_libraries(${the_target} ${deps})
|
||||
add_executable(${the_target} ${annotation_files})
|
||||
target_link_libraries(${the_target} ${OPENCV_ANNOTATION_DEPS})
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
OUTPUT_NAME "opencv_annotation")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
|
||||
@@ -1,8 +1,54 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*****************************************************************************************************
|
||||
USAGE:
|
||||
./opencv_annotation -images <folder location> -annotations <ouput file>
|
||||
|
||||
Created by: Puttemans Steven
|
||||
Created by: Puttemans Steven - February 2015
|
||||
Adapted by: Puttemans Steven - April 2016 - Vectorize the process to enable better processing
|
||||
+ early leave and store by pressing an ESC key
|
||||
+ enable delete `d` button, to remove last annotation
|
||||
*****************************************************************************************************/
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
@@ -12,21 +58,26 @@ Created by: Puttemans Steven
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
// Function prototypes
|
||||
void on_mouse(int, int, int, int, void*);
|
||||
string int2string(int);
|
||||
void get_annotations(Mat, stringstream*);
|
||||
vector<Rect> get_annotations(Mat);
|
||||
|
||||
// Public parameters
|
||||
Mat image;
|
||||
int roi_x0 = 0, roi_y0 = 0, roi_x1 = 0, roi_y1 = 0, num_of_rec = 0;
|
||||
bool start_draw = false;
|
||||
bool start_draw = false, stop = false;
|
||||
|
||||
// Window name for visualisation purposes
|
||||
const string window_name="OpenCV Based Annotation Tool";
|
||||
const string window_name = "OpenCV Based Annotation Tool";
|
||||
|
||||
// FUNCTION : Mouse response for selecting objects in images
|
||||
// If left button is clicked, start drawing a rectangle as long as mouse moves
|
||||
@@ -34,7 +85,7 @@ const string window_name="OpenCV Based Annotation Tool";
|
||||
void on_mouse(int event, int x, int y, int , void * )
|
||||
{
|
||||
// Action when left button is clicked
|
||||
if(event == CV_EVENT_LBUTTONDOWN)
|
||||
if(event == EVENT_LBUTTONDOWN)
|
||||
{
|
||||
if(!start_draw)
|
||||
{
|
||||
@@ -47,8 +98,9 @@ void on_mouse(int event, int x, int y, int , void * )
|
||||
start_draw = false;
|
||||
}
|
||||
}
|
||||
// Action when mouse is moving
|
||||
if((event == CV_EVENT_MOUSEMOVE) && start_draw)
|
||||
|
||||
// Action when mouse is moving and drawing is enabled
|
||||
if((event == EVENT_MOUSEMOVE) && start_draw)
|
||||
{
|
||||
// Redraw bounding box for annotation
|
||||
Mat current_view;
|
||||
@@ -58,75 +110,88 @@ void on_mouse(int event, int x, int y, int , void * )
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION : snippet to convert an integer value to a string using a clean function
|
||||
// instead of creating a stringstream each time inside the main code
|
||||
string int2string(int num)
|
||||
// FUNCTION : returns a vector of Rect objects given an image containing positive object instances
|
||||
vector<Rect> get_annotations(Mat input_image)
|
||||
{
|
||||
stringstream temp_stream;
|
||||
temp_stream << num;
|
||||
return temp_stream.str();
|
||||
}
|
||||
vector<Rect> current_annotations;
|
||||
|
||||
// FUNCTION : given an image containing positive object instances, add all the object
|
||||
// annotations to a known stringstream
|
||||
void get_annotations(Mat input_image, stringstream* output_stream)
|
||||
{
|
||||
// Make it possible to exit the annotation
|
||||
bool stop = false;
|
||||
|
||||
// Reset the num_of_rec element at each iteration
|
||||
// Make sure the global image is set to the current image
|
||||
num_of_rec = 0;
|
||||
image = input_image;
|
||||
// Make it possible to exit the annotation process
|
||||
stop = false;
|
||||
|
||||
// Init window interface and couple mouse actions
|
||||
namedWindow(window_name, WINDOW_AUTOSIZE);
|
||||
setMouseCallback(window_name, on_mouse);
|
||||
|
||||
image = input_image;
|
||||
imshow(window_name, image);
|
||||
stringstream temp_stream;
|
||||
int key_pressed = 0;
|
||||
|
||||
do
|
||||
{
|
||||
// Get a temporary image clone
|
||||
Mat temp_image = input_image.clone();
|
||||
Rect currentRect(0, 0, 0, 0);
|
||||
|
||||
// Keys for processing
|
||||
// You need to select one for confirming a selection and one to continue to the next image
|
||||
// Based on the universal ASCII code of the keystroke: http://www.asciitable.com/
|
||||
// c = 99 add rectangle to current image
|
||||
// n = 110 save added rectangles and show next image
|
||||
// <ESC> = 27 exit program
|
||||
// <c> = 99 add rectangle to current image
|
||||
// <n> = 110 save added rectangles and show next image
|
||||
// <d> = 100 delete the last annotation made
|
||||
// <ESC> = 27 exit program
|
||||
key_pressed = 0xFF & waitKey(0);
|
||||
switch( key_pressed )
|
||||
{
|
||||
case 27:
|
||||
destroyWindow(window_name);
|
||||
stop = true;
|
||||
break;
|
||||
case 99:
|
||||
// Add a rectangle to the list
|
||||
num_of_rec++;
|
||||
// Draw initiated from top left corner
|
||||
if(roi_x0<roi_x1 && roi_y0<roi_y1)
|
||||
{
|
||||
temp_stream << " " << int2string(roi_x0) << " " << int2string(roi_y0) << " " << int2string(roi_x1-roi_x0) << " " << int2string(roi_y1-roi_y0);
|
||||
currentRect.x = roi_x0;
|
||||
currentRect.y = roi_y0;
|
||||
currentRect.width = roi_x1-roi_x0;
|
||||
currentRect.height = roi_y1-roi_y0;
|
||||
}
|
||||
// Draw initiated from bottom right corner
|
||||
if(roi_x0>roi_x1 && roi_y0>roi_y1)
|
||||
{
|
||||
temp_stream << " " << int2string(roi_x1) << " " << int2string(roi_y1) << " " << int2string(roi_x0-roi_x1) << " " << int2string(roi_y0-roi_y1);
|
||||
currentRect.x = roi_x1;
|
||||
currentRect.y = roi_y1;
|
||||
currentRect.width = roi_x0-roi_x1;
|
||||
currentRect.height = roi_y0-roi_y1;
|
||||
}
|
||||
// Draw initiated from top right corner
|
||||
if(roi_x0>roi_x1 && roi_y0<roi_y1)
|
||||
{
|
||||
temp_stream << " " << int2string(roi_x1) << " " << int2string(roi_y0) << " " << int2string(roi_x0-roi_x1) << " " << int2string(roi_y1-roi_y0);
|
||||
currentRect.x = roi_x1;
|
||||
currentRect.y = roi_y0;
|
||||
currentRect.width = roi_x0-roi_x1;
|
||||
currentRect.height = roi_y1-roi_y0;
|
||||
}
|
||||
// Draw initiated from bottom left corner
|
||||
if(roi_x0<roi_x1 && roi_y0>roi_y1)
|
||||
{
|
||||
temp_stream << " " << int2string(roi_x0) << " " << int2string(roi_y1) << " " << int2string(roi_x1-roi_x0) << " " << int2string(roi_y0-roi_y1);
|
||||
currentRect.x = roi_x0;
|
||||
currentRect.y = roi_y1;
|
||||
currentRect.width = roi_x1-roi_x0;
|
||||
currentRect.height = roi_y0-roi_y1;
|
||||
}
|
||||
|
||||
rectangle(input_image, Point(roi_x0,roi_y0), Point(roi_x1,roi_y1), Scalar(0,255,0), 1);
|
||||
|
||||
// Draw the rectangle on the canvas
|
||||
// Add the rectangle to the vector of annotations
|
||||
current_annotations.push_back(currentRect);
|
||||
break;
|
||||
case 100:
|
||||
// Remove the last annotation
|
||||
if(current_annotations.size() > 0){
|
||||
current_annotations.pop_back();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Default case --> do nothing at all
|
||||
// Other keystrokes can simply be ignored
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -135,26 +200,40 @@ void get_annotations(Mat input_image, stringstream* output_stream)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw all the current rectangles onto the top image and make sure that the global image is linked
|
||||
for(int i=0; i < (int)current_annotations.size(); i++){
|
||||
rectangle(temp_image, current_annotations[i], Scalar(0,255,0), 1);
|
||||
}
|
||||
image = temp_image;
|
||||
|
||||
// Force an explicit redraw of the canvas --> necessary to visualize delete correctly
|
||||
imshow(window_name, image);
|
||||
}
|
||||
// Continue as long as the next image key has not been pressed
|
||||
while(key_pressed != 110);
|
||||
|
||||
// If there are annotations AND the next image key is pressed
|
||||
// Write the image annotations to the file
|
||||
if(num_of_rec>0 && key_pressed==110)
|
||||
{
|
||||
*output_stream << " " << num_of_rec << temp_stream.str() << endl;
|
||||
}
|
||||
|
||||
// Close down the window
|
||||
destroyWindow(window_name);
|
||||
|
||||
// Return the data
|
||||
return current_annotations;
|
||||
}
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
// If no arguments are given, then supply some information on how this tool works
|
||||
if( argc == 1 ){
|
||||
cout << "Usage: " << argv[0] << endl;
|
||||
cout << " -images <folder_location> [example - /data/testimages/]" << endl;
|
||||
cout << " -annotations <ouput_file> [example - /data/annotations.txt]" << endl;
|
||||
cout << "TIP: Use absolute paths to avoid any problems with the software!" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read in the input arguments
|
||||
string image_folder;
|
||||
string annotations;
|
||||
string annotations_file;
|
||||
for(int i = 1; i < argc; ++i )
|
||||
{
|
||||
if( !strcmp( argv[i], "-images" ) )
|
||||
@@ -163,14 +242,34 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
else if( !strcmp( argv[i], "-annotations" ) )
|
||||
{
|
||||
annotations = argv[++i];
|
||||
annotations_file = argv[++i];
|
||||
}
|
||||
}
|
||||
|
||||
// Create the outputfilestream
|
||||
ofstream output(annotations.c_str());
|
||||
// Check if the folder actually exists
|
||||
// If -1 is returned then the folder actually exists, and thus you can continue
|
||||
// In all other cases there was a folder creation and thus the folder did not exist
|
||||
#if defined(_WIN32)
|
||||
if(_mkdir(image_folder.c_str()) != -1){
|
||||
// Generate an error message
|
||||
cerr << "The image folder given does not exist. Please check again!" << endl;
|
||||
// Remove the created folder again, to ensure a second run with same code fails again
|
||||
_rmdir(image_folder.c_str());
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if(mkdir(image_folder.c_str(), 0777) != -1){
|
||||
// Generate an error message
|
||||
cerr << "The image folder given does not exist. Please check again!" << endl;
|
||||
// Remove the created folder again, to ensure a second run with same code fails again
|
||||
remove(image_folder.c_str());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Start by processing the data
|
||||
// Return the image filenames inside the image folder
|
||||
vector< vector<Rect> > annotations;
|
||||
vector<String> filenames;
|
||||
String folder(image_folder);
|
||||
glob(folder, filenames);
|
||||
@@ -182,14 +281,38 @@ int main( int argc, const char** argv )
|
||||
// Read in an image
|
||||
Mat current_image = imread(filenames[i]);
|
||||
|
||||
// Perform annotations & generate corresponding output
|
||||
stringstream output_stream;
|
||||
get_annotations(current_image, &output_stream);
|
||||
|
||||
// Store the annotations, write to the output file
|
||||
if (output_stream.str() != ""){
|
||||
output << filenames[i] << output_stream.str();
|
||||
// Check if the image is actually read - avoid other files in the folder, because glob() takes them all
|
||||
// If not then simply skip this iteration
|
||||
if(current_image.empty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Perform annotations & store the result inside the vectorized structure
|
||||
vector<Rect> current_annotations = get_annotations(current_image);
|
||||
annotations.push_back(current_annotations);
|
||||
|
||||
// Check if the ESC key was hit, then exit earlier then expected
|
||||
if(stop){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// When all data is processed, store the data gathered inside the proper file
|
||||
// This now even gets called when the ESC button was hit to store preliminary results
|
||||
ofstream output(annotations_file.c_str());
|
||||
if ( !output.is_open() ){
|
||||
cerr << "The path for the output file contains an error and could not be opened. Please check again!" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Store the annotations, write to the output file
|
||||
for(int i = 0; i < (int)annotations.size(); i++){
|
||||
output << filenames[i] << " " << annotations[i].size();
|
||||
for(int j=0; j < (int)annotations[i].size(); j++){
|
||||
Rect temp = annotations[i][j];
|
||||
output << " " << temp.x << " " << temp.y << " " << temp.width << " " << temp.height;
|
||||
}
|
||||
output << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -14,8 +14,6 @@ if(WIN32)
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
link_libraries(${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Library
|
||||
# -----------------------------------------------------------
|
||||
@@ -35,11 +33,11 @@ set(cvhaartraining_lib_src
|
||||
)
|
||||
|
||||
add_library(opencv_haartraining_engine STATIC ${cvhaartraining_lib_src})
|
||||
target_link_libraries(opencv_haartraining_engine ${OPENCV_HAARTRAINING_DEPS})
|
||||
set_target_properties(opencv_haartraining_engine PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
@@ -47,6 +45,7 @@ set_target_properties(opencv_haartraining_engine PROPERTIES
|
||||
# -----------------------------------------------------------
|
||||
|
||||
add_executable(opencv_haartraining cvhaartraining.h haartraining.cpp)
|
||||
target_link_libraries(opencv_haartraining ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine)
|
||||
set_target_properties(opencv_haartraining PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "opencv_haartraining")
|
||||
@@ -56,6 +55,7 @@ set_target_properties(opencv_haartraining PROPERTIES
|
||||
# -----------------------------------------------------------
|
||||
|
||||
add_executable(opencv_createsamples cvhaartraining.h createsamples.cpp)
|
||||
target_link_libraries(opencv_createsamples ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine)
|
||||
set_target_properties(opencv_createsamples PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "opencv_createsamples")
|
||||
@@ -64,6 +64,7 @@ set_target_properties(opencv_createsamples PROPERTIES
|
||||
# performance
|
||||
# -----------------------------------------------------------
|
||||
add_executable(opencv_performance performance.cpp)
|
||||
target_link_libraries(opencv_performance ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine)
|
||||
set_target_properties(opencv_performance PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "opencv_performance")
|
||||
|
||||
@@ -26,7 +26,6 @@ set_target_properties(${the_target} PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
OUTPUT_NAME "opencv_traincascade")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
|
||||
+28
-28
@@ -374,7 +374,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* udst_idx = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
vi*sample_count + data_root->offset);
|
||||
(size_t)vi*sample_count + data_root->offset);
|
||||
for( int i = 0; i < num_valid; i++ )
|
||||
{
|
||||
idx = src_idx[i];
|
||||
@@ -387,7 +387,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
else
|
||||
{
|
||||
int* idst_idx = buf->data.i + root->buf_idx*get_length_subbuf() +
|
||||
vi*sample_count + root->offset;
|
||||
(size_t)vi*sample_count + root->offset;
|
||||
for( int i = 0; i < num_valid; i++ )
|
||||
{
|
||||
idx = src_idx[i];
|
||||
@@ -404,14 +404,14 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* udst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
(workVarCount-1)*sample_count + root->offset);
|
||||
(size_t)(workVarCount-1)*sample_count + root->offset);
|
||||
for( int i = 0; i < count; i++ )
|
||||
udst[i] = (unsigned short)src_lbls[sidx[i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
int* idst = buf->data.i + root->buf_idx*get_length_subbuf() +
|
||||
(workVarCount-1)*sample_count + root->offset;
|
||||
(size_t)(workVarCount-1)*sample_count + root->offset;
|
||||
for( int i = 0; i < count; i++ )
|
||||
idst[i] = src_lbls[sidx[i]];
|
||||
}
|
||||
@@ -421,14 +421,14 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
|
||||
if (is_buf_16u)
|
||||
{
|
||||
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
|
||||
workVarCount*sample_count + root->offset);
|
||||
(size_t)workVarCount*sample_count + root->offset);
|
||||
for( int i = 0; i < count; i++ )
|
||||
sample_idx_dst[i] = (unsigned short)sample_idx_src[sidx[i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
int* sample_idx_dst = buf->data.i + root->buf_idx*get_length_subbuf() +
|
||||
workVarCount*sample_count + root->offset;
|
||||
(size_t)workVarCount*sample_count + root->offset;
|
||||
for( int i = 0; i < count; i++ )
|
||||
sample_idx_dst[i] = sample_idx_src[sidx[i]];
|
||||
}
|
||||
@@ -614,9 +614,9 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
|
||||
|
||||
// set sample labels
|
||||
if (is_buf_16u)
|
||||
udst = (unsigned short*)(buf->data.s + work_var_count*sample_count);
|
||||
udst = (unsigned short*)(buf->data.s + (size_t)work_var_count*sample_count);
|
||||
else
|
||||
idst = buf->data.i + work_var_count*sample_count;
|
||||
idst = buf->data.i + (size_t)work_var_count*sample_count;
|
||||
|
||||
for (int si = 0; si < sample_count; si++)
|
||||
{
|
||||
@@ -684,11 +684,11 @@ void CvCascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* o
|
||||
if ( vi < numPrecalcIdx )
|
||||
{
|
||||
if( !is_buf_16u )
|
||||
*sortedIndices = buf->data.i + n->buf_idx*get_length_subbuf() + vi*sample_count + n->offset;
|
||||
*sortedIndices = buf->data.i + n->buf_idx*get_length_subbuf() + (size_t)vi*sample_count + n->offset;
|
||||
else
|
||||
{
|
||||
const unsigned short* shortIndices = (const unsigned short*)(buf->data.s + n->buf_idx*get_length_subbuf() +
|
||||
vi*sample_count + n->offset );
|
||||
(size_t)vi*sample_count + n->offset );
|
||||
for( int i = 0; i < nodeSampleCount; i++ )
|
||||
sortedIndicesBuf[i] = shortIndices[i];
|
||||
|
||||
@@ -799,14 +799,14 @@ struct FeatureIdxOnlyPrecalc : ParallelLoopBody
|
||||
{
|
||||
valCachePtr[si] = (*featureEvaluator)( fi, si );
|
||||
if ( is_buf_16u )
|
||||
*(udst + fi*sample_count + si) = (unsigned short)si;
|
||||
*(udst + (size_t)fi*sample_count + si) = (unsigned short)si;
|
||||
else
|
||||
*(idst + fi*sample_count + si) = si;
|
||||
*(idst + (size_t)fi*sample_count + si) = si;
|
||||
}
|
||||
if ( is_buf_16u )
|
||||
icvSortUShAux( udst + fi*sample_count, sample_count, valCachePtr );
|
||||
icvSortUShAux( udst + (size_t)fi*sample_count, sample_count, valCachePtr );
|
||||
else
|
||||
icvSortIntAux( idst + fi*sample_count, sample_count, valCachePtr );
|
||||
icvSortIntAux( idst + (size_t)fi*sample_count, sample_count, valCachePtr );
|
||||
}
|
||||
}
|
||||
const CvFeatureEvaluator* featureEvaluator;
|
||||
@@ -835,14 +835,14 @@ struct FeatureValAndIdxPrecalc : ParallelLoopBody
|
||||
{
|
||||
valCache->at<float>(fi,si) = (*featureEvaluator)( fi, si );
|
||||
if ( is_buf_16u )
|
||||
*(udst + fi*sample_count + si) = (unsigned short)si;
|
||||
*(udst + (size_t)fi*sample_count + si) = (unsigned short)si;
|
||||
else
|
||||
*(idst + fi*sample_count + si) = si;
|
||||
*(idst + (size_t)fi*sample_count + si) = si;
|
||||
}
|
||||
if ( is_buf_16u )
|
||||
icvSortUShAux( udst + fi*sample_count, sample_count, valCache->ptr<float>(fi) );
|
||||
icvSortUShAux( udst + (size_t)fi*sample_count, sample_count, valCache->ptr<float>(fi) );
|
||||
else
|
||||
icvSortIntAux( idst + fi*sample_count, sample_count, valCache->ptr<float>(fi) );
|
||||
icvSortIntAux( idst + (size_t)fi*sample_count, sample_count, valCache->ptr<float>(fi) );
|
||||
}
|
||||
}
|
||||
const CvFeatureEvaluator* featureEvaluator;
|
||||
@@ -1165,9 +1165,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
|
||||
if (data->is_buf_16u)
|
||||
{
|
||||
unsigned short *ldst = (unsigned short *)(buf->data.s + left->buf_idx*length_buf_row +
|
||||
(workVarCount-1)*scount + left->offset);
|
||||
(size_t)(workVarCount-1)*scount + left->offset);
|
||||
unsigned short *rdst = (unsigned short *)(buf->data.s + right->buf_idx*length_buf_row +
|
||||
(workVarCount-1)*scount + right->offset);
|
||||
(size_t)(workVarCount-1)*scount + right->offset);
|
||||
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
@@ -1188,9 +1188,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
|
||||
else
|
||||
{
|
||||
int *ldst = buf->data.i + left->buf_idx*length_buf_row +
|
||||
(workVarCount-1)*scount + left->offset;
|
||||
(size_t)(workVarCount-1)*scount + left->offset;
|
||||
int *rdst = buf->data.i + right->buf_idx*length_buf_row +
|
||||
(workVarCount-1)*scount + right->offset;
|
||||
(size_t)(workVarCount-1)*scount + right->offset;
|
||||
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
@@ -1218,9 +1218,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
|
||||
if (data->is_buf_16u)
|
||||
{
|
||||
unsigned short* ldst = (unsigned short*)(buf->data.s + left->buf_idx*length_buf_row +
|
||||
workVarCount*scount + left->offset);
|
||||
(size_t)workVarCount*scount + left->offset);
|
||||
unsigned short* rdst = (unsigned short*)(buf->data.s + right->buf_idx*length_buf_row +
|
||||
workVarCount*scount + right->offset);
|
||||
(size_t)workVarCount*scount + right->offset);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
unsigned short idx = (unsigned short)tempBuf[i];
|
||||
@@ -1239,9 +1239,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
|
||||
else
|
||||
{
|
||||
int* ldst = buf->data.i + left->buf_idx*length_buf_row +
|
||||
workVarCount*scount + left->offset;
|
||||
(size_t)workVarCount*scount + left->offset;
|
||||
int* rdst = buf->data.i + right->buf_idx*length_buf_row +
|
||||
workVarCount*scount + right->offset;
|
||||
(size_t)workVarCount*scount + right->offset;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int idx = tempBuf[i];
|
||||
@@ -1410,7 +1410,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
|
||||
if (data->is_buf_16u)
|
||||
{
|
||||
unsigned short* labels = (unsigned short*)(buf->data.s + data->data_root->buf_idx*length_buf_row +
|
||||
data->data_root->offset + (data->work_var_count-1)*data->sample_count);
|
||||
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count);
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
// save original categorical responses {0,1}, convert them to {-1,1}
|
||||
@@ -1428,7 +1428,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
|
||||
else
|
||||
{
|
||||
int* labels = buf->data.i + data->data_root->buf_idx*length_buf_row +
|
||||
data->data_root->offset + (data->work_var_count-1)*data->sample_count;
|
||||
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count;
|
||||
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
|
||||
@@ -136,7 +136,8 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
const CvCascadeParams& _cascadeParams,
|
||||
const CvFeatureParams& _featureParams,
|
||||
const CvCascadeBoostParams& _stageParams,
|
||||
bool baseFormatSave )
|
||||
bool baseFormatSave,
|
||||
double acceptanceRatioBreakValue)
|
||||
{
|
||||
// Start recording clock ticks for training time output
|
||||
const clock_t begin_time = clock();
|
||||
@@ -186,9 +187,11 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
cout << "numStages: " << numStages << endl;
|
||||
cout << "precalcValBufSize[Mb] : " << _precalcValBufSize << endl;
|
||||
cout << "precalcIdxBufSize[Mb] : " << _precalcIdxBufSize << endl;
|
||||
cout << "acceptanceRatioBreakValue : " << acceptanceRatioBreakValue << endl;
|
||||
cascadeParams.printAttrs();
|
||||
stageParams->printAttrs();
|
||||
featureParams->printAttrs();
|
||||
cout << "Number of unique features given windowSize [" << _cascadeParams.winSize.width << "," << _cascadeParams.winSize.height << "] : " << featureEvaluator->getNumFeatures() << "" << endl;
|
||||
|
||||
int startNumStages = (int)stageClassifiers.size();
|
||||
if ( startNumStages > 1 )
|
||||
@@ -208,15 +211,20 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
if ( !updateTrainingSet( requiredLeafFARate, tempLeafFARate ) )
|
||||
{
|
||||
cout << "Train dataset for temp stage can not be filled. "
|
||||
"Branch training terminated." << endl;
|
||||
"Branch training terminated." << endl;
|
||||
break;
|
||||
}
|
||||
if( tempLeafFARate <= requiredLeafFARate )
|
||||
{
|
||||
cout << "Required leaf false alarm rate achieved. "
|
||||
"Branch training terminated." << endl;
|
||||
"Branch training terminated." << endl;
|
||||
break;
|
||||
}
|
||||
if( (tempLeafFARate <= acceptanceRatioBreakValue) && (acceptanceRatioBreakValue >= 0) ){
|
||||
cout << "The required acceptanceRatio for the model has been reached to avoid overfitting of trainingdata. "
|
||||
"Branch training terminated." << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
CvCascadeBoost* tempStage = new CvCascadeBoost;
|
||||
bool isStageTrained = tempStage->train( (CvFeatureEvaluator*)featureEvaluator,
|
||||
@@ -329,7 +337,7 @@ int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositiv
|
||||
consumed++;
|
||||
|
||||
featureEvaluator->setImage( img, isPositive ? 1 : 0, i );
|
||||
if( predict( i ) == 1.0F )
|
||||
if( predict( i ) == 1 )
|
||||
{
|
||||
getcount++;
|
||||
printf("%s current samples: %d\r", isPositive ? "POS":"NEG", getcount);
|
||||
|
||||
@@ -96,7 +96,8 @@ public:
|
||||
const CvCascadeParams& _cascadeParams,
|
||||
const CvFeatureParams& _featureParams,
|
||||
const CvCascadeBoostParams& _stageParams,
|
||||
bool baseFormatSave = false );
|
||||
bool baseFormatSave = false,
|
||||
double acceptanceRatioBreakValue = -1.0 );
|
||||
private:
|
||||
int predict( int sampleIdx );
|
||||
void save( const std::string cascadeDirName, bool baseFormat = false );
|
||||
|
||||
@@ -32,20 +32,12 @@ bool CvCascadeImageReader::NegReader::create( const string _filename, Size _winS
|
||||
if ( !file.is_open() )
|
||||
return false;
|
||||
|
||||
size_t pos = _filename.rfind('\\');
|
||||
char dlmrt = '\\';
|
||||
if (pos == string::npos)
|
||||
{
|
||||
pos = _filename.rfind('/');
|
||||
dlmrt = '/';
|
||||
}
|
||||
dirname = pos == string::npos ? "" : _filename.substr(0, pos) + dlmrt;
|
||||
while( !file.eof() )
|
||||
{
|
||||
std::getline(file, str);
|
||||
if (str.empty()) break;
|
||||
if (str.at(0) == '#' ) continue; /* comment */
|
||||
imgFilenames.push_back(dirname + str);
|
||||
imgFilenames.push_back(str);
|
||||
}
|
||||
file.close();
|
||||
|
||||
|
||||
@@ -14,9 +14,10 @@ int main( int argc, char* argv[] )
|
||||
int numPos = 2000;
|
||||
int numNeg = 1000;
|
||||
int numStages = 20;
|
||||
int precalcValBufSize = 256,
|
||||
precalcIdxBufSize = 256;
|
||||
int precalcValBufSize = 1024,
|
||||
precalcIdxBufSize = 1024;
|
||||
bool baseFormatSave = false;
|
||||
double acceptanceRatioBreakValue = -1.0;
|
||||
|
||||
CvCascadeParams cascadeParams;
|
||||
CvCascadeBoostParams stageParams;
|
||||
@@ -37,6 +38,7 @@ int main( int argc, char* argv[] )
|
||||
cout << " [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = " << precalcValBufSize << ">]" << endl;
|
||||
cout << " [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = " << precalcIdxBufSize << ">]" << endl;
|
||||
cout << " [-baseFormatSave]" << endl;
|
||||
cout << " [-acceptanceRatioBreakValue <value> = " << acceptanceRatioBreakValue << ">]" << endl;
|
||||
cascadeParams.printDefaults();
|
||||
stageParams.printDefaults();
|
||||
for( int fi = 0; fi < fc; fi++ )
|
||||
@@ -83,6 +85,10 @@ int main( int argc, char* argv[] )
|
||||
{
|
||||
baseFormatSave = true;
|
||||
}
|
||||
else if( !strcmp( argv[i], "-acceptanceRatioBreakValue" ) )
|
||||
{
|
||||
acceptanceRatioBreakValue = atof(argv[++i]);
|
||||
}
|
||||
else if ( cascadeParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
||||
else if ( stageParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
||||
else if ( !set )
|
||||
@@ -108,6 +114,7 @@ int main( int argc, char* argv[] )
|
||||
cascadeParams,
|
||||
*featureParams[cascadeParams.featureType],
|
||||
stageParams,
|
||||
baseFormatSave );
|
||||
baseFormatSave,
|
||||
acceptanceRatioBreakValue );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
SET(OPENCV_VISUALISATION_DEPS opencv_core opencv_highgui opencv_imgproc)
|
||||
ocv_check_dependencies(${OPENCV_VISUALISATION_DEPS})
|
||||
|
||||
if(NOT OCV_DEPENDENCIES_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(visualisation)
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${OPENCV_VISUALISATION_DEPS})
|
||||
|
||||
set(visualisation_files opencv_visualisation.cpp)
|
||||
set(the_target opencv_visualisation)
|
||||
|
||||
add_executable(${the_target} ${visualisation_files})
|
||||
target_link_libraries(${the_target} ${OPENCV_VISUALISATION_DEPS})
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
OUTPUT_NAME "opencv_visualisation")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "applications")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
@@ -0,0 +1,350 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*****************************************************************************************************
|
||||
|
||||
Software for visualising cascade classifier models trained by OpenCV and to get a better
|
||||
understanding of the used features.
|
||||
|
||||
USAGE:
|
||||
./visualise_models -model <model.xml> -image <ref.png> -data <output folder>
|
||||
|
||||
LIMITS
|
||||
- Use an absolute path for the output folder to ensure the tool works
|
||||
- Only handles cascade classifier models
|
||||
- Handles stumps only for the moment
|
||||
- Needs a valid training/test sample window with the original model dimensions, passed as `ref.png`
|
||||
- Can handle HAAR and LBP features
|
||||
|
||||
Created by: Puttemans Steven - April 2016
|
||||
*****************************************************************************************************/
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
struct rect_data{
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
float weight;
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
// Read in the input arguments
|
||||
string model = "";
|
||||
string output_folder = "";
|
||||
string image_ref = "";
|
||||
for(int i = 1; i < argc; ++i )
|
||||
{
|
||||
if( !strcmp( argv[i], "-model" ) )
|
||||
{
|
||||
model = argv[++i];
|
||||
}else if( !strcmp( argv[i], "-image" ) ){
|
||||
image_ref = argv[++i];
|
||||
}else if( !strcmp( argv[i], "-data" ) ){
|
||||
output_folder = argv[++i];
|
||||
}
|
||||
}
|
||||
|
||||
// Value for timing
|
||||
// You can increase this to have a better visualisation during the generation
|
||||
int timing = 1;
|
||||
|
||||
// Value for cols of storing elements
|
||||
int cols_prefered = 5;
|
||||
|
||||
// Open the XML model
|
||||
FileStorage fs;
|
||||
fs.open(model, FileStorage::READ);
|
||||
|
||||
// Get a the required information
|
||||
// First decide which feature type we are using
|
||||
FileNode cascade = fs["cascade"];
|
||||
string feature_type = cascade["featureType"];
|
||||
bool haar = false, lbp = false;
|
||||
if (feature_type.compare("HAAR") == 0){
|
||||
haar = true;
|
||||
}
|
||||
if (feature_type.compare("LBP") == 0){
|
||||
lbp = true;
|
||||
}
|
||||
if ( feature_type.compare("HAAR") != 0 && feature_type.compare("LBP")){
|
||||
cerr << "The model is not an HAAR or LBP feature based model!" << endl;
|
||||
cerr << "Please select a model that can be visualized by the software." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// We make a visualisation mask - which increases the window to make it at least a bit more visible
|
||||
int resize_factor = 10;
|
||||
int resize_storage_factor = 10;
|
||||
Mat reference_image = imread(image_ref, IMREAD_GRAYSCALE );
|
||||
Mat visualization;
|
||||
resize(reference_image, visualization, Size(reference_image.cols * resize_factor, reference_image.rows * resize_factor));
|
||||
|
||||
// First recover for each stage the number of weak features and their index
|
||||
// Important since it is NOT sequential when using LBP features
|
||||
vector< vector<int> > stage_features;
|
||||
FileNode stages = cascade["stages"];
|
||||
FileNodeIterator it_stages = stages.begin(), it_stages_end = stages.end();
|
||||
int idx = 0;
|
||||
for( ; it_stages != it_stages_end; it_stages++, idx++ ){
|
||||
vector<int> current_feature_indexes;
|
||||
FileNode weak_classifiers = (*it_stages)["weakClassifiers"];
|
||||
FileNodeIterator it_weak = weak_classifiers.begin(), it_weak_end = weak_classifiers.end();
|
||||
vector<int> values;
|
||||
for(int idy = 0; it_weak != it_weak_end; it_weak++, idy++ ){
|
||||
(*it_weak)["internalNodes"] >> values;
|
||||
current_feature_indexes.push_back( (int)values[2] );
|
||||
}
|
||||
stage_features.push_back(current_feature_indexes);
|
||||
}
|
||||
|
||||
// If the output option has been chosen than we will store a combined image plane for
|
||||
// each stage, containing all weak classifiers for that stage.
|
||||
bool draw_planes = false;
|
||||
stringstream output_video;
|
||||
output_video << output_folder << "model_visualization.avi";
|
||||
VideoWriter result_video;
|
||||
if( output_folder.compare("") != 0 ){
|
||||
draw_planes = true;
|
||||
result_video.open(output_video.str(), CV_FOURCC('X','V','I','D'), 15, Size(reference_image.cols * resize_factor, reference_image.rows * resize_factor), false);
|
||||
}
|
||||
|
||||
if(haar){
|
||||
// Grab the corresponding features dimensions and weights
|
||||
FileNode features = cascade["features"];
|
||||
vector< vector< rect_data > > feature_data;
|
||||
FileNodeIterator it_features = features.begin(), it_features_end = features.end();
|
||||
for(int idf = 0; it_features != it_features_end; it_features++, idf++ ){
|
||||
vector< rect_data > current_feature_rectangles;
|
||||
FileNode rectangles = (*it_features)["rects"];
|
||||
int nrects = (int)rectangles.size();
|
||||
for(int k = 0; k < nrects; k++){
|
||||
rect_data current_data;
|
||||
FileNode single_rect = rectangles[k];
|
||||
current_data.x = (int)single_rect[0];
|
||||
current_data.y = (int)single_rect[1];
|
||||
current_data.w = (int)single_rect[2];
|
||||
current_data.h = (int)single_rect[3];
|
||||
current_data.weight = (float)single_rect[4];
|
||||
current_feature_rectangles.push_back(current_data);
|
||||
}
|
||||
feature_data.push_back(current_feature_rectangles);
|
||||
}
|
||||
|
||||
// Loop over each possible feature on its index, visualise on the mask and wait a bit,
|
||||
// then continue to the next feature.
|
||||
// If visualisations should be stored then do the in between calculations
|
||||
Mat image_plane;
|
||||
Mat metadata = Mat::zeros(150, 1000, CV_8UC1);
|
||||
vector< rect_data > current_rects;
|
||||
for(int sid = 0; sid < (int)stage_features.size(); sid ++){
|
||||
if(draw_planes){
|
||||
int features_nmbr = (int)stage_features[sid].size();
|
||||
int cols = cols_prefered;
|
||||
int rows = features_nmbr / cols;
|
||||
if( (features_nmbr % cols) > 0){
|
||||
rows++;
|
||||
}
|
||||
image_plane = Mat::zeros(reference_image.rows * resize_storage_factor * rows, reference_image.cols * resize_storage_factor * cols, CV_8UC1);
|
||||
}
|
||||
for(int fid = 0; fid < (int)stage_features[sid].size(); fid++){
|
||||
stringstream meta1, meta2;
|
||||
meta1 << "Stage " << sid << " / Feature " << fid;
|
||||
meta2 << "Rectangles: ";
|
||||
Mat temp_window = visualization.clone();
|
||||
Mat temp_metadata = metadata.clone();
|
||||
int current_feature_index = stage_features[sid][fid];
|
||||
current_rects = feature_data[current_feature_index];
|
||||
Mat single_feature = reference_image.clone();
|
||||
resize(single_feature, single_feature, Size(), resize_storage_factor, resize_storage_factor);
|
||||
for(int i = 0; i < (int)current_rects.size(); i++){
|
||||
rect_data local = current_rects[i];
|
||||
if(draw_planes){
|
||||
if(local.weight >= 0){
|
||||
rectangle(single_feature, Rect(local.x * resize_storage_factor, local.y * resize_storage_factor, local.w * resize_storage_factor, local.h * resize_storage_factor), Scalar(0), CV_FILLED);
|
||||
}else{
|
||||
rectangle(single_feature, Rect(local.x * resize_storage_factor, local.y * resize_storage_factor, local.w * resize_storage_factor, local.h * resize_storage_factor), Scalar(255), CV_FILLED);
|
||||
}
|
||||
}
|
||||
Rect part(local.x * resize_factor, local.y * resize_factor, local.w * resize_factor, local.h * resize_factor);
|
||||
meta2 << part << " (w " << local.weight << ") ";
|
||||
if(local.weight >= 0){
|
||||
rectangle(temp_window, part, Scalar(0), CV_FILLED);
|
||||
}else{
|
||||
rectangle(temp_window, part, Scalar(255), CV_FILLED);
|
||||
}
|
||||
}
|
||||
imshow("features", temp_window);
|
||||
putText(temp_window, meta1.str(), Point(15,15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
result_video.write(temp_window);
|
||||
// Copy the feature image if needed
|
||||
if(draw_planes){
|
||||
single_feature.copyTo(image_plane(Rect(0 + (fid%cols_prefered)*single_feature.cols, 0 + (fid/cols_prefered) * single_feature.rows, single_feature.cols, single_feature.rows)));
|
||||
}
|
||||
putText(temp_metadata, meta1.str(), Point(15,15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
putText(temp_metadata, meta2.str(), Point(15,40), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
imshow("metadata", temp_metadata);
|
||||
waitKey(timing);
|
||||
}
|
||||
//Store the stage image if needed
|
||||
if(draw_planes){
|
||||
stringstream save_location;
|
||||
save_location << output_folder << "stage_" << sid << ".png";
|
||||
imwrite(save_location.str(), image_plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(lbp){
|
||||
// Grab the corresponding features dimensions and weights
|
||||
FileNode features = cascade["features"];
|
||||
vector<Rect> feature_data;
|
||||
FileNodeIterator it_features = features.begin(), it_features_end = features.end();
|
||||
for(int idf = 0; it_features != it_features_end; it_features++, idf++ ){
|
||||
FileNode rectangle = (*it_features)["rect"];
|
||||
Rect current_feature ((int)rectangle[0], (int)rectangle[1], (int)rectangle[2], (int)rectangle[3]);
|
||||
feature_data.push_back(current_feature);
|
||||
}
|
||||
|
||||
// Loop over each possible feature on its index, visualise on the mask and wait a bit,
|
||||
// then continue to the next feature.
|
||||
Mat image_plane;
|
||||
Mat metadata = Mat::zeros(150, 1000, CV_8UC1);
|
||||
for(int sid = 0; sid < (int)stage_features.size(); sid ++){
|
||||
if(draw_planes){
|
||||
int features_nmbr = (int)stage_features[sid].size();
|
||||
int cols = cols_prefered;
|
||||
int rows = features_nmbr / cols;
|
||||
if( (features_nmbr % cols) > 0){
|
||||
rows++;
|
||||
}
|
||||
image_plane = Mat::zeros(reference_image.rows * resize_storage_factor * rows, reference_image.cols * resize_storage_factor * cols, CV_8UC1);
|
||||
}
|
||||
for(int fid = 0; fid < (int)stage_features[sid].size(); fid++){
|
||||
stringstream meta1, meta2;
|
||||
meta1 << "Stage " << sid << " / Feature " << fid;
|
||||
meta2 << "Rectangle: ";
|
||||
Mat temp_window = visualization.clone();
|
||||
Mat temp_metadata = metadata.clone();
|
||||
int current_feature_index = stage_features[sid][fid];
|
||||
Rect current_rect = feature_data[current_feature_index];
|
||||
Mat single_feature = reference_image.clone();
|
||||
resize(single_feature, single_feature, Size(), resize_storage_factor, resize_storage_factor);
|
||||
|
||||
// VISUALISATION
|
||||
// The rectangle is the top left one of a 3x3 block LBP constructor
|
||||
Rect resized(current_rect.x * resize_factor, current_rect.y * resize_factor, current_rect.width * resize_factor, current_rect.height * resize_factor);
|
||||
meta2 << resized;
|
||||
// Top left
|
||||
rectangle(temp_window, resized, Scalar(255), 1);
|
||||
// Top middle
|
||||
rectangle(temp_window, Rect(resized.x + resized.width, resized.y, resized.width, resized.height), Scalar(255), 1);
|
||||
// Top right
|
||||
rectangle(temp_window, Rect(resized.x + 2*resized.width, resized.y, resized.width, resized.height), Scalar(255), 1);
|
||||
// Middle left
|
||||
rectangle(temp_window, Rect(resized.x, resized.y + resized.height, resized.width, resized.height), Scalar(255), 1);
|
||||
// Middle middle
|
||||
rectangle(temp_window, Rect(resized.x + resized.width, resized.y + resized.height, resized.width, resized.height), Scalar(255), CV_FILLED);
|
||||
// Middle right
|
||||
rectangle(temp_window, Rect(resized.x + 2*resized.width, resized.y + resized.height, resized.width, resized.height), Scalar(255), 1);
|
||||
// Bottom left
|
||||
rectangle(temp_window, Rect(resized.x, resized.y + 2*resized.height, resized.width, resized.height), Scalar(255), 1);
|
||||
// Bottom middle
|
||||
rectangle(temp_window, Rect(resized.x + resized.width, resized.y + 2*resized.height, resized.width, resized.height), Scalar(255), 1);
|
||||
// Bottom right
|
||||
rectangle(temp_window, Rect(resized.x + 2*resized.width, resized.y + 2*resized.height, resized.width, resized.height), Scalar(255), 1);
|
||||
|
||||
if(draw_planes){
|
||||
Rect resized_inner(current_rect.x * resize_storage_factor, current_rect.y * resize_storage_factor, current_rect.width * resize_storage_factor, current_rect.height * resize_storage_factor);
|
||||
// Top left
|
||||
rectangle(single_feature, resized_inner, Scalar(255), 1);
|
||||
// Top middle
|
||||
rectangle(single_feature, Rect(resized_inner.x + resized_inner.width, resized_inner.y, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Top right
|
||||
rectangle(single_feature, Rect(resized_inner.x + 2*resized_inner.width, resized_inner.y, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Middle left
|
||||
rectangle(single_feature, Rect(resized_inner.x, resized_inner.y + resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Middle middle
|
||||
rectangle(single_feature, Rect(resized_inner.x + resized_inner.width, resized_inner.y + resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), CV_FILLED);
|
||||
// Middle right
|
||||
rectangle(single_feature, Rect(resized_inner.x + 2*resized_inner.width, resized_inner.y + resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Bottom left
|
||||
rectangle(single_feature, Rect(resized_inner.x, resized_inner.y + 2*resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Bottom middle
|
||||
rectangle(single_feature, Rect(resized_inner.x + resized_inner.width, resized_inner.y + 2*resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
// Bottom right
|
||||
rectangle(single_feature, Rect(resized_inner.x + 2*resized_inner.width, resized_inner.y + 2*resized_inner.height, resized_inner.width, resized_inner.height), Scalar(255), 1);
|
||||
|
||||
single_feature.copyTo(image_plane(Rect(0 + (fid%cols_prefered)*single_feature.cols, 0 + (fid/cols_prefered) * single_feature.rows, single_feature.cols, single_feature.rows)));
|
||||
}
|
||||
|
||||
putText(temp_metadata, meta1.str(), Point(15,15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
putText(temp_metadata, meta2.str(), Point(15,40), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
imshow("metadata", temp_metadata);
|
||||
imshow("features", temp_window);
|
||||
putText(temp_window, meta1.str(), Point(15,15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255));
|
||||
result_video.write(temp_window);
|
||||
|
||||
waitKey(timing);
|
||||
}
|
||||
|
||||
//Store the stage image if needed
|
||||
if(draw_planes){
|
||||
stringstream save_location;
|
||||
save_location << output_folder << "stage_" << sid << ".png";
|
||||
imwrite(save_location.str(), image_plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+13
-3
@@ -619,6 +619,8 @@ if(DEFINED CUDA_TARGET_CPU_ARCH)
|
||||
set(_cuda_target_cpu_arch_initial "${CUDA_TARGET_CPU_ARCH}")
|
||||
elseif(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM)")
|
||||
set(_cuda_target_cpu_arch_initial "ARM")
|
||||
elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|AARCH64)")
|
||||
set(_cuda_target_cpu_arch_initial "AARCH64")
|
||||
else()
|
||||
set(_cuda_target_cpu_arch_initial "")
|
||||
endif()
|
||||
@@ -637,12 +639,18 @@ mark_as_advanced(CUDA_TARGET_OS_VARIANT)
|
||||
# Target triplet
|
||||
if(DEFINED CUDA_TARGET_TRIPLET)
|
||||
set(_cuda_target_triplet_initial "${CUDA_TARGET_TRIPLET}")
|
||||
elseif(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND "${CUDA_TARGET_CPU_ARCH}" STREQUAL "ARM")
|
||||
elseif(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND "x${CUDA_TARGET_CPU_ARCH}" STREQUAL "xARM")
|
||||
if("${CUDA_TARGET_OS_VARIANT}" STREQUAL "Android" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi")
|
||||
set(_cuda_target_triplet_initial "armv7-linux-androideabi")
|
||||
elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
|
||||
set(_cuda_target_triplet_initial "armv7-linux-gnueabihf")
|
||||
endif()
|
||||
elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND "x${CUDA_TARGET_CPU_ARCH}" STREQUAL "xAARCH64")
|
||||
if("${CUDA_TARGET_OS_VARIANT}" STREQUAL "Android" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux-androideabi")
|
||||
set(_cuda_target_triplet_initial "aarch64-linux-androideabi")
|
||||
elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux-gnueabihf")
|
||||
set(_cuda_target_triplet_initial "aarch64-linux-gnueabihf")
|
||||
endif()
|
||||
endif()
|
||||
set(CUDA_TARGET_TRIPLET "${_cuda_target_triplet_initial}" CACHE STRING "Specify the target triplet for which the input files must be compiled.")
|
||||
file(GLOB __cuda_available_target_tiplets RELATIVE "${CUDA_TOOLKIT_ROOT_DIR}/targets" "${CUDA_TOOLKIT_ROOT_DIR}/targets/*" )
|
||||
@@ -1094,8 +1102,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
|
||||
set(nvcc_flags ${nvcc_flags} -m32)
|
||||
endif()
|
||||
|
||||
if(CUDA_TARGET_CPU_ARCH)
|
||||
set(nvcc_flags ${nvcc_flags} "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH}")
|
||||
if(CUDA_TARGET_CPU_ARCH AND CUDA_VERSION VERSION_LESS "7.0")
|
||||
# CPU architecture is either ARM or X86. Patch AARCH64 to be ARM
|
||||
string(REPLACE "AARCH64" "ARM" CUDA_TARGET_CPU_ARCH_patched ${CUDA_TARGET_CPU_ARCH})
|
||||
set(nvcc_flags ${nvcc_flags} "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH_patched}")
|
||||
endif()
|
||||
|
||||
if(CUDA_TARGET_OS_VARIANT AND CUDA_VERSION VERSION_LESS "7.0")
|
||||
|
||||
@@ -63,6 +63,10 @@ if(OPENCV_CAN_BREAK_BINARY_COMPATIBILITY)
|
||||
add_definitions(-DOPENCV_CAN_BREAK_BINARY_COMPATIBILITY)
|
||||
endif()
|
||||
|
||||
if(BUILD_TINY_GPU_MODULE)
|
||||
add_definitions(-DOPENCV_TINY_GPU_MODULE)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# High level of warnings.
|
||||
add_extra_compiler_option(-W)
|
||||
@@ -91,6 +95,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_extra_compiler_option(-Wno-narrowing)
|
||||
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
|
||||
add_extra_compiler_option(-Wno-unnamed-type-template-args)
|
||||
add_extra_compiler_option(-Wno-array-bounds)
|
||||
add_extra_compiler_option(-Wno-aggressive-loop-optimizations)
|
||||
endif()
|
||||
add_extra_compiler_option(-fdiagnostics-show-option)
|
||||
|
||||
@@ -257,6 +263,11 @@ if(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC12 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
|
||||
endif()
|
||||
|
||||
# Extra link libs if the user selects building static libs:
|
||||
if(NOT BUILD_SHARED_LIBS AND ((CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID) OR QNX))
|
||||
# Android does not need these settings because they are already set by toolchain file
|
||||
@@ -309,5 +320,8 @@ if(MSVC)
|
||||
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251") #class 'std::XXX' needs to have dll-interface to be used by clients of YYY
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275") # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4589") # Constructor of abstract class ... ignores initializer for virtual base class 'cv::Algorithm'
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4359") # Alignment specifier is less than actual alignment (4), and will be ignored
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -79,6 +79,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
@@ -86,7 +88,7 @@ elseif(MINGW)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
|
||||
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
set(MINGW64 1)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
|
||||
@@ -349,7 +349,7 @@ macro(add_android_project target path)
|
||||
if(android_proj_IGNORE_JAVA)
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
@@ -357,7 +357,7 @@ macro(add_android_project target path)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
|
||||
@@ -35,7 +35,18 @@ if(CUDA_FOUND)
|
||||
|
||||
if(WITH_NVCUVID)
|
||||
find_cuda_helper_libs(nvcuvid)
|
||||
set(HAVE_NVCUVID 1)
|
||||
|
||||
if(WIN32)
|
||||
find_cuda_helper_libs(nvcuvenc)
|
||||
endif()
|
||||
|
||||
if(CUDA_nvcuvid_LIBRARY)
|
||||
set(HAVE_NVCUVID 1)
|
||||
endif()
|
||||
|
||||
if(CUDA_nvcuvenc_LIBRARY)
|
||||
set(HAVE_NVCUVENC 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "CUDA detected: " ${CUDA_VERSION})
|
||||
@@ -86,12 +97,14 @@ if(CUDA_FOUND)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
set(__cuda_arch_bin "5.2")
|
||||
set(__cuda_arch_bin "5.3")
|
||||
set(__cuda_arch_ptx "")
|
||||
endif()
|
||||
else()
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
elseif(${CUDA_VERSION} VERSION_GREATER "6.5")
|
||||
set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5")
|
||||
else()
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
|
||||
endif()
|
||||
@@ -216,40 +229,18 @@ else()
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA)
|
||||
set(CUDA_LIBS_PATH "")
|
||||
foreach(p ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
|
||||
if(HAVE_CUBLAS)
|
||||
foreach(p ${CUDA_cublas_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
foreach(p ${CUDA_cufft_LIBRARY})
|
||||
get_filename_component(_tmp ${p} PATH)
|
||||
list(APPEND CUDA_LIBS_PATH ${_tmp})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES CUDA_LIBS_PATH)
|
||||
link_directories(${CUDA_LIBS_PATH})
|
||||
|
||||
set(CUDA_LIBRARIES_ABS ${CUDA_LIBRARIES})
|
||||
ocv_convert_to_lib_name(CUDA_LIBRARIES ${CUDA_LIBRARIES})
|
||||
ocv_create_imported_targets(CUDA_LIBRARIES ${CUDA_LIBRARIES})
|
||||
set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
|
||||
ocv_create_imported_targets(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
|
||||
|
||||
if(HAVE_CUBLAS)
|
||||
set(CUDA_cublas_LIBRARY_ABS ${CUDA_cublas_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
|
||||
ocv_create_imported_targets(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
|
||||
ocv_create_imported_targets(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -91,9 +91,9 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(WIN32)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
set(MINGW64 1)
|
||||
endif()
|
||||
endif()
|
||||
@@ -114,7 +114,7 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64.*|AARCH64.*")
|
||||
endif()
|
||||
|
||||
|
||||
# Similar code is existed in OpenCVConfig.cmake
|
||||
# Similar code exists in OpenCVConfig.cmake
|
||||
if(NOT DEFINED OpenCV_STATIC)
|
||||
# look for global setting
|
||||
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
|
||||
@@ -140,15 +140,13 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
|
||||
set(MINGW64 1)
|
||||
if(MINGW64)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
|
||||
@@ -39,11 +39,11 @@ if(PYTHON_EXECUTABLE)
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
find_host_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR})
|
||||
find_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR})
|
||||
elseif(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
|
||||
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
|
||||
find_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
|
||||
else()
|
||||
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
|
||||
find_package(PythonLibs ${PYTHON_VERSION_FULL})
|
||||
endif()
|
||||
# cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
|
||||
if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
|
||||
|
||||
@@ -63,6 +63,10 @@ if(NOT HAVE_TBB)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
|
||||
elseif(MSVC11)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
|
||||
elseif(MSVC12)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc12")
|
||||
elseif(MSVC14)
|
||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc14")
|
||||
endif()
|
||||
set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
|
||||
link_directories("${TBB_LIB_DIR}")
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
if(NOT WITH_VTK OR ANDROID OR IOS)
|
||||
if(NOT WITH_VTK)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# VTK 6.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
IF(VTK_FOUND)
|
||||
IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
|
||||
find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
ELSE(VTK_RENDERING_BACKEND)
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
ENDIF(VTK_RENDERING_BACKEND)
|
||||
ENDIF(VTK_FOUND)
|
||||
|
||||
# VTK 5.x components
|
||||
if(NOT VTK_FOUND)
|
||||
|
||||
@@ -8,7 +8,8 @@ if(BUILD_ZLIB)
|
||||
else()
|
||||
include(FindZLIB)
|
||||
if(ZLIB_FOUND AND ANDROID)
|
||||
if(ZLIB_LIBRARY STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
|
||||
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so" OR
|
||||
ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib64/libz.so")
|
||||
set(ZLIB_LIBRARY z)
|
||||
set(ZLIB_LIBRARIES z)
|
||||
endif()
|
||||
|
||||
@@ -12,8 +12,8 @@ endif(WITH_VFW)
|
||||
|
||||
# --- GStreamer ---
|
||||
ocv_clear_vars(HAVE_GSTREAMER)
|
||||
# try to find gstreamer 1.x first
|
||||
if(WITH_GSTREAMER)
|
||||
# try to find gstreamer 1.x first if 0.10 was not requested
|
||||
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
||||
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
||||
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
||||
@@ -29,7 +29,7 @@ if(WITH_GSTREAMER)
|
||||
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
||||
endif()
|
||||
|
||||
endif(WITH_GSTREAMER)
|
||||
endif()
|
||||
|
||||
# gstreamer support was requested but could not find gstreamer 1.x,
|
||||
# so fallback/try to find gstreamer 0.10
|
||||
@@ -190,7 +190,7 @@ if(WITH_XIMEA)
|
||||
endif(WITH_XIMEA)
|
||||
|
||||
# --- FFMPEG ---
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
|
||||
@@ -199,6 +199,7 @@ if(WITH_FFMPEG)
|
||||
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
|
||||
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
|
||||
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
|
||||
CHECK_MODULE(libavresample HAVE_FFMPEG_RESAMPLE)
|
||||
|
||||
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
|
||||
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
|
||||
|
||||
@@ -25,6 +25,8 @@ if(ANDROID)
|
||||
set( ${VAR} "armeabi" )
|
||||
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARMEABI_V7A" )
|
||||
set( ${VAR} "armeabi-v7a" )
|
||||
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARM64_V8A" )
|
||||
set( ${VAR} "arm64-v8a" )
|
||||
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " X86" )
|
||||
set( ${VAR} "x86" )
|
||||
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " MIPS" )
|
||||
@@ -36,7 +38,7 @@ if(ANDROID)
|
||||
endif()
|
||||
|
||||
# setup lists of camera libs
|
||||
foreach(abi ARMEABI ARMEABI_V7A X86 MIPS)
|
||||
foreach(abi ARMEABI ARMEABI_V7A ARM64_V8A X86 MIPS)
|
||||
ANDROID_GET_ABI_RAWNAME(${abi} ndkabi)
|
||||
if(BUILD_ANDROID_CAMERA_WRAPPER)
|
||||
if(ndkabi STREQUAL ANDROID_NDK_ABI_NAME)
|
||||
@@ -46,6 +48,7 @@ if(ANDROID)
|
||||
endif()
|
||||
elseif(HAVE_opencv_androidcamera)
|
||||
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "")
|
||||
# TODO: add prebuild camera libs for arm64-v8a
|
||||
file(GLOB OPENCV_CAMERA_LIBS "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ndkabi}/libnative_camera_r*.so")
|
||||
if(OPENCV_CAMERA_LIBS)
|
||||
list(SORT OPENCV_CAMERA_LIBS)
|
||||
|
||||
@@ -63,22 +63,23 @@ endforeach()
|
||||
# add extra dependencies required for OpenCV
|
||||
if(OpenCV_EXTRA_COMPONENTS)
|
||||
foreach(extra_component ${OpenCV_EXTRA_COMPONENTS})
|
||||
if(TARGET "${extra_component}")
|
||||
get_target_property(extra_component_is_imported "${extra_component}" IMPORTED)
|
||||
if(extra_component_is_imported)
|
||||
get_target_property(extra_component "${extra_component}" LOCATION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(extra_component MATCHES "^-[lL]")
|
||||
set(libprefix "")
|
||||
set(libname "${extra_component}")
|
||||
if(extra_component MATCHES "^-l")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "${extra_component}")
|
||||
elseif(extra_component MATCHES "[\\/]")
|
||||
get_filename_component(libdir "${extra_component}" PATH)
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}")
|
||||
get_filename_component(libname "${extra_component}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" libname "${libname}")
|
||||
set(libprefix "-l")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}" "-l${libname}")
|
||||
else()
|
||||
set(libprefix "-l")
|
||||
set(libname "${extra_component}")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${extra_component}")
|
||||
endif()
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "${libprefix}${libname}")
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
+21
-14
@@ -49,6 +49,8 @@ foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MOD
|
||||
if(HAVE_${mod})
|
||||
unset(HAVE_${mod} CACHE)
|
||||
endif()
|
||||
unset(OPENCV_MODULE_${mod}_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_DEPS_EXT CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_REQ_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_DEPS CACHE)
|
||||
@@ -488,7 +490,7 @@ macro(ocv_glob_module_sources)
|
||||
|
||||
file(GLOB_RECURSE lib_srcs "src/*.cpp")
|
||||
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h")
|
||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
||||
if (APPLE)
|
||||
@@ -574,7 +576,10 @@ macro(ocv_create_module)
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
|
||||
target_link_libraries(${the_module} ${extra_deps})
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@@ -589,7 +594,6 @@ macro(ocv_create_module)
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
)
|
||||
|
||||
# For dynamic link numbering convenions
|
||||
@@ -629,7 +633,7 @@ macro(ocv_create_module)
|
||||
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
|
||||
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
||||
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
|
||||
if(hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$")
|
||||
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -919,25 +923,28 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
|
||||
list(REMOVE_AT __mod_depends 0)
|
||||
if(__dep STREQUAL the_module)
|
||||
set(__has_cycle TRUE)
|
||||
else()#if("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
|
||||
else()
|
||||
ocv_regex_escape(__rdep "${__dep}")
|
||||
if(__resolved_deps MATCHES "(^|;)${__rdep}(;|$)")
|
||||
#all dependencies of this module are already resolved
|
||||
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${__dep}")
|
||||
elseif(TARGET ${__dep})
|
||||
get_target_property(__module_type ${__dep} TYPE)
|
||||
if(__module_type STREQUAL "STATIC_LIBRARY")
|
||||
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind})
|
||||
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT)
|
||||
get_target_property(__dep_imported ${__dep} IMPORTED)
|
||||
if(__dep_imported)
|
||||
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}")
|
||||
else()
|
||||
get_target_property(__module_type ${__dep} TYPE)
|
||||
if(__module_type STREQUAL "STATIC_LIBRARY")
|
||||
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind})
|
||||
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT)
|
||||
endif()
|
||||
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep})
|
||||
list(APPEND __resolved_deps "${__dep}")
|
||||
endif()
|
||||
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep})
|
||||
list(APPEND __resolved_deps "${__dep}")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}")
|
||||
endif()
|
||||
#else()
|
||||
# get_target_property(__dep_location "${__dep}" LOCATION)
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
@@ -951,7 +958,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
|
||||
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}")
|
||||
endif()
|
||||
|
||||
unset(__dep_location)
|
||||
unset(__dep_imported)
|
||||
unset(__mod_depends)
|
||||
unset(__resolved_deps)
|
||||
unset(__has_cycle)
|
||||
|
||||
@@ -51,6 +51,25 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
GET_PROPERTY(_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
if(_definitions)
|
||||
foreach(_def ${_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
|
||||
endforeach()
|
||||
endif()
|
||||
GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS)
|
||||
if(_target_definitions)
|
||||
foreach(_def ${_target_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
ELSE()
|
||||
## TODO ... ? or does it work out of the box
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
@@ -60,11 +79,15 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${OpenCV_SOURCE_DIR} DEFINITIONS)
|
||||
#MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" )
|
||||
LIST(APPEND ${_out_compile_flags} ${_directory_flags})
|
||||
LIST(APPEND ${_out_compile_flags} ${_global_definitions})
|
||||
get_target_property(DIRINC ${_PCH_current_target} INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
|
||||
|
||||
SEPARATE_ARGUMENTS(${_out_compile_flags})
|
||||
@@ -146,9 +169,9 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
|
||||
# if you have different versions of the headers for different build types
|
||||
# you may set _pch_dowarn
|
||||
IF (_dowarn)
|
||||
set(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||
SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch " )
|
||||
ELSE (_dowarn)
|
||||
set(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} " )
|
||||
ENDIF (_dowarn)
|
||||
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
@@ -246,12 +269,15 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(DIRINC ${_targetName} INCLUDE_DIRECTORIES)
|
||||
set_target_properties(${_targetName}_pch_dephelp PROPERTIES INCLUDE_DIRECTORIES "${DIRINC}")
|
||||
|
||||
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
|
||||
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc
|
||||
DEPENDS "${_input}"
|
||||
)
|
||||
|
||||
|
||||
+194
-8
@@ -19,27 +19,34 @@ OpenCV makes it easy for businesses to utilize and modify the code.")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
||||
if (NOT "${OPENCV_VCSVERSION}" MATCHES "^${OPENCV_VERSION}.*")
|
||||
message(WARNING "CPACK_PACKAGE_VERSION does not match version provided by version.hpp header!")
|
||||
endif()
|
||||
set(OPENCV_DEBIAN_COPYRIGHT_FILE "")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
set(CPACK_STRIP_FILES 1)
|
||||
|
||||
#arch
|
||||
if(X86)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "i386")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
|
||||
elseif(X86_64)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "amd64")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
|
||||
elseif(ARM)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "armhf")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
|
||||
elseif(AARCH64)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "aarch64")
|
||||
else()
|
||||
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE})
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
|
||||
elseif(CPACK_GENERATOR STREQUAL "RPM")
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
|
||||
else()
|
||||
@@ -82,7 +89,7 @@ set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
|
||||
set(CPACK_DEB_PYTHON_PACKAGE_DEPENDS "python-numpy (>=${PYTHON_NUMPY_VERSION}), python${PYTHON_VERSION_MAJOR_MINOR}")
|
||||
set(CPACK_COMPONENT_TESTS_DEPENDS libs)
|
||||
if (HAVE_opencv_python)
|
||||
set(CPACK_DEB_TESTS_PACKAGE_DEPENDS "python-numpy (>=${PYTHON_NUMPY_VERSION}), python${PYTHON_VERSION_MAJOR_MINOR}, python-py | python-pytest")
|
||||
set(CPACK_DEB_TESTS_PACKAGE_DEPENDS "python-numpy (>=${PYTHON_NUMPY_VERSION}), python${PYTHON_VERSION_MAJOR_MINOR}")
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA)
|
||||
@@ -104,6 +111,46 @@ if(HAVE_CUDA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_TBB AND NOT BUILD_TBB)
|
||||
if(CPACK_DEB_DEV_PACKAGE_DEPENDS)
|
||||
set(CPACK_DEB_DEV_PACKAGE_DEPENDS "${CPACK_DEB_DEV_PACKAGE_DEPENDS}, libtbb-dev")
|
||||
else()
|
||||
set(CPACK_DEB_DEV_PACKAGE_DEPENDS "libtbb-dev")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(STD_OPENCV_LIBS opencv-data)
|
||||
set(STD_OPENCV_DEV libopencv-dev)
|
||||
|
||||
foreach(module calib3d contrib core features2d flann gpu highgui imgproc legacy
|
||||
ml objdetect ocl photo stitching superres ts video videostab)
|
||||
if(HAVE_opencv_${module})
|
||||
list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
|
||||
list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND STD_OPENCV_DEV "libhighgui-dev" "libcv-dev" "libcvaux-dev")
|
||||
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_REPLACES "${STD_OPENCV_LIBS}")
|
||||
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_CONFLICTS "${STD_OPENCV_DEV}")
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_PROVIDES "${STD_OPENCV_DEV}")
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_REPLACES "${STD_OPENCV_DEV}")
|
||||
|
||||
set(CPACK_COMPONENT_PYTHON_CONFLICTS python-opencv)
|
||||
set(CPACK_COMPONENT_PYTHON_PROVIDES python-opencv)
|
||||
set(CPACK_COMPONENT_PYTHON_REPLACES python-opencv)
|
||||
|
||||
set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv2.4-java, libopencv2.4-jni")
|
||||
set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv2.4-java, libopencv2.4-jni")
|
||||
set(CPACK_COMPONENT_JAVA_REPLACES "libopencv2.4-java, libopencv2.4-jni")
|
||||
|
||||
set(CPACK_COMPONENT_DOCS_CONFLICTS opencv-doc)
|
||||
set(CPACK_COMPONENT_SAMPLES_CONFLICTS opencv-doc)
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
|
||||
set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "libopencv")
|
||||
@@ -134,6 +181,124 @@ if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_DEBIAN_COMPONENT_TESTS_SECTION "misc")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
set(CPACK_DEBIAN_COMPONENT_DOCS_ARCHITECTURE "all")
|
||||
|
||||
# lintian stuff
|
||||
|
||||
#
|
||||
# ocv_generate_lintian_overrides_file: generates lintian overrides file for
|
||||
# the specified component (deb-package). It's assumed that <comp>_LINTIAN_OVERRIDES
|
||||
# variable with suppressed tags is defined.
|
||||
#
|
||||
# Usage: ocv_generate_lintian_overrides_file(<component name>)
|
||||
#
|
||||
|
||||
function(ocv_generate_lintian_overrides_file comp)
|
||||
string(TOUPPER ${comp} comp_upcase)
|
||||
|
||||
set(package_name ${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME})
|
||||
set(suppressions ${${comp_upcase}_LINTIAN_OVERRIDES})
|
||||
|
||||
if(suppressions)
|
||||
if(NOT package_name)
|
||||
message(FATAL_ERROR "Package name for the ${comp} component is not defined")
|
||||
endif()
|
||||
|
||||
# generate content of lintian overrides file
|
||||
|
||||
foreach(suppression ${suppressions})
|
||||
set(line "${package_name}: ${suppression}")
|
||||
if(content)
|
||||
set(content "${content}\n${line}")
|
||||
else()
|
||||
set(content "${line}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# create file and install it
|
||||
set(cpack_tmp_dir "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}")
|
||||
set(overrides_filename "${cpack_tmp_dir}/${package_name}")
|
||||
|
||||
file(WRITE "${overrides_filename}" "${content}")
|
||||
|
||||
# install generated file
|
||||
install(FILES "${overrides_filename}"
|
||||
DESTINATION share/lintian/overrides/
|
||||
COMPONENT ${comp})
|
||||
|
||||
unset(content)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_get_lintian_version version)
|
||||
find_program(LINTIAN_EXECUTABLE lintian)
|
||||
|
||||
if(NOT LINTIAN_EXECUTABLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${LINTIAN_EXECUTABLE} --version
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE LINTIAN_EXITCODE
|
||||
OUTPUT_VARIABLE LINTIAN_VERSION
|
||||
ERROR_QUIET)
|
||||
|
||||
if(NOT LINTIAN_EXITCODE EQUAL 0)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(LINTIAN_VERSION MATCHES "([0-9]+\\.[0-9]+\\.[0-9]+)")
|
||||
set(LINTIAN_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "Lintian version")
|
||||
endif()
|
||||
|
||||
set("${version}" "${LINTIAN_VERSION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
ocv_get_lintian_version(LINTIAN_VERSION)
|
||||
|
||||
set(LIBS_LINTIAN_OVERRIDES "binary-or-shlib-defines-rpath" # usr/lib/libopencv_core.so.2.4.12
|
||||
"package-name-doesnt-match-sonames") # libopencv-calib3d2.4 libopencv-contrib2.4
|
||||
|
||||
if(HAVE_opencv_python)
|
||||
set(PYTHON_LINTIAN_OVERRIDES "binary-or-shlib-defines-rpath" # usr/lib/python2.7/dist-packages/cv2.so
|
||||
"missing-dependency-on-numpy-abi")
|
||||
else()
|
||||
set(PYTHON_LINTIAN_OVERRIDES "empty-binary-package") # python module is off
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_opencv_java)
|
||||
set(JAVA_LINTIAN_OVERRIDES "empty-binary-package") # Java is off
|
||||
else()
|
||||
# TODO: add smht here
|
||||
endif()
|
||||
|
||||
set(DEV_LINTIAN_OVERRIDES "binary-or-shlib-defines-rpath" # usr/bin/opencv_traincascade
|
||||
"binary-without-manpage") # usr/bin/opencv_traincascade
|
||||
|
||||
if(LINTIAN_VERSION VERSION_GREATER "2.5.30" OR
|
||||
LINTIAN_VERSION VERSION_EQUAL "2.5.30")
|
||||
list(APPEND DEV_LINTIAN_OVERRIDES "pkg-config-bad-directive") # usr/lib/pkgconfig/opencv.pc -L/usr/local/cuda-7.0/lib64
|
||||
endif()
|
||||
|
||||
if(NOT INSTALL_C_EXAMPLES)
|
||||
set(SAMPLES_LINTIAN_OVERRIDES "empty-binary-package") # samples are not installed
|
||||
endif()
|
||||
|
||||
if(INSTALL_TESTS)
|
||||
set(TESTS_LINTIAN_OVERRIDES "arch-dependent-file-in-usr-share" # usr/share/OpenCV/bin/opencv_test_ml
|
||||
"binary-or-shlib-defines-rpath" # usr/share/OpenCV/bin/opencv_test_ml
|
||||
"python-script-but-no-python-dep") # usr/share/OpenCV/bin/calchist.py
|
||||
else()
|
||||
set(TESTS_LINTIAN_OVERRIDES "empty-binary-package") # there is no tests
|
||||
endif()
|
||||
|
||||
set(ALL_COMPONENTS "libs" "dev" "docs" "python" "java" "samples" "tests")
|
||||
|
||||
foreach (comp ${ALL_COMPONENTS})
|
||||
string(TOUPPER ${comp} comp_upcase)
|
||||
list(APPEND ${comp_upcase}_LINTIAN_OVERRIDES "misplaced-extra-member-in-deb") # for signed packages
|
||||
endforeach()
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
find_program(GZIP_TOOL NAMES "gzip" PATHS "/bin" "/usr/bin" "/usr/local/bin")
|
||||
if(NOT GZIP_TOOL)
|
||||
@@ -145,13 +310,13 @@ if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(CHANGELOG_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
|
||||
set(ALL_COMPONENTS "libs" "dev" "docs" "python" "java" "samples" "tests")
|
||||
foreach (comp ${ALL_COMPONENTS})
|
||||
string(TOUPPER "${comp}" comp_upcase)
|
||||
|
||||
set(DEBIAN_CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian")
|
||||
set(DEBIAN_CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian.gz")
|
||||
set(CHANGELOG_PACKAGE_NAME "${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
|
||||
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
|
||||
|
||||
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${DEBIAN_CHANGELOG_OUT_FILE}"
|
||||
OUTPUT_FILE "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||
@@ -160,6 +325,27 @@ if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
install(FILES "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
|
||||
set(CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog")
|
||||
set(CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.gz")
|
||||
file(WRITE ${CHANGELOG_OUT_FILE} "Upstream changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog")
|
||||
|
||||
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${CHANGELOG_OUT_FILE}"
|
||||
OUTPUT_FILE "${CHANGELOG_OUT_FILE_GZ}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
install(FILES "${CHANGELOG_OUT_FILE_GZ}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
|
||||
if(OPENCV_DEBIAN_COPYRIGHT_FILE)
|
||||
install(FILES "${OPENCV_DEBIAN_COPYRIGHT_FILE}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
endif()
|
||||
|
||||
ocv_generate_lintian_overrides_file("${comp}")
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
+38
-9
@@ -449,18 +449,29 @@ endmacro()
|
||||
|
||||
|
||||
# convert list of paths to libraries names without lib prefix
|
||||
macro(ocv_convert_to_lib_name var)
|
||||
set(__tmp "")
|
||||
function(ocv_convert_to_lib_name var)
|
||||
set(tmp "")
|
||||
foreach(path ${ARGN})
|
||||
get_filename_component(__tmp_name "${path}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
|
||||
list(APPEND __tmp "${__tmp_name}")
|
||||
get_filename_component(tmp_name "${path}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" tmp_name "${tmp_name}")
|
||||
list(APPEND tmp "${tmp_name}")
|
||||
endforeach()
|
||||
set(${var} ${__tmp})
|
||||
unset(__tmp)
|
||||
unset(__tmp_name)
|
||||
endmacro()
|
||||
set(${var} ${tmp} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# create imported targets for a list of external libraries
|
||||
function(ocv_create_imported_targets var)
|
||||
set(target_list "")
|
||||
|
||||
foreach(library ${ARGN})
|
||||
ocv_convert_to_lib_name(libname "${library}")
|
||||
add_library("opencv_dep_${libname}" UNKNOWN IMPORTED)
|
||||
set_target_properties("opencv_dep_${libname}" PROPERTIES IMPORTED_LOCATION "${library}")
|
||||
list(APPEND target_list "opencv_dep_${libname}")
|
||||
endforeach()
|
||||
|
||||
set("${var}" "${target_list}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# add install command
|
||||
function(ocv_install_target)
|
||||
@@ -619,3 +630,21 @@ function(ocv_source_group group)
|
||||
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
|
||||
source_group(${group} FILES ${srcs})
|
||||
endfunction()
|
||||
|
||||
# build the list of simple dependencies, that links via "-l"
|
||||
# _all_libs - name of variable with input list
|
||||
# _simple - name of variable with output list of simple libs
|
||||
# _other - name of variable with _all_libs - _simple
|
||||
macro(ocv_extract_simple_libs _all_libs _simple _other)
|
||||
set(${_simple} "")
|
||||
set(${_other} "")
|
||||
foreach(_l ${${_all_libs}})
|
||||
if(TARGET ${_l})
|
||||
list(APPEND ${_other} ${_l})
|
||||
elseif(EXISTS "${_l}")
|
||||
list(APPEND ${_other} ${_l})
|
||||
else()
|
||||
list(APPEND ${_simple} ${_l})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
@@ -31,7 +31,16 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
endif
|
||||
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
|
||||
else
|
||||
OPENCV_DYNAMICUDA_MODULE:=
|
||||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
ifeq ($(OPENCV_HAVE_GPU_MODULE),on)
|
||||
ifneq ($(CUDA_TOOLKIT_DIR),)
|
||||
OPENCV_USE_GPU_MODULE:=on
|
||||
endif
|
||||
endif
|
||||
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
|
||||
else
|
||||
OPENCV_DYNAMICUDA_MODULE:=
|
||||
endif
|
||||
endif
|
||||
|
||||
CUDA_RUNTIME_LIBS:=@CUDA_RUNTIME_LIBS_CONFIGMAKE@
|
||||
@@ -56,6 +65,10 @@ else
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
@@ -77,6 +90,9 @@ ifeq ($(OPENCV_CAMERA_MODULES),on)
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_V7A_CONFIGCMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARM64_V8A_CONFIGCMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_X86_CONFIGCMAKE@
|
||||
endif
|
||||
@@ -101,10 +117,18 @@ define add_opencv_module
|
||||
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
|
||||
endef
|
||||
|
||||
ifndef CUDA_LIBS_DIR
|
||||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/aarch64-linux-androideabi/lib
|
||||
else
|
||||
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib
|
||||
endif
|
||||
endif
|
||||
|
||||
define add_cuda_module
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=$1
|
||||
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$1.so
|
||||
LOCAL_SRC_FILES:=$(CUDA_LIBS_DIR)/lib$(1:opencv_dep_%=%).so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
endef
|
||||
|
||||
@@ -202,7 +226,8 @@ ifeq ($(OPENCV_USE_GPU_MODULE),on)
|
||||
ifeq ($(INSTALL_CUDA_LIBRARIES),on)
|
||||
LOCAL_SHARED_LIBRARIES += $(foreach mod, $(CUDA_RUNTIME_LIBS), $(mod))
|
||||
else
|
||||
LOCAL_LDLIBS += -L$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib $(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib))
|
||||
LOCAL_LDLIBS += -L$(CUDA_LIBS_DIR) \
|
||||
$(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib:opencv_dep_%=%))
|
||||
endif
|
||||
LOCAL_STATIC_LIBRARIES+=libopencv_gpu
|
||||
endif
|
||||
|
||||
@@ -234,55 +234,55 @@ endif()
|
||||
foreach(__opttype OPT DBG)
|
||||
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
|
||||
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
|
||||
|
||||
# CUDA
|
||||
if(OpenCV_CUDA_VERSION)
|
||||
if(NOT CUDA_FOUND)
|
||||
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
|
||||
else()
|
||||
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
|
||||
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
|
||||
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.5")
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
|
||||
else()
|
||||
find_cuda_helper_libs(nppc)
|
||||
find_cuda_helper_libs(nppi)
|
||||
find_cuda_helper_libs(npps)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUBLAS)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUFFT)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_NVCUVID)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set(OpenCV_CUDA_LIBS_RELPATH "")
|
||||
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
|
||||
get_filename_component(_tmp ${l} PATH)
|
||||
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
|
||||
link_directories(${OpenCV_CUDA_LIBS_RELPATH})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Configure CUDA targets
|
||||
if(OpenCV_CUDA_VERSION)
|
||||
if(NOT CUDA_FOUND)
|
||||
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
|
||||
else()
|
||||
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
|
||||
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
|
||||
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.5")
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
|
||||
else()
|
||||
find_cuda_helper_libs(nppc)
|
||||
find_cuda_helper_libs(nppi)
|
||||
find_cuda_helper_libs(npps)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUBLAS)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUFFT)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_NVCUVID)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
|
||||
endif()
|
||||
|
||||
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
|
||||
get_filename_component(_tmp "${l}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" _tmp "${_tmp}")
|
||||
if(NOT TARGET "opencv_dep_${_tmp}") # protect against repeated inclusions
|
||||
add_library("opencv_dep_${_tmp}" UNKNOWN IMPORTED)
|
||||
set_target_properties("opencv_dep_${_tmp}" PROPERTIES IMPORTED_LOCATION "${l}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# ==============================================================
|
||||
# Android camera helper macro
|
||||
# ==============================================================
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@CHANGELOG_PACKAGE_NAME@ (@CPACK_PACKAGE_VERSION@) unstable; urgency=low
|
||||
* Debian changelog stub. See upstream changelog or release notes in user
|
||||
* Debian changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog
|
||||
or release notes in user
|
||||
documentation for more details.
|
||||
-- @CPACK_PACKAGE_CONTACT@ @CHANGELOG_PACKAGE_DATE@
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
Format: http://dep.debian.net/deps/dep5
|
||||
|
||||
Files: *
|
||||
Copyright: 2000-2015, Intel Corporation
|
||||
2009-2011, Willow Garage Inc.
|
||||
2009-2015, NVIDIA Corporation
|
||||
2010-2013, Advanced Micro Devices, Inc.
|
||||
2015, OpenCV Foundation
|
||||
2015, Itseez Inc.
|
||||
License: BSD-3-clause
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install, copy
|
||||
or use the software.
|
||||
.
|
||||
.
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
.
|
||||
\* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
.
|
||||
\* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
.
|
||||
\* Neither the names of the copyright holders nor the names of the
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
This software is provided by the copyright holders and contributors "as is"
|
||||
and any express or implied warranties, including, but not limited to, the
|
||||
implied warranties of merchantability and fitness for a particular purpose are
|
||||
disclaimed. In no event shall copyright holders or contributors be liable for
|
||||
any direct, indirect, incidental, special, exemplary, or consequential damages
|
||||
(including, but not limited to, procurement of substitute goods or services;
|
||||
loss of use, data, or profits; or business interruption) however caused
|
||||
and on any theory of liability, whether in contract, strict liability,
|
||||
or tort (including negligence or otherwise) arising in any way out of
|
||||
the use of this software, even if advised of the possibility of such damage.
|
||||
@@ -109,6 +109,9 @@
|
||||
/* NVidia Video Decoding API*/
|
||||
#cmakedefine HAVE_NVCUVID
|
||||
|
||||
/* NVidia Video Encoding API*/
|
||||
#cmakedefine HAVE_NVCUVENC
|
||||
|
||||
/* OpenCL Support */
|
||||
#cmakedefine HAVE_OPENCL
|
||||
#cmakedefine HAVE_OPENCL_STATIC
|
||||
|
||||
@@ -55,6 +55,15 @@ OPENCV_TEST_PATH=@CMAKE_INSTALL_PREFIX@/@OPENCV_TEST_INSTALL_PATH@
|
||||
OPENCV_PYTHON_TESTS=@OPENCV_PYTHON_TESTS_LIST@
|
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
|
||||
|
||||
CUR_DIR=`pwd`
|
||||
if [ -d "$CUR_DIR" -a -w "$CUR_DIR" ]; then
|
||||
echo "${TEXT_CYAN}CUR_DIR : $CUR_DIR${TEXT_RESET}"
|
||||
else
|
||||
echo "${TEXT_RED}Error: Do not have permissions to write to $CUR_DIR${TEXT_RESET}"
|
||||
echo "${TEXT_RED}Please run the script from directory with write access${TEXT_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run tests
|
||||
|
||||
SUMMARY_STATUS=0
|
||||
@@ -64,9 +73,8 @@ PASSED_TESTS=""
|
||||
for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
|
||||
cmd="$t --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:\"$report\""
|
||||
cmd="$t --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:$test_name.xml"
|
||||
|
||||
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
|
||||
if [ $COLOR_OUTPUT -eq 1 ]; then
|
||||
@@ -79,7 +87,7 @@ do
|
||||
fi
|
||||
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
|
||||
$cmd | sed -r "$seg_reg"
|
||||
eval "$cmd" | tee "$test_name.log" | sed -r "$seg_reg"
|
||||
ret=${PIPESTATUS[0]}
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
|
||||
|
||||
@@ -98,14 +106,13 @@ done
|
||||
for t in $OPENCV_PYTHON_TESTS;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
|
||||
cmd="py.test --junitxml $report \"$OPENCV_TEST_PATH\"/$t"
|
||||
cmd="python \"$OPENCV_TEST_PATH\"/$t -v"
|
||||
|
||||
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
|
||||
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
|
||||
eval "$cmd" | sed -r "$seg_reg"
|
||||
eval "$cmd" | tee "$test_name.log" | sed -r "$seg_reg"
|
||||
|
||||
ret=${PIPESTATUS[0]}
|
||||
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
|
||||
|
||||
@@ -18,5 +18,37 @@ if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
|
||||
DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
DESTINATION share/OpenCV/testdata COMPONENT tests)
|
||||
if(BUILD_opencv_python)
|
||||
file(GLOB DATAFILES_CPP ../samples/cpp/left*.jpg)
|
||||
list(APPEND DATAFILES_CPP
|
||||
"../samples/cpp/board.jpg"
|
||||
"../samples/cpp/pic1.png"
|
||||
"../samples/cpp/pic6.png"
|
||||
"../samples/cpp/right01.jpg"
|
||||
"../samples/cpp/right02.jpg"
|
||||
"../samples/cpp/building.jpg"
|
||||
"../samples/cpp/tsukuba_l.png"
|
||||
"../samples/cpp/tsukuba_r.png"
|
||||
"../samples/cpp/letter-recognition.data")
|
||||
install(FILES ${DATAFILES_CPP} DESTINATION share/OpenCV/testdata/samples/cpp COMPONENT tests)
|
||||
set(DATAFILES_C
|
||||
"../samples/c/lena.jpg"
|
||||
"../samples/c/box.png")
|
||||
install(FILES ${DATAFILES_C} DESTINATION share/OpenCV/testdata/samples/c COMPONENT tests)
|
||||
set(DATAFILES_GPU
|
||||
"../samples/gpu/basketball1.png"
|
||||
"../samples/gpu/basketball2.png"
|
||||
"../samples/gpu/rubberwhale1.png")
|
||||
install(FILES ${DATAFILES_GPU} DESTINATION share/OpenCV/testdata/samples/gpu COMPONENT tests)
|
||||
set(DATAFILES_PYTHON
|
||||
"../samples/python2/data/graf1.png"
|
||||
"../samples/python2/data/pca_test1.jpg"
|
||||
"../samples/python2/data/digits.png")
|
||||
install(FILES ${DATAFILES_PYTHON} DESTINATION share/OpenCV/testdata/samples/python2/data COMPONENT tests)
|
||||
set(DATAFILES_CASCADES
|
||||
"haarcascades/haarcascade_frontalface_alt.xml"
|
||||
"haarcascades/haarcascade_eye.xml")
|
||||
install(FILES ${DATAFILES_CASCADES} DESTINATION share/OpenCV/testdata/data/haarcascades COMPONENT tests)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,7 @@
|
||||
<opencv_storage>
|
||||
<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
|
||||
<featureType>HAAR</featureType>
|
||||
<height>19</height>
|
||||
<height>18</height>
|
||||
<width>36</width>
|
||||
<stageParams>
|
||||
<maxWeakCount>53</maxWeakCount></stageParams>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
function insertIframe (elementId, iframeSrc)
|
||||
{
|
||||
var iframe;
|
||||
if (document.createElement && (iframe = document.createElement('iframe')))
|
||||
{
|
||||
iframe.src = unescape(iframeSrc);
|
||||
iframe.width = "100%";
|
||||
iframe.height = "511px";
|
||||
var element = document.getElementById(elementId);
|
||||
element.parentNode.replaceChild(iframe, element);
|
||||
}
|
||||
}
|
||||
Vendored
-1
@@ -11,7 +11,6 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
{%- endblock %}
|
||||
{% set script_files = script_files + [pathto("_static/insertIframe.js", 1)] %}
|
||||
{%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %}
|
||||
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
|
||||
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ html_logo = 'opencv-logo-white.png'
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
#html_static_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""gen_pattern.py
|
||||
To run:
|
||||
-c 10 -r 12 -o out.svg
|
||||
-T type of pattern, circles, acircles, checkerboard
|
||||
-s --square_size size of squares in pattern
|
||||
-u --units mm, inches, px, m
|
||||
-w page width in units
|
||||
-h page height in units
|
||||
Usage example:
|
||||
python gen_pattern.py -o out.svg -r 11 -c 8 -T circles -s 20.0 -R 5.0 -u mm -w 216 -h 279
|
||||
|
||||
-o, --output - output file (default out.svg)
|
||||
-r, --rows - pattern rows (default 11)
|
||||
-c, --columns - pattern columns (default 8)
|
||||
-T, --type - type of pattern, circles, acircles, checkerboard (default circles)
|
||||
-s, --square_size - size of squares in pattern (default 20.0)
|
||||
-R, --radius_rate - circles_radius = square_size/radius_rate (default 5.0)
|
||||
-u, --units - mm, inches, px, m (default mm)
|
||||
-w, --page_width - page width in units (default 216)
|
||||
-h, --page_height - page height in units (default 279)
|
||||
-H, --help - show help
|
||||
"""
|
||||
|
||||
from svgfig import *
|
||||
@@ -16,18 +22,20 @@ import sys
|
||||
import getopt
|
||||
|
||||
class PatternMaker:
|
||||
def __init__(self, cols,rows,output,units,square_size,page_width,page_height):
|
||||
def __init__(self, cols,rows,output,units,square_size,radius_rate,page_width,page_height):
|
||||
self.cols = cols
|
||||
self.rows = rows
|
||||
self.output = output
|
||||
self.units = units
|
||||
self.square_size = square_size
|
||||
self.radius_rate = radius_rate
|
||||
self.width = page_width
|
||||
self.height = page_height
|
||||
self.g = SVG("g") # the svg group container
|
||||
|
||||
def makeCirclesPattern(self):
|
||||
spacing = self.square_size
|
||||
r = spacing / 5.0 #radius is a 5th of the spacing TODO parameterize
|
||||
r = spacing / self.radius_rate
|
||||
for x in range(1,self.cols+1):
|
||||
for y in range(1,self.rows+1):
|
||||
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
|
||||
@@ -35,7 +43,7 @@ class PatternMaker:
|
||||
|
||||
def makeACirclesPattern(self):
|
||||
spacing = self.square_size
|
||||
r = spacing / 5.0
|
||||
r = spacing / self.radius_rate
|
||||
for i in range(0,self.rows):
|
||||
for j in range(0,self.cols):
|
||||
dot = SVG("circle", cx= ((j*2 + i%2)*spacing) + spacing, cy=self.height - (i * spacing + spacing), r=r, fill="black")
|
||||
@@ -43,37 +51,23 @@ class PatternMaker:
|
||||
|
||||
def makeCheckerboardPattern(self):
|
||||
spacing = self.square_size
|
||||
r = spacing / 5.0
|
||||
for x in range(1,self.cols+1):
|
||||
for y in range(1,self.rows+1):
|
||||
#TODO make a checkerboard pattern
|
||||
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
|
||||
self.g.append(dot)
|
||||
if x%2 == y%2:
|
||||
dot = SVG("rect", x=x * spacing, y=y * spacing, width=spacing, height=spacing, stroke_width="0", fill="black")
|
||||
self.g.append(dot)
|
||||
|
||||
def save(self):
|
||||
c = canvas(self.g,width="%d%s"%(self.width,self.units),height="%d%s"%(self.height,self.units),viewBox="0 0 %d %d"%(self.width,self.height))
|
||||
c.inkview(self.output)
|
||||
|
||||
def makePattern(cols,rows,output,p_type,units,square_size,page_width,page_height):
|
||||
width = page_width
|
||||
spacing = square_size
|
||||
height = page_height
|
||||
r = spacing / 5.0
|
||||
g = SVG("g") # the svg group container
|
||||
for x in range(1,cols+1):
|
||||
for y in range(1,rows+1):
|
||||
if "circle" in p_type:
|
||||
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
|
||||
g.append(dot)
|
||||
c = canvas(g,width="%d%s"%(width,units),height="%d%s"%(height,units),viewBox="0 0 %d %d"%(width,height))
|
||||
c.inkview(output)
|
||||
|
||||
|
||||
def main():
|
||||
# parse command line options, TODO use argparse for better doc
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "ho:c:r:T:u:s:w:h:", ["help","output","columns","rows",
|
||||
"type","units","square_size","page_width",
|
||||
"page_height"])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "Ho:c:r:T:u:s:R:w:h:", ["help","output=","columns=","rows=",
|
||||
"type=","units=","square_size=","radius_rate=",
|
||||
"page_width=","page_height="])
|
||||
except getopt.error, msg:
|
||||
print msg
|
||||
print "for help use --help"
|
||||
@@ -84,11 +78,12 @@ def main():
|
||||
p_type = "circles"
|
||||
units = "mm"
|
||||
square_size = 20.0
|
||||
radius_rate = 5.0
|
||||
page_width = 216 #8.5 inches
|
||||
page_height = 279 #11 inches
|
||||
# process options
|
||||
for o, a in opts:
|
||||
if o in ("-h", "--help"):
|
||||
if o in ("-H", "--help"):
|
||||
print __doc__
|
||||
sys.exit(0)
|
||||
elif o in ("-r", "--rows"):
|
||||
@@ -103,11 +98,13 @@ def main():
|
||||
units = a
|
||||
elif o in ("-s", "--square_size"):
|
||||
square_size = float(a)
|
||||
elif o in ("-R", "--radius_rate"):
|
||||
radius_rate = float(a)
|
||||
elif o in ("-w", "--page_width"):
|
||||
page_width = float(a)
|
||||
elif o in ("-h", "--page_height"):
|
||||
page_height = float(a)
|
||||
pm = PatternMaker(columns,rows,output,units,square_size,page_width,page_height)
|
||||
pm = PatternMaker(columns,rows,output,units,square_size,radius_rate,page_width,page_height)
|
||||
#dict for easy lookup of pattern type
|
||||
mp = {"circles":pm.makeCirclesPattern,"acircles":pm.makeACirclesPattern,"checkerboard":pm.makeCheckerboardPattern}
|
||||
mp[p_type]()
|
||||
|
||||
@@ -193,7 +193,7 @@ In the main program, before processing, first check input command parameters. He
|
||||
{
|
||||
std::cout<<"RetinaDemo: processing image "<<argv[2]<<std::endl;
|
||||
// image processing case
|
||||
inputFrame = cv::imread(std::string(argv[2]), 1); // load image in RGB mode
|
||||
inputFrame = cv::imread(std::string(argv[2]), 1); // load image in BGR color mode
|
||||
}else
|
||||
if (!strcmp(inputMediaType.c_str(), "-video"))
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ From our previous tutorial, we know already a bit of *Pixel operators*. An inter
|
||||
|
||||
g(x) = (1 - \alpha)f_{0}(x) + \alpha f_{1}(x)
|
||||
|
||||
By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-disolve* between two images or videos, as seen in slide shows and film productions (cool, eh?)
|
||||
By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-dissolve* between two images or videos, as seen in slide shows and film productions (cool, eh?)
|
||||
|
||||
Code
|
||||
=====
|
||||
|
||||
@@ -44,14 +44,14 @@ or
|
||||
Scalar
|
||||
-------
|
||||
* Represents a 4-element vector. The type Scalar is widely used in OpenCV for passing pixel values.
|
||||
* In this tutorial, we will use it extensively to represent RGB color values (3 parameters). It is not necessary to define the last argument if it is not going to be used.
|
||||
* In this tutorial, we will use it extensively to represent BGR color values (3 parameters). It is not necessary to define the last argument if it is not going to be used.
|
||||
* Let's see an example, if we are asked for a color argument and we give:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
Scalar( a, b, c )
|
||||
|
||||
We would be defining a RGB color such as: *Red = c*, *Green = b* and *Blue = a*
|
||||
We would be defining a BGR color such as: *Blue = a*, *Green = b* and *Red = c*
|
||||
|
||||
|
||||
Code
|
||||
@@ -135,7 +135,7 @@ Explanation
|
||||
|
||||
* Draw a line from Point **start** to Point **end**
|
||||
* The line is displayed in the image **img**
|
||||
* The line color is defined by **Scalar( 0, 0, 0)** which is the RGB value correspondent to **Black**
|
||||
* The line color is defined by **Scalar( 0, 0, 0)** which is the BGR value correspondent to **Black**
|
||||
* The line thickness is set to **thickness** (in this case 2)
|
||||
* The line is a 8-connected one (**lineType** = 8)
|
||||
|
||||
@@ -167,7 +167,7 @@ Explanation
|
||||
* The ellipse center is located in the point **(w/2.0, w/2.0)** and is enclosed in a box of size **(w/4.0, w/16.0)**
|
||||
* The ellipse is rotated **angle** degrees
|
||||
* The ellipse extends an arc between **0** and **360** degrees
|
||||
* The color of the figure will be **Scalar( 255, 255, 0)** which means blue in RGB value.
|
||||
* The color of the figure will be **Scalar( 255, 0, 0)** which means blue in BGR value.
|
||||
* The ellipse's **thickness** is 2.
|
||||
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ Explanation
|
||||
|
||||
We observe that :mat_zeros:`Mat::zeros <>` returns a Matlab-style zero initializer based on *image.size()* and *image.type()*
|
||||
|
||||
#. Now, to perform the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` we will access to each pixel in image. Since we are operating with RGB images, we will have three values per pixel (R, G and B), so we will also access them separately. Here is the piece of code:
|
||||
#. Now, to perform the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` 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:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ You can download the full source code :download:`here <../../../../samples/cpp/t
|
||||
|
||||
how_to_scan_images imageName.jpg intValueToReduce [G]
|
||||
|
||||
The final argument is optional. If given the image will be loaded in gray scale format, otherwise the RGB color way is used. The first thing is to calculate the lookup table.
|
||||
The final argument is optional. If given the image will be loaded in gray scale format, otherwise the BGR color way is used. The first thing is to calculate the lookup table.
|
||||
|
||||
.. literalinclude:: ../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
|
||||
:language: cpp
|
||||
@@ -76,7 +76,7 @@ As you could already read in my :ref:`matTheBasicImageContainer` tutorial the si
|
||||
Row n & \tabItG{n,0} & \tabItG{n,1} & \tabItG{n,...} & \tabItG{n, m} \\
|
||||
\end{tabular}
|
||||
|
||||
For multichannel images the columns contain as many sub columns as the number of channels. For example in case of an RGB color system:
|
||||
For multichannel images the columns contain as many sub columns as the number of channels. For example in case of an BGR color system:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -89,7 +89,7 @@ For multichannel images the columns contain as many sub columns as the number of
|
||||
Row n & \tabIt{n,0} & \tabIt{n,1} & \tabIt{n,...} & \tabIt{n, m} \\
|
||||
\end{tabular}
|
||||
|
||||
Note that the order of the channels is inverse: BGR instead of RGB. Because in many cases the memory is large enough to store the rows in a successive fashion the rows may follow one after another, creating a single long row. Because everything is in a single place following one after another this may help to speed up the scanning process. We can use the :basicstructures:`isContinuous() <mat-iscontinuous>` function to *ask* the matrix if this is the case. Continue on to the next section to find an example.
|
||||
Because in many cases the memory is large enough to store the rows in a successive fashion the rows may follow one after another, creating a single long row. Because everything is in a single place following one after another this may help to speed up the scanning process. We can use the :basicstructures:`isContinuous() <mat-iscontinuous>` function to *ask* the matrix if this is the case. Continue on to the next section to find an example.
|
||||
|
||||
The efficient way
|
||||
=================
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ Here you can observe that with the new structure we have no pointer problems, al
|
||||
:tab-width: 4
|
||||
:lines: 46-51
|
||||
|
||||
Because, we want to mess around with the images luma component we first convert from the default RGB to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula.
|
||||
Because, we want to mess around with the images luma component we first convert from the default BGR to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula.
|
||||
|
||||
The scanning version looks like:
|
||||
|
||||
|
||||
@@ -76,12 +76,12 @@ There are, however, many other color systems each with their own advantages:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* RGB is the most common as our eyes use something similar, our display systems also compose colors using these.
|
||||
* RGB is the most common as our eyes use something similar, but keep in mind that the OpenCV display system uses BGR colors.
|
||||
* The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors. You might, for example, dismiss the value component, making your algorithm less sensitive to the light conditions of the input image.
|
||||
* YCrCb is used by the popular JPEG image format.
|
||||
* CIE L*a*b* is a perceptually uniform color space, which comes handy if you need to measure the *distance* of a given color to another color.
|
||||
|
||||
Each of the color components has its own valid domains. This brings us to the data type used: how we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in the case of three components (such as RGB) this already gives 16 million representable colors. We may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
|
||||
Each of the color components has its own valid domains. This brings us to the data type used: how we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in the case of three components (such as BGR) this already gives 16 million representable colors. We may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
|
||||
|
||||
Creating a *Mat* object explicitly
|
||||
==================================
|
||||
|
||||
@@ -116,7 +116,7 @@ Explanation
|
||||
pt1.x = rng.uniform( x_1, x_2 );
|
||||
pt1.y = rng.uniform( y_1, y_2 );
|
||||
|
||||
* We know that **rng** is a *Random number generator* object. In the code above we are calling **rng.uniform(a,b)**. This generates a radombly uniformed distribution between the values **a** and **b** (inclusive in **a**, exclusive in **b**).
|
||||
* We know that **rng** is a *Random number generator* object. In the code above we are calling **rng.uniform(a,b)**. This generates a randomly uniformed distribution between the values **a** and **b** (inclusive in **a**, exclusive in **b**).
|
||||
|
||||
* From the explanation above, we deduce that the extremes *pt1* and *pt2* will be random values, so the lines positions will be quite impredictable, giving a nice visual effect (check out the Result section below).
|
||||
|
||||
@@ -138,7 +138,7 @@ Explanation
|
||||
|
||||
As we can see, the return value is an *Scalar* with 3 randomly initialized values, which are used as the *R*, *G* and *B* parameters for the line color. Hence, the color of the lines will be random too!
|
||||
|
||||
#. The explanation above applies for the other functions generating circles, ellipses, polygones, etc. The parameters such as *center* and *vertices* are also generated randomly.
|
||||
#. The explanation above applies for the other functions generating circles, ellipses, polygons, etc. The parameters such as *center* and *vertices* are also generated randomly.
|
||||
|
||||
#. Before finishing, we also should take a look at the functions *Display_Random_Text* and *Displaying_Big_End*, since they both have a few interesting features:
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Whenever you work with video feeds you may eventually want to save your image pr
|
||||
+ What type of video files you can create with OpenCV
|
||||
+ How to extract a given color channel from a video
|
||||
|
||||
As a simple demonstration I'll just extract one of the RGB color channels of an input video file into a new video. You can control the flow of the application from its console line arguments:
|
||||
As a simple demonstration I'll just extract one of the BGR color channels of an input video file into a new video. You can control the flow of the application from its console line arguments:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
@@ -111,7 +111,7 @@ Afterwards, you use the :hgvideo:`isOpened() <videowriter-isopened>` function to
|
||||
outputVideo.write(res); //or
|
||||
outputVideo << res;
|
||||
|
||||
Extracting a color channel from an RGB image means to set to zero the RGB values of the other channels. You can either do this with image scanning operations or by using the split and merge operations. You first split the channels up into different images, set the other channels to zero images of the same size and type and finally merge them back:
|
||||
Extracting a color channel from an BGR image means to set to zero the BGR values of the other channels. You can either do this with image scanning operations or by using the split and merge operations. You first split the channels up into different images, set the other channels to zero images of the same size and type and finally merge them back:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ Explanation
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* Load an image (can be RGB or grayscale)
|
||||
* Load an image (can be BGR or grayscale)
|
||||
* Create two windows (one for dilation output, the other for erosion)
|
||||
* Create a set of 02 Trackbars for each operation:
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ Code
|
||||
Explanation
|
||||
===========
|
||||
|
||||
#. Declare variables such as the matrices to store the base image and the two other images to compare ( RGB and HSV )
|
||||
#. Declare variables such as the matrices to store the base image and the two other images to compare ( BGR and HSV )
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ How does it work?
|
||||
|
||||
We consider only points such that :math:`r > 0` and :math:`0< \theta < 2 \pi`.
|
||||
|
||||
#. We can do the same operation above for all the points in an image. If the curves of two different points intersect in the plane :math:`\theta` - :math:`r`, that means that both points belong to a same line. For instance, following with the example above and drawing the plot for two more points: :math:`x_{1} = 9`, :math:`y_{1} = 4` and :math:`x_{2} = 12`, :math:`y_{2} = 3`, we get:
|
||||
#. We can do the same operation above for all the points in an image. If the curves of two different points intersect in the plane :math:`\theta` - :math:`r`, that means that both points belong to a same line. For instance, following with the example above and drawing the plot for two more points: :math:`x_{1} = 4`, :math:`y_{1} = 9` and :math:`x_{2} = 12`, :math:`y_{2} = 3`, we get:
|
||||
|
||||
.. image:: images/Hough_Lines_Tutorial_Theory_2.jpg
|
||||
:alt: Polar plot of the family of lines for three points
|
||||
|
||||
@@ -88,7 +88,7 @@ Code
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert the image to grayscale
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
/// Create window
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
@@ -141,7 +141,7 @@ Explanation
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
#. Apply the Laplacian operator to the grayscale image:
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ Code
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert it to gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
/// Create window
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
@@ -217,7 +217,7 @@ Explanation
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
#. Second, we calculate the "*derivatives*" in *x* and *y* directions. For this, we use the function :sobel:`Sobel <>` as shown below:
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ The tutorial code's is shown lines below. You can also download it from `here <h
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert the image to Gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
/// Create a window to display results
|
||||
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
|
||||
@@ -221,14 +221,14 @@ Explanation
|
||||
|
||||
#. Let's check the general structure of the program:
|
||||
|
||||
* Load an image. If it is RGB we convert it to Grayscale. For this, remember that we can use the function :cvt_color:`cvtColor <>`:
|
||||
* Load an image. If it is BGR we convert it to Grayscale. For this, remember that we can use the function :cvt_color:`cvtColor <>`:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert the image to Gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
|
||||
|
||||
* Create a window to display the result
|
||||
|
||||
@@ -68,7 +68,7 @@ Now we call the :imread:`imread <>` function which loads the image name specifie
|
||||
|
||||
+ CV_LOAD_IMAGE_UNCHANGED (<0) loads the image as is (including the alpha channel if present)
|
||||
+ CV_LOAD_IMAGE_GRAYSCALE ( 0) loads the image as an intensity one
|
||||
+ CV_LOAD_IMAGE_COLOR (>0) loads the image in the RGB format
|
||||
+ CV_LOAD_IMAGE_COLOR (>0) loads the image in the BGR format
|
||||
|
||||
.. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp
|
||||
:language: cpp
|
||||
|
||||
@@ -63,7 +63,7 @@ Here it is:
|
||||
Explanation
|
||||
============
|
||||
|
||||
#. We begin by loading an image using :readwriteimagevideo:`imread <imread>`, located in the path given by *imageName*. For this example, assume you are loading a RGB image.
|
||||
#. We begin by loading an image using :readwriteimagevideo:`imread <imread>`, located in the path given by *imageName*. For this example, assume you are loading a BGR image.
|
||||
|
||||
#. Now we are going to convert our image from BGR to Grayscale format. OpenCV has a really nice function to do this kind of transformations:
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Senz3D and Intel Perceptual Computing SDK
|
||||
Using Creative Senz3D and other Intel Perceptual Computing SDK compatible depth sensors
|
||||
=======================================================================================
|
||||
|
||||
Depth sensors compatible with Intel Perceptual Computing SDK are supported through ``VideoCapture`` class. Depth map, RGB image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
|
||||
Depth sensors compatible with Intel Perceptual Computing SDK are supported through ``VideoCapture`` class. Depth map, BGR image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
|
||||
|
||||
In order to use depth sensor with OpenCV you should do the following preliminary steps:
|
||||
|
||||
@@ -28,7 +28,7 @@ VideoCapture can retrieve the following data:
|
||||
* ``CV_CAP_INTELPERC_UVDEPTH_MAP`` - each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates. (CV_32FC2)
|
||||
* ``CV_CAP_INTELPERC_IR_MAP`` - each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam. (CV_16UC1)
|
||||
#.
|
||||
data given from RGB image generator:
|
||||
data given from BGR image generator:
|
||||
* ``CV_CAP_INTELPERC_IMAGE`` - color image. (CV_8UC3)
|
||||
|
||||
In order to get depth map from depth sensor use ``VideoCapture::operator >>``, e. g. ::
|
||||
@@ -76,4 +76,4 @@ Since two types of sensor's data generators are supported (image generator and d
|
||||
|
||||
For more information please refer to the example of usage intelperc_capture.cpp_ in ``opencv/samples/cpp`` folder.
|
||||
|
||||
.. _intelperc_capture.cpp: https://github.com/Itseez/opencv/tree/master/samples/cpp/intelperc_capture.cpp
|
||||
.. _intelperc_capture.cpp: https://github.com/Itseez/opencv/tree/master/samples/cpp/intelperc_capture.cpp
|
||||
|
||||
@@ -7,7 +7,7 @@ Kinect and OpenNI
|
||||
Using Kinect and other OpenNI compatible depth sensors
|
||||
======================================================
|
||||
|
||||
Depth sensors compatible with OpenNI (Kinect, XtionPRO, ...) are supported through ``VideoCapture`` class. Depth map, RGB image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
|
||||
Depth sensors compatible with OpenNI (Kinect, XtionPRO, ...) are supported through ``VideoCapture`` class. Depth map, BGR image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
|
||||
|
||||
In order to use depth sensor with OpenCV you should do the following preliminary steps:
|
||||
|
||||
@@ -47,7 +47,7 @@ VideoCapture can retrieve the following data:
|
||||
* ``CV_CAP_OPENNI_DISPARITY_MAP_32F`` - disparity in pixels (CV_32FC1)
|
||||
* ``CV_CAP_OPENNI_VALID_DEPTH_MASK`` - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)
|
||||
#.
|
||||
data given from RGB image generator:
|
||||
data given from BGR image generator:
|
||||
* ``CV_CAP_OPENNI_BGR_IMAGE`` - color image (CV_8UC3)
|
||||
* ``CV_CAP_OPENNI_GRAY_IMAGE`` - gray image (CV_8UC1)
|
||||
|
||||
@@ -69,7 +69,7 @@ For getting several data maps use ``VideoCapture::grab`` and ``VideoCapture::ret
|
||||
for(;;)
|
||||
{
|
||||
Mat depthMap;
|
||||
Mat rgbImage
|
||||
Mat bgrImage;
|
||||
|
||||
capture.grab();
|
||||
|
||||
|
||||
@@ -294,6 +294,10 @@ Command line arguments of ``opencv_traincascade`` application grouped by purpose
|
||||
|
||||
This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format.
|
||||
|
||||
* ``-acceptanceRatioBreakValue``
|
||||
|
||||
This argument is used to determine how precise your model should keep learning and when to stop. A good guideline is to train not further than 10e-5, to ensure the model does not overtrain on your training data. By default this value is set to -1 to disable this feature.
|
||||
|
||||
#.
|
||||
|
||||
Cascade parameters:
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
* //
|
||||
* // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
* //
|
||||
* // By downloading, copying, installing or using the software you agree to this license.
|
||||
* // If you do not agree to this license, do not download, install,
|
||||
* // copy or use the software.
|
||||
* //
|
||||
* //
|
||||
* // License Agreement
|
||||
* // For Open Source Computer Vision Library
|
||||
* //
|
||||
* // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
* // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
* // Third party copyrights are property of their respective owners.
|
||||
* //
|
||||
* // Redistribution and use in source and binary forms, with or without modification,
|
||||
* // are permitted provided that the following conditions are met:
|
||||
* //
|
||||
* // * Redistribution's of source code must retain the above copyright notice,
|
||||
* // this list of conditions and the following disclaimer.
|
||||
* //
|
||||
* // * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
* // this list of conditions and the following disclaimer in the documentation
|
||||
* // and/or other materials provided with the distribution.
|
||||
* //
|
||||
* // * The name of the copyright holders may not be used to endorse or promote products
|
||||
* // derived from this software without specific prior written permission.
|
||||
* //
|
||||
* // This software is provided by the copyright holders and contributors "as is" and
|
||||
* // any express or implied warranties, including, but not limited to, the implied
|
||||
* // warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
* // In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
* // indirect, incidental, special, exemplary, or consequential damages
|
||||
* // (including, but not limited to, procurement of substitute goods or services;
|
||||
* // loss of use, data, or profits; or business interruption) however caused
|
||||
* // and on any theory of liability, whether in contract, strict liability,
|
||||
* // or tort (including negligence or otherwise) arising in any way out of
|
||||
* // the use of this software, even if advised of the possibility of such damage.
|
||||
* //
|
||||
* //M*/
|
||||
|
||||
#ifndef __OPENCV_OLD_CXMISC_H__
|
||||
#define __OPENCV_OLD_CXMISC_H__
|
||||
|
||||
|
||||
@@ -43,19 +43,41 @@
|
||||
#ifndef __OPENCV_ALL_HPP__
|
||||
#define __OPENCV_ALL_HPP__
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#include "opencv2/core/core_c.h"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#ifdef HAVE_OPENCV_FLANN
|
||||
#include "opencv2/flann/miniflann.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_IMGPROC
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_PHOTO
|
||||
#include "opencv2/photo/photo.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_VIDEO
|
||||
#include "opencv2/video/video.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_FEATURES2D
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_OBJDETECT
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_CALIB3D
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_ML
|
||||
#include "opencv2/ml/ml.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_HIGHGUI
|
||||
#include "opencv2/highgui/highgui_c.h"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_OPENCV_CONTRIB
|
||||
#include "opencv2/contrib/contrib.hpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -128,11 +128,11 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
|
||||
|
||||
.. ocv:pyoldfunction:: cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags=0)-> None
|
||||
|
||||
:param objectPoints: In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0.
|
||||
:param objectPoints: In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0.
|
||||
|
||||
In the old interface all the vectors of object points from different views are concatenated together.
|
||||
|
||||
:param imagePoints: In the new interface it is a vector of vectors of the projections of calibration pattern points. ``imagePoints.size()`` and ``objectPoints.size()`` and ``imagePoints[i].size()`` must be equal to ``objectPoints[i].size()`` for each ``i``.
|
||||
:param imagePoints: In the new interface it is a vector of vectors of the projections of calibration pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). ``imagePoints.size()`` and ``objectPoints.size()`` and ``imagePoints[i].size()`` must be equal to ``objectPoints[i].size()`` for each ``i``.
|
||||
|
||||
In the old interface all the vectors of object points from different views are concatenated together.
|
||||
|
||||
@@ -144,7 +144,7 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
|
||||
|
||||
:param distCoeffs: Output vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements.
|
||||
|
||||
:param rvecs: Output vector of rotation vectors (see :ocv:func:`Rodrigues` ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
|
||||
:param rvecs: Output vector of rotation vectors (see :ocv:func:`Rodrigues` ) estimated for each pattern view (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
|
||||
|
||||
:param tvecs: Output vector of translation vectors estimated for each pattern view.
|
||||
|
||||
@@ -657,7 +657,7 @@ Calculates a fundamental matrix from the corresponding points in two images.
|
||||
|
||||
:param param2: Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of confidence (probability) that the estimated matrix is correct.
|
||||
|
||||
:param status: Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1's.
|
||||
:param mask: Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1's.
|
||||
|
||||
The epipolar geometry is described by the following equation:
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ struct CvCBQuad
|
||||
//static CvMat* debug_img = 0;
|
||||
|
||||
static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners,
|
||||
CvMemStorage *storage, CvMat *image, int flags );
|
||||
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size);
|
||||
|
||||
/*static int
|
||||
icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
@@ -172,7 +172,7 @@ static int icvCleanFoundConnectedQuads( int quad_count,
|
||||
|
||||
static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
||||
CvSize pattern_size, CvMemStorage* storage );
|
||||
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage );
|
||||
|
||||
static void icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common);
|
||||
|
||||
@@ -183,7 +183,7 @@ static int icvTrimRow(CvCBQuad **quads, int count, int row, int dir);
|
||||
#endif
|
||||
|
||||
static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners);
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size);
|
||||
|
||||
static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0);
|
||||
|
||||
@@ -313,6 +313,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// making it difficult to detect smaller squares.
|
||||
for( k = 0; k < 6; k++ )
|
||||
{
|
||||
int max_quad_buf_size = 0;
|
||||
for( dilations = min_dilations; dilations <= max_dilations; dilations++ )
|
||||
{
|
||||
if (found)
|
||||
@@ -368,7 +369,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1,
|
||||
thresh_img->rows-1), CV_RGB(255,255,255), 3, 8);
|
||||
|
||||
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags );
|
||||
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags, &max_quad_buf_size);
|
||||
|
||||
PRINTF("Quad count: %d/%d\n", quad_count, expected_corners_num);
|
||||
}
|
||||
@@ -408,8 +409,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// allocate extra for adding in icvOrderFoundQuads
|
||||
cvFree(&quad_group);
|
||||
cvFree(&corner_group);
|
||||
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * (quad_count+quad_count / 2));
|
||||
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * (quad_count+quad_count / 2)*4 );
|
||||
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * max_quad_buf_size);
|
||||
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * max_quad_buf_size * 4 );
|
||||
|
||||
for( group_idx = 0; ; group_idx++ )
|
||||
{
|
||||
@@ -424,7 +425,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// maybe delete or add some
|
||||
PRINTF("Starting ordering of inner quads\n");
|
||||
count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners,
|
||||
pattern_size, storage );
|
||||
pattern_size, max_quad_buf_size, storage );
|
||||
PRINTF("Orig count: %d After ordering: %d\n", icount, count);
|
||||
|
||||
|
||||
@@ -623,7 +624,7 @@ icvCheckBoardMonotony( CvPoint2D32f* corners, CvSize pattern_size )
|
||||
static int
|
||||
icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
||||
CvSize pattern_size, CvMemStorage* storage )
|
||||
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage )
|
||||
{
|
||||
cv::Ptr<CvMemStorage> temp_storage = cvCreateChildMemStorage( storage );
|
||||
CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage );
|
||||
@@ -803,15 +804,18 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
if (found > 0)
|
||||
{
|
||||
PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found);
|
||||
for (int i=0; i<quad_count; i++)
|
||||
for (int i=0; i<quad_count && *all_count < max_quad_buf_size; i++)
|
||||
{
|
||||
if (quads[i]->count < 4 && quads[i]->ordered)
|
||||
{
|
||||
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners);
|
||||
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners, max_quad_buf_size);
|
||||
*all_count += added;
|
||||
quad_count += added;
|
||||
}
|
||||
}
|
||||
|
||||
if (*all_count >= max_quad_buf_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -854,11 +858,11 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
|
||||
static int
|
||||
icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners )
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size )
|
||||
|
||||
{
|
||||
int added = 0;
|
||||
for (int i=0; i<4; i++) // find no-neighbor corners
|
||||
for (int i=0; i<4 && all_count < max_quad_buf_size; i++) // find no-neighbor corners
|
||||
{
|
||||
if (!quad->neighbors[i]) // ok, create and add neighbor
|
||||
{
|
||||
@@ -1649,7 +1653,7 @@ static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count )
|
||||
|
||||
static int
|
||||
icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
CvMemStorage *storage, CvMat *image, int flags )
|
||||
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size )
|
||||
{
|
||||
int quad_count = 0;
|
||||
cv::Ptr<CvMemStorage> temp_storage;
|
||||
@@ -1754,8 +1758,9 @@ icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
cvEndFindContours( &scanner );
|
||||
|
||||
// allocate quad & corner buffers
|
||||
*out_quads = (CvCBQuad*)cvAlloc((root->total+root->total / 2) * sizeof((*out_quads)[0]));
|
||||
*out_corners = (CvCBCorner*)cvAlloc((root->total+root->total / 2) * 4 * sizeof((*out_corners)[0]));
|
||||
*max_quad_buf_size = MAX(1, (root->total+root->total / 2)) * 2;
|
||||
*out_quads = (CvCBQuad*)cvAlloc(*max_quad_buf_size * sizeof((*out_quads)[0]));
|
||||
*out_corners = (CvCBCorner*)cvAlloc(*max_quad_buf_size * 4 * sizeof((*out_corners)[0]));
|
||||
|
||||
// Create array of quads structures
|
||||
for( idx = 0; idx < root->total; idx++ )
|
||||
|
||||
@@ -794,8 +794,42 @@ double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray
|
||||
|
||||
if (K.needed()) cv::Mat(_K).convertTo(K, K.empty() ? CV_64FC1 : K.type());
|
||||
if (D.needed()) cv::Mat(finalParam.k).convertTo(D, D.empty() ? CV_64FC1 : D.type());
|
||||
if (rvecs.needed()) cv::Mat(omc).convertTo(rvecs, rvecs.empty() ? CV_64FC3 : rvecs.type());
|
||||
if (tvecs.needed()) cv::Mat(Tc).convertTo(tvecs, tvecs.empty() ? CV_64FC3 : tvecs.type());
|
||||
|
||||
if (rvecs.needed())
|
||||
{
|
||||
if( rvecs.kind() == _InputArray::STD_VECTOR_MAT )
|
||||
{
|
||||
rvecs.create((int)objectPoints.total(), 1, CV_64FC3);
|
||||
for( int i = 0; i < (int)objectPoints.total(); i++ )
|
||||
{
|
||||
rvecs.create(3, 1, CV_64F, i, true);
|
||||
Mat rv = rvecs.getMat(i);
|
||||
*rv.ptr<Vec3d>(0) = omc[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::Mat(omc).convertTo(rvecs, rvecs.fixedType() ? rvecs.type() : CV_64FC3);
|
||||
}
|
||||
}
|
||||
|
||||
if (tvecs.needed())
|
||||
{
|
||||
if( tvecs.kind() == _InputArray::STD_VECTOR_MAT )
|
||||
{
|
||||
tvecs.create((int)objectPoints.total(), 1, CV_64FC3);
|
||||
for( int i = 0; i < (int)objectPoints.total(); i++ )
|
||||
{
|
||||
tvecs.create(3, 1, CV_64F, i, true);
|
||||
Mat tv = tvecs.getMat(i);
|
||||
*tv.ptr<Vec3d>(0) = Tc[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::Mat(Tc).convertTo(tvecs, tvecs.fixedType() ? tvecs.type() : CV_64FC3);
|
||||
}
|
||||
}
|
||||
|
||||
return rms;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace cv
|
||||
}
|
||||
|
||||
resultsMutex.lock();
|
||||
if ( (localInliers.size() > inliers.size()) || (localInliers.size() == inliers.size() && curIndex > bestIndex))
|
||||
if ( (localInliers.size() > inliers.size()) || (localInliers.size() == inliers.size() && inliers.size() > 0 && curIndex > bestIndex))
|
||||
{
|
||||
inliers.clear();
|
||||
inliers.resize(localInliers.size());
|
||||
|
||||
@@ -344,7 +344,7 @@ static void findStereoCorrespondenceBM_SSE2( const Mat& left, const Mat& right,
|
||||
{
|
||||
hsad = hsad0 - dy0*ndisp; cbuf = cbuf0 + (x + wsz2 + 1)*cstep - dy0*ndisp;
|
||||
lptr = lptr0 + MIN(MAX(x, -lofs), width-lofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x, -rofs), width-rofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x, -rofs), width-rofs-ndisp) - dy0*sstep;
|
||||
|
||||
for( y = -dy0; y < height + dy1; y++, hsad += ndisp, cbuf += ndisp, lptr += sstep, rptr += sstep )
|
||||
{
|
||||
@@ -385,7 +385,7 @@ static void findStereoCorrespondenceBM_SSE2( const Mat& left, const Mat& right,
|
||||
hsad = hsad0 - dy0*ndisp;
|
||||
lptr_sub = lptr0 + MIN(MAX(x0, -lofs), width-1-lofs) - dy0*sstep;
|
||||
lptr = lptr0 + MIN(MAX(x1, -lofs), width-1-lofs) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x1, -rofs), width-1-rofs) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x1, -rofs), width-ndisp-rofs) - dy0*sstep;
|
||||
|
||||
for( y = -dy0; y < height + dy1; y++, cbuf += ndisp, cbuf_sub += ndisp,
|
||||
hsad += ndisp, lptr += sstep, lptr_sub += sstep, rptr += sstep )
|
||||
@@ -610,7 +610,7 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
{
|
||||
hsad = hsad0 - dy0*ndisp; cbuf = cbuf0 + (x + wsz2 + 1)*cstep - dy0*ndisp;
|
||||
lptr = lptr0 + std::min(std::max(x, -lofs), width-lofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + std::min(std::max(x, -rofs), width-rofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + std::min(std::max(x, -rofs), width-rofs-ndisp) - dy0*sstep;
|
||||
|
||||
for( y = -dy0; y < height + dy1; y++, hsad += ndisp, cbuf += ndisp, lptr += sstep, rptr += sstep )
|
||||
{
|
||||
@@ -661,7 +661,7 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
hsad = hsad0 - dy0*ndisp;
|
||||
lptr_sub = lptr0 + MIN(MAX(x0, -lofs), width-1-lofs) - dy0*sstep;
|
||||
lptr = lptr0 + MIN(MAX(x1, -lofs), width-1-lofs) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x1, -rofs), width-1-rofs) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x1, -rofs), width-ndisp-rofs) - dy0*sstep;
|
||||
|
||||
for( y = -dy0; y < height + dy1; y++, cbuf += ndisp, cbuf_sub += ndisp,
|
||||
hsad += ndisp, lptr += sstep, lptr_sub += sstep, rptr += sstep )
|
||||
|
||||
@@ -99,7 +99,7 @@ StereoSGBM::~StereoSGBM()
|
||||
}
|
||||
|
||||
/*
|
||||
For each pixel row1[x], max(-maxD, 0) <= minX <= x < maxX <= width - max(0, -minD),
|
||||
For each pixel row1[x], max(-maxD, 0) <= minX <= x < maxX <= width - max(0, minD),
|
||||
and for each disparity minD<=d<maxD the function
|
||||
computes the cost (cost[(x-minX)*(maxD - minD) + (d - minD)]), depending on the difference between
|
||||
row1[x] and row2[x-d]. The subpixel algorithm from
|
||||
@@ -114,8 +114,8 @@ static void calcPixelCostBT( const Mat& img1, const Mat& img2, int y,
|
||||
int tabOfs, int )
|
||||
{
|
||||
int x, c, width = img1.cols, cn = img1.channels();
|
||||
int minX1 = max(-maxD, 0), maxX1 = width + min(minD, 0);
|
||||
int minX2 = max(minX1 - maxD, 0), maxX2 = min(maxX1 - minD, width);
|
||||
int minX1 = max(-maxD, 0), maxX1 = width + min(-minD, 0);
|
||||
int minX2 = max(minX1 + minD, 0), maxX2 = min(maxX1 + maxD, width);
|
||||
int D = maxD - minD, width1 = maxX1 - minX1, width2 = maxX2 - minX2;
|
||||
const PixType *row1 = img1.ptr<PixType>(y), *row2 = img2.ptr<PixType>(y);
|
||||
PixType *prow1 = buffer + width2*2, *prow2 = prow1 + width*cn*2;
|
||||
@@ -200,6 +200,19 @@ static void calcPixelCostBT( const Mat& img1, const Mat& img2, int y,
|
||||
int u0 = min(ul, ur); u0 = min(u0, u);
|
||||
int u1 = max(ul, ur); u1 = max(u1, u);
|
||||
|
||||
int minDlocal = max(minD, x-width+1);
|
||||
int maxDlocal = min(maxD, x);
|
||||
int d;
|
||||
for( d = minD; d < minDlocal; d++ )
|
||||
{
|
||||
int v = prow2[0];
|
||||
int v0 = buffer[0];
|
||||
int v1 = buffer[width2];
|
||||
int c0 = max(0, u - v1); c0 = max(c0, v0 - u);
|
||||
int c1 = max(0, v - u1); c1 = max(c1, u0 - v);
|
||||
|
||||
cost[x*D + d] = (CostType)(cost[x*D+d] + (min(c0, c1) >> diff_scale));
|
||||
}
|
||||
#if CV_SSE2
|
||||
if( useSIMD )
|
||||
{
|
||||
@@ -207,7 +220,7 @@ static void calcPixelCostBT( const Mat& img1, const Mat& img2, int y,
|
||||
__m128i _u1 = _mm_set1_epi8((char)u1), z = _mm_setzero_si128();
|
||||
__m128i ds = _mm_cvtsi32_si128(diff_scale);
|
||||
|
||||
for( int d = minD; d < maxD; d += 16 )
|
||||
for( ; d < maxDlocal - 15; d += 16 )
|
||||
{
|
||||
__m128i _v = _mm_loadu_si128((const __m128i*)(prow2 + width-x-1 + d));
|
||||
__m128i _v0 = _mm_loadu_si128((const __m128i*)(buffer + width-x-1 + d));
|
||||
@@ -223,19 +236,26 @@ static void calcPixelCostBT( const Mat& img1, const Mat& img2, int y,
|
||||
_mm_store_si128((__m128i*)(cost + x*D + d + 8), _mm_adds_epi16(c1, _mm_srl_epi16(_mm_unpackhi_epi8(diff,z), ds)));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for( ; d < maxDlocal; d++ )
|
||||
{
|
||||
for( int d = minD; d < maxD; d++ )
|
||||
{
|
||||
int v = prow2[width-x-1 + d];
|
||||
int v0 = buffer[width-x-1 + d];
|
||||
int v1 = buffer[width-x-1 + d + width2];
|
||||
int c0 = max(0, u - v1); c0 = max(c0, v0 - u);
|
||||
int c1 = max(0, v - u1); c1 = max(c1, u0 - v);
|
||||
int v = prow2[width-x-1 + d];
|
||||
int v0 = buffer[width-x-1 + d];
|
||||
int v1 = buffer[width-x-1 + d + width2];
|
||||
int c0 = max(0, u - v1); c0 = max(c0, v0 - u);
|
||||
int c1 = max(0, v - u1); c1 = max(c1, u0 - v);
|
||||
|
||||
cost[x*D + d] = (CostType)(cost[x*D+d] + (min(c0, c1) >> diff_scale));
|
||||
}
|
||||
cost[x*D + d] = (CostType)(cost[x*D+d] + (min(c0, c1) >> diff_scale));
|
||||
}
|
||||
for( ; d < maxD; d++ )
|
||||
{
|
||||
int v = prow2[width-1];
|
||||
int v0 = buffer[width-1];
|
||||
int v1 = buffer[width-1 + width2];
|
||||
int c0 = max(0, u - v1); c0 = max(c0, v0 - u);
|
||||
int c1 = max(0, v - u1); c1 = max(c1, u0 - v);
|
||||
|
||||
cost[x*D + d] = (CostType)(cost[x*D+d] + (min(c0, c1) >> diff_scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,7 +349,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2,
|
||||
int disp12MaxDiff = params.disp12MaxDiff > 0 ? params.disp12MaxDiff : 1;
|
||||
int P1 = params.P1 > 0 ? params.P1 : 2, P2 = max(params.P2 > 0 ? params.P2 : 5, P1+1);
|
||||
int k, width = disp1.cols, height = disp1.rows;
|
||||
int minX1 = max(-maxD, 0), maxX1 = width + min(minD, 0);
|
||||
int minX1 = max(-maxD, 0), maxX1 = width + min(-minD, 0);
|
||||
int D = maxD - minD, width1 = maxX1 - minX1;
|
||||
int INVALID_DISP = minD - 1, INVALID_DISP_SCALED = INVALID_DISP*DISP_SCALE;
|
||||
int SW2 = SADWindowSize.width/2, SH2 = SADWindowSize.height/2;
|
||||
@@ -377,6 +397,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2,
|
||||
|
||||
// summary cost over different (nDirs) directions
|
||||
CostType* Cbuf = (CostType*)alignPtr(buffer.data, ALIGN);
|
||||
memset(Cbuf, 0, CSBufSize*sizeof(CostType));
|
||||
CostType* Sbuf = Cbuf + CSBufSize;
|
||||
CostType* hsumBuf = Sbuf + CSBufSize;
|
||||
CostType* pixDiff = hsumBuf + costBufSize*hsumBufNRows;
|
||||
|
||||
@@ -82,18 +82,18 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa
|
||||
CV_Error( CV_StsUnmatchedSizes, "Size of projection matrices must be 3x4" );
|
||||
|
||||
CvMat matrA;
|
||||
double matrA_dat[24];
|
||||
matrA = cvMat(6,4,CV_64F,matrA_dat);
|
||||
double matrA_dat[16];
|
||||
matrA = cvMat(4,4,CV_64F,matrA_dat);
|
||||
|
||||
//CvMat matrU;
|
||||
CvMat matrW;
|
||||
CvMat matrV;
|
||||
//double matrU_dat[9*9];
|
||||
double matrW_dat[6*4];
|
||||
double matrW_dat[4*4];
|
||||
double matrV_dat[4*4];
|
||||
|
||||
//matrU = cvMat(6,6,CV_64F,matrU_dat);
|
||||
matrW = cvMat(6,4,CV_64F,matrW_dat);
|
||||
matrW = cvMat(4,4,CV_64F,matrW_dat);
|
||||
matrV = cvMat(4,4,CV_64F,matrV_dat);
|
||||
|
||||
CvMat* projPoints[2];
|
||||
@@ -117,9 +117,8 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa
|
||||
y = cvmGet(projPoints[j],1,i);
|
||||
for( int k = 0; k < 4; k++ )
|
||||
{
|
||||
cvmSet(&matrA, j*3+0, k, x * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],0,k) );
|
||||
cvmSet(&matrA, j*3+1, k, y * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],1,k) );
|
||||
cvmSet(&matrA, j*3+2, k, x * cvmGet(projMatrs[j],1,k) - y * cvmGet(projMatrs[j],0,k) );
|
||||
cvmSet(&matrA, j*2+0, k, x * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],0,k) );
|
||||
cvmSet(&matrA, j*2+1, k, y * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],1,k) );
|
||||
}
|
||||
}
|
||||
/* Solve system for current point */
|
||||
|
||||
@@ -1480,7 +1480,7 @@ void CV_StereoCalibrationTest::run( int )
|
||||
|
||||
if( norm(R1t*R1 - eye33) > 0.01 ||
|
||||
norm(R2t*R2 - eye33) > 0.01 ||
|
||||
abs(determinant(F)) > 0.01)
|
||||
std::abs(determinant(F)) > 0.01)
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "The computed (by rectify) R1 and R2 are not orthogonal,"
|
||||
"or the computed (by calibrate) F is not singular, testcase %d\n", testcase);
|
||||
@@ -1617,7 +1617,7 @@ void CV_StereoCalibrationTest::run( int )
|
||||
perspectiveTransform( _imgpt1, rectifPoints1, _H1 );
|
||||
perspectiveTransform( _imgpt2, rectifPoints2, _H2 );
|
||||
|
||||
bool verticalStereo = abs(P2.at<double>(0,3)) < abs(P2.at<double>(1,3));
|
||||
bool verticalStereo = std::abs(P2.at<double>(0,3)) < std::abs(P2.at<double>(1,3));
|
||||
double maxDiff_c = 0, maxDiff_uc = 0;
|
||||
for( int i = 0, k = 0; i < nframes; i++ )
|
||||
{
|
||||
@@ -1627,9 +1627,9 @@ void CV_StereoCalibrationTest::run( int )
|
||||
|
||||
for( int j = 0; j < npoints; j++, k++ )
|
||||
{
|
||||
double diff_c = verticalStereo ? abs(temp[0][j].x - temp[1][j].x) : abs(temp[0][j].y - temp[1][j].y);
|
||||
double diff_c = verticalStereo ? std::abs(temp[0][j].x - temp[1][j].x) : std::abs(temp[0][j].y - temp[1][j].y);
|
||||
Point2f d = rectifPoints1.at<Point2f>(k,0) - rectifPoints2.at<Point2f>(k,0);
|
||||
double diff_uc = verticalStereo ? abs(d.x) : abs(d.y);
|
||||
double diff_uc = verticalStereo ? std::abs(d.x) : std::abs(d.y);
|
||||
maxDiff_c = max(maxDiff_c, diff_c);
|
||||
maxDiff_uc = max(maxDiff_uc, diff_uc);
|
||||
if( maxDiff_c > maxScanlineDistErr_c )
|
||||
@@ -1870,5 +1870,12 @@ TEST(Calib3d_CalibrationMatrixValues_C, accuracy) { CV_CalibrationMatrixValuesTe
|
||||
TEST(Calib3d_CalibrationMatrixValues_CPP, accuracy) { CV_CalibrationMatrixValuesTest_CPP test; test.safe_run(); }
|
||||
TEST(Calib3d_ProjectPoints_C, accuracy) { CV_ProjectPointsTest_C test; test.safe_run(); }
|
||||
TEST(Calib3d_ProjectPoints_CPP, regression) { CV_ProjectPointsTest_CPP test; test.safe_run(); }
|
||||
|
||||
#ifdef __aarch64__
|
||||
// Tests fail by accuracy (0.019145 vs 0.001000)
|
||||
TEST(Calib3d_StereoCalibrate_C, DISABLED_regression) { CV_StereoCalibrationTest_C test; test.safe_run(); }
|
||||
TEST(Calib3d_StereoCalibrate_CPP, DISABLED_regression) { CV_StereoCalibrationTest_CPP test; test.safe_run(); }
|
||||
#else
|
||||
TEST(Calib3d_StereoCalibrate_C, regression) { CV_StereoCalibrationTest_C test; test.safe_run(); }
|
||||
TEST(Calib3d_StereoCalibrate_CPP, regression) { CV_StereoCalibrationTest_CPP test; test.safe_run(); }
|
||||
#endif
|
||||
|
||||
@@ -110,11 +110,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
|
||||
if( !img )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", filename );
|
||||
if( max_idx == 1 )
|
||||
{
|
||||
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
|
||||
goto _exit_;
|
||||
}
|
||||
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,15 +100,15 @@ TEST_F(fisheyeTest, projectPoints)
|
||||
|
||||
TEST_F(fisheyeTest, undistortImage)
|
||||
{
|
||||
cv::Matx33d K = this->K;
|
||||
cv::Mat D = cv::Mat(this->D);
|
||||
cv::Matx33d theK = this->K;
|
||||
cv::Mat theD = cv::Mat(this->D);
|
||||
std::string file = combine(datasets_repository_path, "/calib-3_stereo_from_JY/left/stereo_pair_014.jpg");
|
||||
cv::Matx33d newK = K;
|
||||
cv::Matx33d newK = theK;
|
||||
cv::Mat distorted = cv::imread(file), undistorted;
|
||||
{
|
||||
newK(0, 0) = 100;
|
||||
newK(1, 1) = 100;
|
||||
cv::fisheye::undistortImage(distorted, undistorted, K, D, newK);
|
||||
cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK);
|
||||
cv::Mat correct = cv::imread(combine(datasets_repository_path, "new_f_100.png"));
|
||||
if (correct.empty())
|
||||
CV_Assert(cv::imwrite(combine(datasets_repository_path, "new_f_100.png"), undistorted));
|
||||
@@ -117,8 +117,8 @@ TEST_F(fisheyeTest, undistortImage)
|
||||
}
|
||||
{
|
||||
double balance = 1.0;
|
||||
cv::fisheye::estimateNewCameraMatrixForUndistortRectify(K, D, distorted.size(), cv::noArray(), newK, balance);
|
||||
cv::fisheye::undistortImage(distorted, undistorted, K, D, newK);
|
||||
cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance);
|
||||
cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK);
|
||||
cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_1.0.png"));
|
||||
if (correct.empty())
|
||||
CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_1.0.png"), undistorted));
|
||||
@@ -128,8 +128,8 @@ TEST_F(fisheyeTest, undistortImage)
|
||||
|
||||
{
|
||||
double balance = 0.0;
|
||||
cv::fisheye::estimateNewCameraMatrixForUndistortRectify(K, D, distorted.size(), cv::noArray(), newK, balance);
|
||||
cv::fisheye::undistortImage(distorted, undistorted, K, D, newK);
|
||||
cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance);
|
||||
cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK);
|
||||
cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_0.0.png"));
|
||||
if (correct.empty())
|
||||
CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_0.0.png"), undistorted));
|
||||
@@ -142,7 +142,7 @@ TEST_F(fisheyeTest, jacobians)
|
||||
{
|
||||
int n = 10;
|
||||
cv::Mat X(1, n, CV_64FC3);
|
||||
cv::Mat om(3, 1, CV_64F), T(3, 1, CV_64F);
|
||||
cv::Mat om(3, 1, CV_64F), theT(3, 1, CV_64F);
|
||||
cv::Mat f(2, 1, CV_64F), c(2, 1, CV_64F);
|
||||
cv::Mat k(4, 1, CV_64F);
|
||||
double alpha;
|
||||
@@ -155,8 +155,8 @@ TEST_F(fisheyeTest, jacobians)
|
||||
r.fill(om, cv::RNG::NORMAL, 0, 1);
|
||||
om = cv::abs(om);
|
||||
|
||||
r.fill(T, cv::RNG::NORMAL, 0, 1);
|
||||
T = cv::abs(T); T.at<double>(2) = 4; T *= 10;
|
||||
r.fill(theT, cv::RNG::NORMAL, 0, 1);
|
||||
theT = cv::abs(theT); theT.at<double>(2) = 4; theT *= 10;
|
||||
|
||||
r.fill(f, cv::RNG::NORMAL, 0, 1);
|
||||
f = cv::abs(f) * 1000;
|
||||
@@ -170,19 +170,19 @@ TEST_F(fisheyeTest, jacobians)
|
||||
alpha = 0.01*r.gaussian(1);
|
||||
|
||||
cv::Mat x1, x2, xpred;
|
||||
cv::Matx33d K(f.at<double>(0), alpha * f.at<double>(0), c.at<double>(0),
|
||||
cv::Matx33d theK(f.at<double>(0), alpha * f.at<double>(0), c.at<double>(0),
|
||||
0, f.at<double>(1), c.at<double>(1),
|
||||
0, 0, 1);
|
||||
|
||||
cv::Mat jacobians;
|
||||
cv::fisheye::projectPoints(X, x1, om, T, K, k, alpha, jacobians);
|
||||
cv::fisheye::projectPoints(X, x1, om, theT, theK, k, alpha, jacobians);
|
||||
|
||||
//test on T:
|
||||
cv::Mat dT(3, 1, CV_64FC1);
|
||||
r.fill(dT, cv::RNG::NORMAL, 0, 1);
|
||||
dT *= 1e-9*cv::norm(T);
|
||||
cv::Mat T2 = T + dT;
|
||||
cv::fisheye::projectPoints(X, x2, om, T2, K, k, alpha, cv::noArray());
|
||||
dT *= 1e-9*cv::norm(theT);
|
||||
cv::Mat T2 = theT + dT;
|
||||
cv::fisheye::projectPoints(X, x2, om, T2, theK, k, alpha, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.colRange(11,14) * dT).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
|
||||
@@ -191,7 +191,7 @@ TEST_F(fisheyeTest, jacobians)
|
||||
r.fill(dom, cv::RNG::NORMAL, 0, 1);
|
||||
dom *= 1e-9*cv::norm(om);
|
||||
cv::Mat om2 = om + dom;
|
||||
cv::fisheye::projectPoints(X, x2, om2, T, K, k, alpha, cv::noArray());
|
||||
cv::fisheye::projectPoints(X, x2, om2, theT, theK, k, alpha, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.colRange(8,11) * dom).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
|
||||
@@ -199,8 +199,8 @@ TEST_F(fisheyeTest, jacobians)
|
||||
cv::Mat df(2, 1, CV_64FC1);
|
||||
r.fill(df, cv::RNG::NORMAL, 0, 1);
|
||||
df *= 1e-9*cv::norm(f);
|
||||
cv::Matx33d K2 = K + cv::Matx33d(df.at<double>(0), df.at<double>(0) * alpha, 0, 0, df.at<double>(1), 0, 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, T, K2, k, alpha, cv::noArray());
|
||||
cv::Matx33d K2 = theK + cv::Matx33d(df.at<double>(0), df.at<double>(0) * alpha, 0, 0, df.at<double>(1), 0, 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, theT, K2, k, alpha, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.colRange(0,2) * df).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
|
||||
@@ -208,8 +208,8 @@ TEST_F(fisheyeTest, jacobians)
|
||||
cv::Mat dc(2, 1, CV_64FC1);
|
||||
r.fill(dc, cv::RNG::NORMAL, 0, 1);
|
||||
dc *= 1e-9*cv::norm(c);
|
||||
K2 = K + cv::Matx33d(0, 0, dc.at<double>(0), 0, 0, dc.at<double>(1), 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, T, K2, k, alpha, cv::noArray());
|
||||
K2 = theK + cv::Matx33d(0, 0, dc.at<double>(0), 0, 0, dc.at<double>(1), 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, theT, K2, k, alpha, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.colRange(2,4) * dc).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
|
||||
@@ -218,7 +218,7 @@ TEST_F(fisheyeTest, jacobians)
|
||||
r.fill(dk, cv::RNG::NORMAL, 0, 1);
|
||||
dk *= 1e-9*cv::norm(k);
|
||||
cv::Mat k2 = k + dk;
|
||||
cv::fisheye::projectPoints(X, x2, om, T, K, k2, alpha, cv::noArray());
|
||||
cv::fisheye::projectPoints(X, x2, om, theT, theK, k2, alpha, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.colRange(4,8) * dk).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
|
||||
@@ -227,8 +227,8 @@ TEST_F(fisheyeTest, jacobians)
|
||||
r.fill(dalpha, cv::RNG::NORMAL, 0, 1);
|
||||
dalpha *= 1e-9*cv::norm(f);
|
||||
double alpha2 = alpha + dalpha.at<double>(0);
|
||||
K2 = K + cv::Matx33d(0, f.at<double>(0) * dalpha.at<double>(0), 0, 0, 0, 0, 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, T, K, k, alpha2, cv::noArray());
|
||||
K2 = theK + cv::Matx33d(0, f.at<double>(0) * dalpha.at<double>(0), 0, 0, 0, 0, 0, 0, 0);
|
||||
cv::fisheye::projectPoints(X, x2, om, theT, theK, k, alpha2, cv::noArray());
|
||||
xpred = x1 + cv::Mat(jacobians.col(14) * dalpha).reshape(2, 1);
|
||||
CV_Assert (cv::norm(x2 - xpred) < 1e-10);
|
||||
}
|
||||
@@ -258,14 +258,14 @@ TEST_F(fisheyeTest, Calibration)
|
||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
||||
|
||||
cv::Matx33d K;
|
||||
cv::Vec4d D;
|
||||
cv::Matx33d theK;
|
||||
cv::Vec4d theD;
|
||||
|
||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, K, D,
|
||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD,
|
||||
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
||||
|
||||
EXPECT_MAT_NEAR(K, this->K, 1e-10);
|
||||
EXPECT_MAT_NEAR(D, this->D, 1e-10);
|
||||
EXPECT_MAT_NEAR(theK, this->K, 1e-10);
|
||||
EXPECT_MAT_NEAR(theD, this->D, 1e-10);
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, Homography)
|
||||
@@ -302,15 +302,15 @@ TEST_F(fisheyeTest, Homography)
|
||||
int Np = imagePointsNormalized.cols;
|
||||
cv::calcCovarMatrix(_objectPoints, covObjectPoints, objectPointsMean, CV_COVAR_NORMAL | CV_COVAR_COLS);
|
||||
cv::SVD svd(covObjectPoints);
|
||||
cv::Mat R(svd.vt);
|
||||
cv::Mat theR(svd.vt);
|
||||
|
||||
if (cv::norm(R(cv::Rect(2, 0, 1, 2))) < 1e-6)
|
||||
R = cv::Mat::eye(3,3, CV_64FC1);
|
||||
if (cv::determinant(R) < 0)
|
||||
R = -R;
|
||||
if (cv::norm(theR(cv::Rect(2, 0, 1, 2))) < 1e-6)
|
||||
theR = cv::Mat::eye(3,3, CV_64FC1);
|
||||
if (cv::determinant(theR) < 0)
|
||||
theR = -theR;
|
||||
|
||||
cv::Mat T = -R * objectPointsMean;
|
||||
cv::Mat X_new = R * _objectPoints + T * cv::Mat::ones(1, Np, CV_64FC1);
|
||||
cv::Mat theT = -theR * objectPointsMean;
|
||||
cv::Mat X_new = theR * _objectPoints + theT * cv::Mat::ones(1, Np, CV_64FC1);
|
||||
cv::Mat H = cv::internal::ComputeHomography(imagePointsNormalized, X_new.rowRange(0, 2));
|
||||
|
||||
cv::Mat M = cv::Mat::ones(3, X_new.cols, CV_64FC1);
|
||||
@@ -354,19 +354,19 @@ TEST_F(fisheyeTest, EtimateUncertainties)
|
||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
||||
|
||||
cv::Matx33d K;
|
||||
cv::Vec4d D;
|
||||
cv::Matx33d theK;
|
||||
cv::Vec4d theD;
|
||||
std::vector<cv::Vec3d> rvec;
|
||||
std::vector<cv::Vec3d> tvec;
|
||||
|
||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, K, D,
|
||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD,
|
||||
rvec, tvec, flag, cv::TermCriteria(3, 20, 1e-6));
|
||||
|
||||
cv::internal::IntrinsicParams param, errors;
|
||||
cv::Vec2d err_std;
|
||||
double thresh_cond = 1e6;
|
||||
int check_cond = 1;
|
||||
param.Init(cv::Vec2d(K(0,0), K(1,1)), cv::Vec2d(K(0,2), K(1, 2)), D);
|
||||
param.Init(cv::Vec2d(theK(0,0), theK(1,1)), cv::Vec2d(theK(0,2), theK(1, 2)), theD);
|
||||
param.isEstimate = std::vector<int>(9, 1);
|
||||
param.isEstimate[4] = 0;
|
||||
|
||||
@@ -381,7 +381,7 @@ TEST_F(fisheyeTest, EtimateUncertainties)
|
||||
EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.890439368129246, 0.816096854937896), 1e-10);
|
||||
EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.00516248605191506, 0.0168181467500934, 0.0213118690274604, 0.00916010877545648), 1e-10);
|
||||
EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-10);
|
||||
CV_Assert(abs(rms - 0.263782587133546) < 1e-10);
|
||||
CV_Assert(std::abs(rms - 0.263782587133546) < 1e-10);
|
||||
CV_Assert(errors.alpha == 0);
|
||||
}
|
||||
|
||||
@@ -397,12 +397,12 @@ TEST_F(fisheyeTest, rectify)
|
||||
cv::Matx33d K1 = this->K, K2 = K1;
|
||||
cv::Mat D1 = cv::Mat(this->D), D2 = D1;
|
||||
|
||||
cv::Vec3d T = this->T;
|
||||
cv::Matx33d R = this->R;
|
||||
cv::Vec3d theT = this->T;
|
||||
cv::Matx33d theR = this->R;
|
||||
|
||||
double balance = 0.0, fov_scale = 1.1;
|
||||
cv::Mat R1, R2, P1, P2, Q;
|
||||
cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, R, T, R1, R2, P1, P2, Q,
|
||||
cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, theR, theT, R1, R2, P1, P2, Q,
|
||||
cv::CALIB_ZERO_DISPARITY, requested_size, balance, fov_scale);
|
||||
|
||||
cv::Mat lmapx, lmapy, rmapx, rmapy;
|
||||
@@ -466,8 +466,8 @@ TEST_F(fisheyeTest, stereoCalibrate)
|
||||
fs_object[cv::format("image_%d", i )] >> objectPoints[i];
|
||||
fs_object.release();
|
||||
|
||||
cv::Matx33d K1, K2, R;
|
||||
cv::Vec3d T;
|
||||
cv::Matx33d K1, K2, theR;
|
||||
cv::Vec3d theT;
|
||||
cv::Vec4d D1, D2;
|
||||
|
||||
int flag = 0;
|
||||
@@ -477,7 +477,7 @@ TEST_F(fisheyeTest, stereoCalibrate)
|
||||
// flag |= cv::fisheye::CALIB_FIX_INTRINSIC;
|
||||
|
||||
cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
||||
K1, D1, K2, D2, imageSize, R, T, flag,
|
||||
K1, D1, K2, D2, imageSize, theR, theT, flag,
|
||||
cv::TermCriteria(3, 12, 0));
|
||||
|
||||
cv::Matx33d R_correct( 0.9975587205950972, 0.06953016383322372, 0.006492709911733523,
|
||||
@@ -495,8 +495,8 @@ TEST_F(fisheyeTest, stereoCalibrate)
|
||||
cv::Vec4d D1_correct (-7.44253716539556e-05, -0.00702662033932424, 0.00737569823650885, -0.00342230256441771);
|
||||
cv::Vec4d D2_correct (-0.0130785435677431, 0.0284434505383497, -0.0360333869900506, 0.0144724062347222);
|
||||
|
||||
EXPECT_MAT_NEAR(R, R_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(T, T_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(theR, R_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(theT, T_correct, 1e-10);
|
||||
|
||||
EXPECT_MAT_NEAR(K1, K1_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(K2, K2_correct, 1e-10);
|
||||
@@ -534,8 +534,8 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic)
|
||||
fs_object[cv::format("image_%d", i )] >> objectPoints[i];
|
||||
fs_object.release();
|
||||
|
||||
cv::Matx33d R;
|
||||
cv::Vec3d T;
|
||||
cv::Matx33d theR;
|
||||
cv::Vec3d theT;
|
||||
|
||||
int flag = 0;
|
||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
||||
@@ -555,7 +555,7 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic)
|
||||
cv::Vec4d D2 (-0.0130785435677431, 0.0284434505383497, -0.0360333869900506, 0.0144724062347222);
|
||||
|
||||
cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
||||
K1, D1, K2, D2, imageSize, R, T, flag,
|
||||
K1, D1, K2, D2, imageSize, theR, theT, flag,
|
||||
cv::TermCriteria(3, 12, 0));
|
||||
|
||||
cv::Matx33d R_correct( 0.9975587205950972, 0.06953016383322372, 0.006492709911733523,
|
||||
@@ -564,8 +564,8 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic)
|
||||
cv::Vec3d T_correct(-0.099402724724121, 0.00270812139265413, 0.00129330292472699);
|
||||
|
||||
|
||||
EXPECT_MAT_NEAR(R, R_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(T, T_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(theR, R_correct, 1e-10);
|
||||
EXPECT_MAT_NEAR(theT, T_correct, 1e-10);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -562,6 +563,9 @@ void CV_HomographyTest::run(int)
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
delete[]src_data;
|
||||
src_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,12 @@ protected:
|
||||
{
|
||||
InT d = disp(y, x);
|
||||
|
||||
double from[4] = { x, y, d, 1 };
|
||||
double from[4] = {
|
||||
static_cast<double>(x),
|
||||
static_cast<double>(y),
|
||||
static_cast<double>(d),
|
||||
1.0,
|
||||
};
|
||||
Mat_<double> res = Q * Mat_<double>(4, 1, from);
|
||||
res /= res(3, 0);
|
||||
|
||||
|
||||
@@ -101,7 +101,10 @@ void CV_UndistortPointsBadArgTest::run(int)
|
||||
img_size.height = 600;
|
||||
double cam[9] = {150.f, 0.f, img_size.width/2.f, 0, 300.f, img_size.height/2.f, 0.f, 0.f, 1.f};
|
||||
double dist[4] = {0.01,0.02,0.001,0.0005};
|
||||
double s_points[N_POINTS2] = {img_size.width/4,img_size.height/4};
|
||||
double s_points[N_POINTS2] = {
|
||||
static_cast<double>(img_size.width) / 4.0,
|
||||
static_cast<double>(img_size.height) / 4.0,
|
||||
};
|
||||
double d_points[N_POINTS2];
|
||||
double p[9] = {155.f, 0.f, img_size.width/2.f+img_size.width/50.f, 0, 310.f, img_size.height/2.f+img_size.height/50.f, 0.f, 0.f, 1.f};
|
||||
double r[9] = {1,0,0,0,1,0,0,0,1};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user