mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Compare commits
553 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df8e28283f | |||
| 4c2db3d6e7 | |||
| 8ab224746b | |||
| dae04aacc3 | |||
| b66adc81a4 | |||
| 211d44cfc5 | |||
| eb89f5207c | |||
| 29d1bce85f | |||
| 79eb3c5cde | |||
| befbe89bdf | |||
| eb45cf0c93 | |||
| 9b52b61451 | |||
| a01659825c | |||
| c098c18942 | |||
| b033a63e63 | |||
| cb8ddb1179 | |||
| 3f95818252 | |||
| 267241b889 | |||
| 8271bd5f14 | |||
| 1cee868e88 | |||
| d822d6f101 | |||
| f8d922ad3e | |||
| a8cb5c3983 | |||
| e23f7303a6 | |||
| 0d5ffec521 | |||
| 97eac3f394 | |||
| bb3c0c066c | |||
| 9b9769169f | |||
| 7df92bbb77 | |||
| 1f4586f3dd | |||
| 6d368dc1e7 | |||
| 51530d4d8e | |||
| 8541b7bf92 | |||
| b852108262 | |||
| 3747d2643f | |||
| 7d82171af4 | |||
| e6e817e613 | |||
| 0469c18726 | |||
| f5fecc7e9a | |||
| 4382970739 | |||
| d17740ec87 | |||
| 91511c1521 | |||
| 2e3e106676 | |||
| a1798cb28e | |||
| 80df44bd75 | |||
| bb05af8ece | |||
| 73042b32e1 | |||
| a1d151924d | |||
| fa5705613d | |||
| a7f9677378 | |||
| c1acbb02bc | |||
| 63a746c6ea | |||
| 7e03a8b279 | |||
| 5effebb5f5 | |||
| 8af175b81b | |||
| 4d3f9228aa | |||
| ac19420907 | |||
| f8a100f3e0 | |||
| 04b1822cff | |||
| bcb0ee3e4b | |||
| 9aa6528fd7 | |||
| 7efb09fb8f | |||
| 60803afe8f | |||
| ae89787984 | |||
| cf3a2e30cd | |||
| 259b9e093c | |||
| 5421d741bc | |||
| c4a63f6a86 | |||
| 20b6191842 | |||
| 64d679ecb4 | |||
| 9dc51a1aa4 | |||
| 2d3aa3861c | |||
| 244f126ff6 | |||
| 3b65b710b6 | |||
| 0dba5bdc4a | |||
| 46d39aff68 | |||
| 6bf4a7ce01 | |||
| dc21e2cc0e | |||
| fe5eaae102 | |||
| 846266fde4 | |||
| 49efc250d3 | |||
| a66018d14d | |||
| b0ad84cfa2 | |||
| 640e180efe | |||
| 034ef02409 | |||
| 9c7ba6db90 | |||
| 68c57a1e82 | |||
| 284b2fc1e7 | |||
| 17713f6831 | |||
| a1e5bd71f1 | |||
| 0a16d93e1d | |||
| b4e4f13f9e | |||
| 4d9698a4cf | |||
| bff92da970 | |||
| d76226e21b | |||
| bfb1ba371c | |||
| 0470bb0e29 | |||
| 16869225ff | |||
| 3940b6163b | |||
| 51cb6998ea | |||
| 0c02e5de25 | |||
| a489d86e5f | |||
| ae036838dd | |||
| 6b8de222d7 | |||
| 5f94a205d1 | |||
| 882971151d | |||
| 136e5eb804 | |||
| 24d8cbf940 | |||
| 80708008a4 | |||
| 5726e80f77 | |||
| f9484bae8a | |||
| 61c347fb76 | |||
| 357a856cf6 | |||
| 6f76e7b42d | |||
| adc15c2bba | |||
| 3ebfe60008 | |||
| 8e79de35a8 | |||
| a5afcd9f11 | |||
| a87607e3ef | |||
| 836635d2d5 | |||
| 4d7a593c25 | |||
| 1bb0c5747c | |||
| 0084dee05b | |||
| 1f8df38dba | |||
| 3eff05e3eb | |||
| 45969bb3ae | |||
| 0eaeff0641 | |||
| 229aa62300 | |||
| f351540eda | |||
| 806e9241a6 | |||
| b3e18d23a3 | |||
| f7a474180b | |||
| fde0185a77 | |||
| 22f42a639f | |||
| 4aa891e773 | |||
| 60ce2b2e9f | |||
| da70b04262 | |||
| 3c1917771b | |||
| b184d7f27b | |||
| ba4513503e | |||
| b5248dbf3f | |||
| fa3f29f2b5 | |||
| 099ea91823 | |||
| a600267b9f | |||
| 29deff8707 | |||
| af8aa8a2fa | |||
| fb7e74c511 | |||
| eedf86402d | |||
| 767b28f2e3 | |||
| fbc69e444b | |||
| c1c3139368 | |||
| 409bd162ff | |||
| e6f6707558 | |||
| 7dc22b4ea6 | |||
| a228633d31 | |||
| 1db1a83410 | |||
| 7dc549f166 | |||
| c78142acb0 | |||
| dbb7aa7856 | |||
| d695d4a0bf | |||
| e1a598c5b3 | |||
| 681a8c6e18 | |||
| ced8e7a813 | |||
| 2b0c3eb170 | |||
| 1cf75c0cab | |||
| 51421098dd | |||
| dc50dc7254 | |||
| 3e5890694e | |||
| f5330a44e8 | |||
| 31c8f2ec57 | |||
| 46d128e073 | |||
| aa5311ea9f | |||
| efafd4a9e5 | |||
| 7fd21d217a | |||
| ce42593fe6 | |||
| 7cbc4e88de | |||
| 4c1ed13846 | |||
| 8754adc021 | |||
| af9368d35f | |||
| c35dab9046 | |||
| 6f19ef8631 | |||
| 5cb2d1c20d | |||
| e460a29cab | |||
| da9bdf9c15 | |||
| 77df5948e7 | |||
| e35d98e566 | |||
| b7659c62f3 | |||
| 394c74b349 | |||
| e6420c523d | |||
| de6d13088f | |||
| 689589ebaa | |||
| 95d7ecb33f | |||
| 13182da945 | |||
| a0a4f6c23d | |||
| 224124b69e | |||
| 38ef8894b7 | |||
| 017a282c7a | |||
| 01527c44fd | |||
| a8eab26bae | |||
| 63235f51f0 | |||
| cc529d971b | |||
| 8236181c62 | |||
| 01a980aa9e | |||
| e8d26b02ac | |||
| 7358b44222 | |||
| 9a98cd6e65 | |||
| b6dafed5ba | |||
| 8cbb284b7b | |||
| 9fcb0b2201 | |||
| aad289a3a2 | |||
| 150e522bee | |||
| 510680a5df | |||
| 03bd82796d | |||
| 56754e907d | |||
| 1a5dfe421d | |||
| ed1aa73dd3 | |||
| cce225f6e9 | |||
| e2f5001b11 | |||
| 8b8c368148 | |||
| d1606b4aa3 | |||
| e0d991cf46 | |||
| fa272c43c2 | |||
| a1de9e9ad5 | |||
| 1ce5165cb7 | |||
| 1454843b81 | |||
| b92a46c130 | |||
| ecbe843061 | |||
| b4a535272c | |||
| dbe7634286 | |||
| b8d8b0568c | |||
| eb247d826f | |||
| 9e69e2a07a | |||
| 7da3e98dfd | |||
| 55b9c0374c | |||
| 91ab92c349 | |||
| 879c0196d4 | |||
| 5d43d3ca88 | |||
| e55679079f | |||
| 3994cfbc59 | |||
| d02c291160 | |||
| 8bbce0a2a2 | |||
| e55f2b2602 | |||
| 9aef26e2ad | |||
| 261546f6f6 | |||
| bb4199b177 | |||
| 281666887e | |||
| f1c062c30a | |||
| 5dc17f5d58 | |||
| 069dd8a068 | |||
| f8ccc115ef | |||
| 17fea0dd0a | |||
| 998aefd1d1 | |||
| 975a6299fa | |||
| eb8728d727 | |||
| 63dbe66b41 | |||
| 3cc27c769c | |||
| becbfa6281 | |||
| 8b44a42a40 | |||
| 1d68a89947 | |||
| 48f95d92ae | |||
| 5dbdadb769 | |||
| 5a8363a44e | |||
| d534d04f25 | |||
| bfc27271e2 | |||
| b86088b89c | |||
| c1b6bf21d5 | |||
| 3e1f74f2ca | |||
| b10d4b05ed | |||
| 5d099df578 | |||
| 3e4bb371c8 | |||
| b6ba1f226c | |||
| da44a2fac1 | |||
| 34b02f6437 | |||
| 6ae4a9b09b | |||
| e91b818e3e | |||
| a078653ab4 | |||
| 530702c5f2 | |||
| feed2c074d | |||
| 65b4d77959 | |||
| 4ab891e9e5 | |||
| 435615ba2e | |||
| ccda4bf008 | |||
| 0cd0e4749b | |||
| 286fe261d0 | |||
| a098fb1803 | |||
| b8c6adc569 | |||
| cd1ffd169c | |||
| a1ad1f0800 | |||
| 214cbabc40 | |||
| a138e5a6a5 | |||
| d8f7377122 | |||
| ede5b23753 | |||
| 2bef73c968 | |||
| a518d7a1cb | |||
| 9ef8aeadd3 | |||
| e2db68f822 | |||
| 952027a853 | |||
| e91bf95d58 | |||
| dbce90692a | |||
| e630be3890 | |||
| 8401ed9395 | |||
| 7161b5bbad | |||
| 7e6293d9ec | |||
| b13d4bafa8 | |||
| 49731ad530 | |||
| 3d261e8a01 | |||
| 87935f3560 | |||
| 063d8b4211 | |||
| d14e007fdb | |||
| 40f6f679b8 | |||
| 2b3013fd20 | |||
| c815043607 | |||
| e7e63fac6c | |||
| 0dad2876e2 | |||
| 5ae9add102 | |||
| d45350a06a | |||
| 3e59ddbace | |||
| d9dc5ffa91 | |||
| 7a0a9d010b | |||
| 51aa649499 | |||
| c41e8006c7 | |||
| eb9d7c4dd5 | |||
| 73389b2b9c | |||
| 452ea4c15f | |||
| 39201e68e2 | |||
| f332cba14b | |||
| 3dc2dbc17e | |||
| d093cb54d5 | |||
| 64fd54ffb4 | |||
| 24caa80143 | |||
| 086792ec06 | |||
| 0a4a1d7526 | |||
| 078d49609e | |||
| dca5684145 | |||
| 9145985ff4 | |||
| 7ff9d7eb2d | |||
| 3715f71aaf | |||
| 167a26642e | |||
| a4b34e7ae1 | |||
| dda999545c | |||
| 7821fe2bde | |||
| b75cbfde45 | |||
| a548a08129 | |||
| 32bc89f094 | |||
| 33d42b740c | |||
| d847387694 | |||
| eabcfa5652 | |||
| 6cb90c0e97 | |||
| 130914d9f4 | |||
| 02ebc4368c | |||
| 64244e160b | |||
| 6bf599b1bc | |||
| 088535fa56 | |||
| 58afe5dd17 | |||
| 5f8d8c0069 | |||
| 4e4a7d0353 | |||
| ee97a5e757 | |||
| f02204847a | |||
| 8dbc96fed8 | |||
| 8ce691e679 | |||
| 2272a58769 | |||
| 2fde4d8a94 | |||
| 2443e8090e | |||
| 49dfa5a17f | |||
| 4c99196399 | |||
| 9628abc786 | |||
| 87e0c26129 | |||
| 5d2edced26 | |||
| a7821c60e5 | |||
| f197d8b91c | |||
| 890f1baff0 | |||
| 4d28e8243c | |||
| ae795e5797 | |||
| a13e32f5ab | |||
| d509165d96 | |||
| bf4994554d | |||
| 7acea48788 | |||
| 58882e5c22 | |||
| 6b9ebcbf3d | |||
| 601b7d1dd3 | |||
| 2ae20c74a2 | |||
| 3f458c6eb1 | |||
| d3e24f3cbf | |||
| e21c6e19db | |||
| 5327482b46 | |||
| 4f9c081dc3 | |||
| 157202fc8d | |||
| b036fc756a | |||
| 4ce684e61c | |||
| 795c108f2b | |||
| 6811d2ab24 | |||
| 5db1754d49 | |||
| 09d25e11c6 | |||
| a0c98dcefa | |||
| 44970ddf56 | |||
| 05b9c991dd | |||
| 46be47cb4b | |||
| 4eb9b9d6cf | |||
| 53494ba397 | |||
| 15678efe84 | |||
| 8399568edf | |||
| 0566ab4d3d | |||
| df63060e4d | |||
| 4175916b2a | |||
| d649f47eeb | |||
| d014cb8fb4 | |||
| c45492371a | |||
| 719149877e | |||
| ee36717db4 | |||
| c48777a1c3 | |||
| 0ccc903647 | |||
| 41fd711ab0 | |||
| 4b885e2067 | |||
| 4f6f6e8cac | |||
| 6ef0253fb7 | |||
| f7b5e6544f | |||
| 648facccd6 | |||
| 709e8e8e07 | |||
| 734bf8babd | |||
| 4880858119 | |||
| cea9a97434 | |||
| b3eee49451 | |||
| 60906d9175 | |||
| d6a88397b4 | |||
| 8fe79738ce | |||
| 86aabf704f | |||
| f9aa148ba9 | |||
| 358e59e91b | |||
| b94963d381 | |||
| e79c875fe2 | |||
| 24be7b26cd | |||
| 0206f419c1 | |||
| 1e038e2837 | |||
| 4aa9f83100 | |||
| 1acc1085d2 | |||
| 83fe2f3b16 | |||
| 1e27b07e29 | |||
| 4293a54447 | |||
| edce617a58 | |||
| 51d3138dff | |||
| 83cdd43a4c | |||
| 58e7d9f32f | |||
| f22d9a232d | |||
| 4ec1930949 | |||
| bc72f4d2a2 | |||
| 08d8faf9da | |||
| f9268d34dc | |||
| 6e22be4100 | |||
| ce07840e9f | |||
| 6b7d890f34 | |||
| 9941c6710d | |||
| e8dd31aacd | |||
| d6a7e8f84f | |||
| b633c73c46 | |||
| 529bd41751 | |||
| d3ac1bc314 | |||
| 27c1bd2762 | |||
| 069f3d8d9a | |||
| 2509fa8080 | |||
| 5a5c82bb1d | |||
| 26f5d2d639 | |||
| b674cd8571 | |||
| 8c91a1af71 | |||
| 037ffcdf99 | |||
| 22a3cf0fba | |||
| 0cea828a10 | |||
| bc741ab25f | |||
| 64c94cb22c | |||
| d449ba104a | |||
| 6da7c50fb5 | |||
| 442082eb0f | |||
| 92fc763925 | |||
| 459e7d4a80 | |||
| 400fea8626 | |||
| a9687a341e | |||
| ae9d24d433 | |||
| 8c60498673 | |||
| 1ae71fe205 | |||
| be530bd085 | |||
| 80d0593dbd | |||
| 66145ea06c | |||
| dd71bef6f5 | |||
| e719bee2b8 | |||
| 63ae0eeba5 | |||
| 34c630faf4 | |||
| 3a6d248bee | |||
| ea0c9b7f5c | |||
| cc08e00876 | |||
| fffac2f085 | |||
| dfe7c98090 | |||
| f3ee1c3d2f | |||
| 917b883cf0 | |||
| a63576e76d | |||
| de431609db | |||
| 5d5527d03e | |||
| 4088013251 | |||
| 88a883e68e | |||
| 8660e048bc | |||
| d4087f19a2 | |||
| 12c25b9310 | |||
| e88253ccad | |||
| f44de302a0 | |||
| b7c97f6e30 | |||
| e8d2a9752b | |||
| 10849d1c7a | |||
| 17ca7f9545 | |||
| 658282fcbe | |||
| ee270d1a18 | |||
| 740b1f235e | |||
| a118577a57 | |||
| ce503c64bf | |||
| 00a180185e | |||
| 1c639befe6 | |||
| b1899e5489 | |||
| 6f292d8036 | |||
| f07e9e7c5f | |||
| 2784fd7b27 | |||
| c289c8a700 | |||
| 13c058ecf8 | |||
| df0c43321d | |||
| 8f10ca5180 | |||
| 9f04222a75 | |||
| 060e58d080 | |||
| b5936648ca | |||
| f2cf9dd8bf | |||
| 7069b4b761 | |||
| 0e3553130a | |||
| c34fc180a7 | |||
| 77d04a2622 | |||
| 1d01c49a06 | |||
| def17f2baa | |||
| 72cfff4c59 | |||
| 45dd18955f | |||
| b0b199ee8a | |||
| 894724eaf0 | |||
| 7a78559708 | |||
| 3bc952ed34 | |||
| 9dea590ada | |||
| 3dcddad88a | |||
| 39754bd6f9 | |||
| 0a1ff0d42d | |||
| e38ba1999b | |||
| 6ce03b0484 | |||
| 2153453fd1 | |||
| eb7ff99f80 | |||
| 098d4e6174 | |||
| 632b21e090 | |||
| 2cf16db683 | |||
| 00300baa53 | |||
| 7b551af424 | |||
| 95ebdf4069 | |||
| 3b4f65b186 | |||
| e59912f803 |
@@ -1,6 +1,7 @@
|
||||
*.autosave
|
||||
*.pyc
|
||||
*.user
|
||||
*~
|
||||
.*.swp
|
||||
.DS_Store
|
||||
.sw[a-z]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[tgit]
|
||||
icon = doc/opencv.ico
|
||||
Vendored
-502
@@ -1,502 +0,0 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// multimon.h -- Stub module that fakes multiple monitor apis on Win32 OSes
|
||||
// without them.
|
||||
//
|
||||
// By using this header your code will get back default values from
|
||||
// GetSystemMetrics() for new metrics, and the new multimonitor APIs
|
||||
// will act like only one display is present on a Win32 OS without
|
||||
// multimonitor APIs.
|
||||
//
|
||||
// Exactly one source must include this with COMPILE_MULTIMON_STUBS defined.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Assume C declarations for C++
|
||||
#endif // __cplusplus
|
||||
|
||||
//
|
||||
// If we are building with Win95/NT4 headers, we need to declare
|
||||
// the multimonitor-related metrics and APIs ourselves.
|
||||
//
|
||||
#ifndef SM_CMONITORS
|
||||
|
||||
#define SM_XVIRTUALSCREEN 76
|
||||
#define SM_YVIRTUALSCREEN 77
|
||||
#define SM_CXVIRTUALSCREEN 78
|
||||
#define SM_CYVIRTUALSCREEN 79
|
||||
#define SM_CMONITORS 80
|
||||
#define SM_SAMEDISPLAYFORMAT 81
|
||||
|
||||
// HMONITOR is already declared if WINVER >= 0x0500 in windef.h
|
||||
// This is for components built with an older version number.
|
||||
//
|
||||
#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500)
|
||||
DECLARE_HANDLE(HMONITOR);
|
||||
#define HMONITOR_DECLARED
|
||||
#endif
|
||||
|
||||
#define MONITOR_DEFAULTTONULL 0x00000000
|
||||
#define MONITOR_DEFAULTTOPRIMARY 0x00000001
|
||||
#define MONITOR_DEFAULTTONEAREST 0x00000002
|
||||
|
||||
#define MONITORINFOF_PRIMARY 0x00000001
|
||||
|
||||
typedef struct tagMONITORINFO
|
||||
{
|
||||
DWORD cbSize;
|
||||
RECT rcMonitor;
|
||||
RECT rcWork;
|
||||
DWORD dwFlags;
|
||||
} MONITORINFO, *LPMONITORINFO;
|
||||
|
||||
#ifndef CCHDEVICENAME
|
||||
#define CCHDEVICENAME 32
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef struct tagMONITORINFOEXA : public tagMONITORINFO
|
||||
{
|
||||
CHAR szDevice[CCHDEVICENAME];
|
||||
} MONITORINFOEXA, *LPMONITORINFOEXA;
|
||||
typedef struct tagMONITORINFOEXW : public tagMONITORINFO
|
||||
{
|
||||
WCHAR szDevice[CCHDEVICENAME];
|
||||
} MONITORINFOEXW, *LPMONITORINFOEXW;
|
||||
#ifdef UNICODE
|
||||
typedef MONITORINFOEXW MONITORINFOEX;
|
||||
typedef LPMONITORINFOEXW LPMONITORINFOEX;
|
||||
#else
|
||||
typedef MONITORINFOEXA MONITORINFOEX;
|
||||
typedef LPMONITORINFOEXA LPMONITORINFOEX;
|
||||
#endif // UNICODE
|
||||
#else // ndef __cplusplus
|
||||
typedef struct tagMONITORINFOEXA
|
||||
{
|
||||
MONITORINFO;
|
||||
CHAR szDevice[CCHDEVICENAME];
|
||||
} MONITORINFOEXA, *LPMONITORINFOEXA;
|
||||
typedef struct tagMONITORINFOEXW
|
||||
{
|
||||
MONITORINFO;
|
||||
WCHAR szDevice[CCHDEVICENAME];
|
||||
} MONITORINFOEXW, *LPMONITORINFOEXW;
|
||||
#ifdef UNICODE
|
||||
typedef MONITORINFOEXW MONITORINFOEX;
|
||||
typedef LPMONITORINFOEXW LPMONITORINFOEX;
|
||||
#else
|
||||
typedef MONITORINFOEXA MONITORINFOEX;
|
||||
typedef LPMONITORINFOEXA LPMONITORINFOEX;
|
||||
#endif // UNICODE
|
||||
#endif
|
||||
|
||||
typedef BOOL (CALLBACK* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM);
|
||||
|
||||
#ifndef DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
||||
typedef struct _DISPLAY_DEVICEA {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD StateFlags;
|
||||
CHAR DeviceID[128];
|
||||
CHAR DeviceKey[128];
|
||||
} DISPLAY_DEVICEA, *PDISPLAY_DEVICEA, *LPDISPLAY_DEVICEA;
|
||||
typedef struct _DISPLAY_DEVICEW {
|
||||
DWORD cb;
|
||||
WCHAR DeviceName[32];
|
||||
WCHAR DeviceString[128];
|
||||
DWORD StateFlags;
|
||||
WCHAR DeviceID[128];
|
||||
WCHAR DeviceKey[128];
|
||||
} DISPLAY_DEVICEW, *PDISPLAY_DEVICEW, *LPDISPLAY_DEVICEW;
|
||||
#ifdef UNICODE
|
||||
typedef DISPLAY_DEVICEW DISPLAY_DEVICE;
|
||||
typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE;
|
||||
typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE;
|
||||
#else
|
||||
typedef DISPLAY_DEVICEA DISPLAY_DEVICE;
|
||||
typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE;
|
||||
typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE;
|
||||
#endif // UNICODE
|
||||
|
||||
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001
|
||||
#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002
|
||||
#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004
|
||||
#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008
|
||||
#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010
|
||||
#endif
|
||||
|
||||
#endif // SM_CMONITORS
|
||||
|
||||
#undef GetMonitorInfo
|
||||
#undef GetSystemMetrics
|
||||
#undef MonitorFromWindow
|
||||
#undef MonitorFromRect
|
||||
#undef MonitorFromPoint
|
||||
#undef EnumDisplayMonitors
|
||||
#undef EnumDisplayDevices
|
||||
|
||||
//
|
||||
// Define COMPILE_MULTIMON_STUBS to compile the stubs;
|
||||
// otherwise, you get the declarations.
|
||||
//
|
||||
#ifdef COMPILE_MULTIMON_STUBS
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Implement the API stubs.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MULTIMON_USE_SECURE_CRT
|
||||
#if defined(__GOT_SECURE_LIB__) && __GOT_SECURE_LIB__ >= 200402L
|
||||
#define _MULTIMON_USE_SECURE_CRT 1
|
||||
#else
|
||||
#define _MULTIMON_USE_SECURE_CRT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MULTIMON_FNS_DEFINED
|
||||
|
||||
int (WINAPI* g_pfnGetSystemMetrics)(int) = NULL;
|
||||
HMONITOR (WINAPI* g_pfnMonitorFromWindow)(HWND, DWORD) = NULL;
|
||||
HMONITOR (WINAPI* g_pfnMonitorFromRect)(LPCRECT, DWORD) = NULL;
|
||||
HMONITOR (WINAPI* g_pfnMonitorFromPoint)(POINT, DWORD) = NULL;
|
||||
BOOL (WINAPI* g_pfnGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL;
|
||||
BOOL (WINAPI* g_pfnEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM) = NULL;
|
||||
BOOL (WINAPI* g_pfnEnumDisplayDevices)(PVOID, DWORD, PDISPLAY_DEVICE,DWORD) = NULL;
|
||||
BOOL g_fMultiMonInitDone = FALSE;
|
||||
BOOL g_fMultimonPlatformNT = FALSE;
|
||||
|
||||
#endif
|
||||
|
||||
BOOL IsPlatformNT()
|
||||
{
|
||||
OSVERSIONINFOA osvi = {0};
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
GetVersionExA((OSVERSIONINFOA*)&osvi);
|
||||
return (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId);
|
||||
}
|
||||
|
||||
BOOL InitMultipleMonitorStubs(void)
|
||||
{
|
||||
HMODULE hUser32;
|
||||
if (g_fMultiMonInitDone)
|
||||
{
|
||||
return g_pfnGetMonitorInfo != NULL;
|
||||
}
|
||||
|
||||
g_fMultimonPlatformNT = IsPlatformNT();
|
||||
hUser32 = GetModuleHandle(TEXT("USER32"));
|
||||
if (hUser32 &&
|
||||
(*(FARPROC*)&g_pfnGetSystemMetrics = GetProcAddress(hUser32,"GetSystemMetrics")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnMonitorFromWindow = GetProcAddress(hUser32,"MonitorFromWindow")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnMonitorFromRect = GetProcAddress(hUser32,"MonitorFromRect")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnMonitorFromPoint = GetProcAddress(hUser32,"MonitorFromPoint")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnEnumDisplayMonitors = GetProcAddress(hUser32,"EnumDisplayMonitors")) != NULL &&
|
||||
#ifdef UNICODE
|
||||
(*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesW")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnGetMonitorInfo = g_fMultimonPlatformNT ? GetProcAddress(hUser32,"GetMonitorInfoW") :
|
||||
GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL
|
||||
#else
|
||||
(*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL &&
|
||||
(*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesA")) != NULL
|
||||
#endif
|
||||
) {
|
||||
g_fMultiMonInitDone = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pfnGetSystemMetrics = NULL;
|
||||
g_pfnMonitorFromWindow = NULL;
|
||||
g_pfnMonitorFromRect = NULL;
|
||||
g_pfnMonitorFromPoint = NULL;
|
||||
g_pfnGetMonitorInfo = NULL;
|
||||
g_pfnEnumDisplayMonitors = NULL;
|
||||
g_pfnEnumDisplayDevices = NULL;
|
||||
|
||||
g_fMultiMonInitDone = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// fake implementations of Monitor APIs that work with the primary display
|
||||
// no special parameter validation is made since these run in client code
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int WINAPI
|
||||
xGetSystemMetrics(int nIndex)
|
||||
{
|
||||
if (InitMultipleMonitorStubs())
|
||||
return g_pfnGetSystemMetrics(nIndex);
|
||||
|
||||
switch (nIndex)
|
||||
{
|
||||
case SM_CMONITORS:
|
||||
case SM_SAMEDISPLAYFORMAT:
|
||||
return 1;
|
||||
|
||||
case SM_XVIRTUALSCREEN:
|
||||
case SM_YVIRTUALSCREEN:
|
||||
return 0;
|
||||
|
||||
case SM_CXVIRTUALSCREEN:
|
||||
nIndex = SM_CXSCREEN;
|
||||
break;
|
||||
|
||||
case SM_CYVIRTUALSCREEN:
|
||||
nIndex = SM_CYSCREEN;
|
||||
break;
|
||||
}
|
||||
|
||||
return GetSystemMetrics(nIndex);
|
||||
}
|
||||
|
||||
#define xPRIMARY_MONITOR ((HMONITOR)0x12340042)
|
||||
|
||||
HMONITOR WINAPI
|
||||
xMonitorFromPoint(POINT ptScreenCoords, DWORD dwFlags)
|
||||
{
|
||||
if (InitMultipleMonitorStubs())
|
||||
return g_pfnMonitorFromPoint(ptScreenCoords, dwFlags);
|
||||
|
||||
if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) ||
|
||||
((ptScreenCoords.x >= 0) &&
|
||||
(ptScreenCoords.x < GetSystemMetrics(SM_CXSCREEN)) &&
|
||||
(ptScreenCoords.y >= 0) &&
|
||||
(ptScreenCoords.y < GetSystemMetrics(SM_CYSCREEN))))
|
||||
{
|
||||
return xPRIMARY_MONITOR;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HMONITOR WINAPI
|
||||
xMonitorFromRect(LPCRECT lprcScreenCoords, DWORD dwFlags)
|
||||
{
|
||||
if (InitMultipleMonitorStubs())
|
||||
return g_pfnMonitorFromRect(lprcScreenCoords, dwFlags);
|
||||
|
||||
if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) ||
|
||||
((lprcScreenCoords->right > 0) &&
|
||||
(lprcScreenCoords->bottom > 0) &&
|
||||
(lprcScreenCoords->left < GetSystemMetrics(SM_CXSCREEN)) &&
|
||||
(lprcScreenCoords->top < GetSystemMetrics(SM_CYSCREEN))))
|
||||
{
|
||||
return xPRIMARY_MONITOR;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HMONITOR WINAPI
|
||||
xMonitorFromWindow(HWND hWnd, DWORD dwFlags)
|
||||
{
|
||||
WINDOWPLACEMENT wp;
|
||||
|
||||
if (InitMultipleMonitorStubs())
|
||||
return g_pfnMonitorFromWindow(hWnd, dwFlags);
|
||||
|
||||
if (dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST))
|
||||
return xPRIMARY_MONITOR;
|
||||
|
||||
if (IsIconic(hWnd) ?
|
||||
GetWindowPlacement(hWnd, &wp) :
|
||||
GetWindowRect(hWnd, &wp.rcNormalPosition)) {
|
||||
|
||||
return xMonitorFromRect(&wp.rcNormalPosition, dwFlags);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
xGetMonitorInfo(HMONITOR hMonitor, __inout LPMONITORINFO lpMonitorInfo)
|
||||
{
|
||||
RECT rcWork;
|
||||
|
||||
if (InitMultipleMonitorStubs())
|
||||
{
|
||||
BOOL f = g_pfnGetMonitorInfo(hMonitor, lpMonitorInfo);
|
||||
#ifdef UNICODE
|
||||
if (f && !g_fMultimonPlatformNT && (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX)))
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0,
|
||||
(LPSTR)((MONITORINFOEX*)lpMonitorInfo)->szDevice, -1,
|
||||
((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR)));
|
||||
}
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
if ((hMonitor == xPRIMARY_MONITOR) &&
|
||||
lpMonitorInfo &&
|
||||
(lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) &&
|
||||
SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
|
||||
{
|
||||
lpMonitorInfo->rcMonitor.left = 0;
|
||||
lpMonitorInfo->rcMonitor.top = 0;
|
||||
lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
lpMonitorInfo->rcWork = rcWork;
|
||||
lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
|
||||
|
||||
if (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX))
|
||||
{
|
||||
#ifdef UNICODE
|
||||
MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, ((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR)));
|
||||
#else // UNICODE
|
||||
#if _MULTIMON_USE_SECURE_CRT
|
||||
strncpy_s(((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR)), TEXT("DISPLAY"), (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR)) - 1);
|
||||
#else
|
||||
lstrcpyn(((MONITORINFOEX*)lpMonitorInfo)->szDevice, TEXT("DISPLAY"), (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR)));
|
||||
#endif // _MULTIMON_USE_SECURE_CRT
|
||||
#endif // UNICODE
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
xEnumDisplayMonitors(
|
||||
HDC hdcOptionalForPainting,
|
||||
LPCRECT lprcEnumMonitorsThatIntersect,
|
||||
MONITORENUMPROC lpfnEnumProc,
|
||||
LPARAM dwData)
|
||||
{
|
||||
RECT rcLimit;
|
||||
|
||||
if (InitMultipleMonitorStubs()) {
|
||||
return g_pfnEnumDisplayMonitors(
|
||||
hdcOptionalForPainting,
|
||||
lprcEnumMonitorsThatIntersect,
|
||||
lpfnEnumProc,
|
||||
dwData);
|
||||
}
|
||||
|
||||
if (!lpfnEnumProc)
|
||||
return FALSE;
|
||||
|
||||
rcLimit.left = 0;
|
||||
rcLimit.top = 0;
|
||||
rcLimit.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
rcLimit.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
if (hdcOptionalForPainting)
|
||||
{
|
||||
RECT rcClip;
|
||||
POINT ptOrg;
|
||||
|
||||
switch (GetClipBox(hdcOptionalForPainting, &rcClip))
|
||||
{
|
||||
default:
|
||||
if (!GetDCOrgEx(hdcOptionalForPainting, &ptOrg))
|
||||
return FALSE;
|
||||
|
||||
OffsetRect(&rcLimit, -ptOrg.x, -ptOrg.y);
|
||||
if (IntersectRect(&rcLimit, &rcLimit, &rcClip) &&
|
||||
(!lprcEnumMonitorsThatIntersect ||
|
||||
IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect))) {
|
||||
|
||||
break;
|
||||
}
|
||||
//fall thru
|
||||
case NULLREGION:
|
||||
return TRUE;
|
||||
case ERROR:
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if ( lprcEnumMonitorsThatIntersect &&
|
||||
!IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect)) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return lpfnEnumProc(
|
||||
xPRIMARY_MONITOR,
|
||||
hdcOptionalForPainting,
|
||||
&rcLimit,
|
||||
dwData);
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
xEnumDisplayDevices(
|
||||
PVOID Unused,
|
||||
DWORD iDevNum,
|
||||
__inout PDISPLAY_DEVICE lpDisplayDevice,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
if (InitMultipleMonitorStubs())
|
||||
return g_pfnEnumDisplayDevices(Unused, iDevNum, lpDisplayDevice, dwFlags);
|
||||
|
||||
if (Unused != NULL)
|
||||
return FALSE;
|
||||
|
||||
if (iDevNum != 0)
|
||||
return FALSE;
|
||||
|
||||
if (lpDisplayDevice == NULL || lpDisplayDevice->cb < sizeof(DISPLAY_DEVICE))
|
||||
return FALSE;
|
||||
|
||||
#ifdef UNICODE
|
||||
MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceName, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR)));
|
||||
MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceString, (sizeof(lpDisplayDevice->DeviceString)/sizeof(TCHAR)));
|
||||
#else // UNICODE
|
||||
#if _MULTIMON_USE_SECURE_CRT
|
||||
strncpy_s((LPTSTR)lpDisplayDevice->DeviceName, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR)), TEXT("DISPLAY"), (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR)) - 1);
|
||||
strncpy_s((LPTSTR)lpDisplayDevice->DeviceString, (sizeof(lpDisplayDevice->DeviceString)/sizeof(TCHAR)), TEXT("DISPLAY"), (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR)) - 1);
|
||||
#else
|
||||
lstrcpyn((LPTSTR)lpDisplayDevice->DeviceName, TEXT("DISPLAY"), (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR)));
|
||||
lstrcpyn((LPTSTR)lpDisplayDevice->DeviceString, TEXT("DISPLAY"), (sizeof(lpDisplayDevice->DeviceString)/sizeof(TCHAR)));
|
||||
#endif // _MULTIMON_USE_SECURE_CRT
|
||||
#endif // UNICODE
|
||||
|
||||
lpDisplayDevice->StateFlags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef xPRIMARY_MONITOR
|
||||
#undef COMPILE_MULTIMON_STUBS
|
||||
|
||||
#else // COMPILE_MULTIMON_STUBS
|
||||
|
||||
extern int WINAPI xGetSystemMetrics(int);
|
||||
extern HMONITOR WINAPI xMonitorFromWindow(HWND, DWORD);
|
||||
extern HMONITOR WINAPI xMonitorFromRect(LPCRECT, DWORD);
|
||||
extern HMONITOR WINAPI xMonitorFromPoint(POINT, DWORD);
|
||||
extern BOOL WINAPI xGetMonitorInfo(HMONITOR, LPMONITORINFO);
|
||||
extern BOOL WINAPI xEnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
|
||||
extern BOOL WINAPI xEnumDisplayDevices(PVOID, DWORD, PDISPLAY_DEVICE, DWORD);
|
||||
|
||||
#endif // COMPILE_MULTIMON_STUBS
|
||||
|
||||
//
|
||||
// build defines that replace the regular APIs with our versions
|
||||
//
|
||||
#define GetSystemMetrics xGetSystemMetrics
|
||||
#define MonitorFromWindow xMonitorFromWindow
|
||||
#define MonitorFromRect xMonitorFromRect
|
||||
#define MonitorFromPoint xMonitorFromPoint
|
||||
#define GetMonitorInfo xGetMonitorInfo
|
||||
#define EnumDisplayMonitors xEnumDisplayMonitors
|
||||
#define EnumDisplayDevices xEnumDisplayDevices
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX)
|
||||
#include <alloca.h>
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+1
-1
@@ -46,5 +46,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${JASPER_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(${JASPER_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
Vendored
+1
-1
@@ -39,5 +39,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
Vendored
+1
-1
@@ -55,5 +55,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
Vendored
+1
-1
@@ -115,5 +115,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
+2
-10
@@ -54,7 +54,7 @@
|
||||
|
||||
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
||||
(Intel) */
|
||||
#define HOST_BIGENDIAN 0
|
||||
#define HOST_BIGENDIAN @WORDS_BIGENDIAN@
|
||||
|
||||
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
|
||||
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
||||
@@ -156,15 +156,7 @@
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
#cmakedefine WORDS_BIGENDIAN 1
|
||||
|
||||
/* Support Deflate compression */
|
||||
#define ZIP_SUPPORT 1
|
||||
|
||||
Vendored
+1
-1
@@ -62,7 +62,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
set(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATHS} PARENT_SCOPE)
|
||||
|
||||
Vendored
+3
-3
@@ -248,9 +248,9 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
ocv_install_target(tbb EXPORT OpenCVModules
|
||||
RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT main
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
|
||||
ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main
|
||||
RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs
|
||||
ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev
|
||||
)
|
||||
|
||||
# get TBB version
|
||||
|
||||
Vendored
+1
-1
@@ -95,5 +95,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${ZLIB_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
||||
ocv_install_target(${ZLIB_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
+115
-8
@@ -128,6 +128,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_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) )
|
||||
@@ -141,7 +142,7 @@ OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF
|
||||
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
|
||||
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) )
|
||||
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_PNG "Include PNG support" ON)
|
||||
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
@@ -163,7 +164,7 @@ OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
|
||||
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
|
||||
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 )
|
||||
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
@@ -197,13 +198,15 @@ OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
|
||||
OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
|
||||
OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
|
||||
OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT IOS AND BUILD_SHARED_LIBS) )
|
||||
|
||||
OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF)
|
||||
|
||||
# OpenCV build options
|
||||
# ===================================================
|
||||
OCV_OPTION(ENABLE_DYNAMIC_CUDA "Enabled dynamic CUDA linkage" ON IF ANDROID )
|
||||
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
|
||||
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
|
||||
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
|
||||
OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CMAKE_COMPILER_IS_GNUCXX )
|
||||
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX) )
|
||||
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
|
||||
OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
|
||||
@@ -214,9 +217,12 @@ OCV_OPTION(ENABLE_SSSE3 "Enable SSSE3 instructions"
|
||||
OCV_OPTION(ENABLE_SSE41 "Enable SSE4.1 instructions" OFF IF ((CV_ICC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
|
||||
OCV_OPTION(ENABLE_SSE42 "Enable SSE4.2 instructions" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
|
||||
OCV_OPTION(ENABLE_AVX "Enable AVX instructions" OFF IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
|
||||
OCV_OPTION(ENABLE_NEON "Enable NEON instructions" OFF IF CMAKE_COMPILER_IS_GNUCXX AND ARM )
|
||||
OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF CMAKE_COMPILER_IS_GNUCXX AND ARM )
|
||||
OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
|
||||
OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
|
||||
OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 )
|
||||
OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 )
|
||||
|
||||
# uncategorized options
|
||||
# ===================================================
|
||||
@@ -240,6 +246,15 @@ include(cmake/OpenCVVersion.cmake)
|
||||
# Save libs and executables in the same place
|
||||
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications" )
|
||||
|
||||
if (ANDROID)
|
||||
if (ANDROID_ABI MATCHES "NEON")
|
||||
set(ENABLE_NEON ON)
|
||||
endif()
|
||||
if (ANDROID_ABI MATCHES "VFPV3")
|
||||
set(ENABLE_VFPV3 ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID OR WIN32)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
elseif(INSTALL_TO_MANGLED_PATHS)
|
||||
@@ -255,13 +270,27 @@ if(WIN32)
|
||||
message(STATUS "Can't detect runtime and/or arch")
|
||||
set(OpenCV_INSTALL_BINARIES_PREFIX "")
|
||||
endif()
|
||||
elseif(ANDROID)
|
||||
set(OpenCV_INSTALL_BINARIES_PREFIX "sdk/native/")
|
||||
else()
|
||||
set(OpenCV_INSTALL_BINARIES_PREFIX "")
|
||||
endif()
|
||||
|
||||
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples")
|
||||
if(ANDROID)
|
||||
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${ANDROID_NDK_ABI_NAME}")
|
||||
else()
|
||||
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples")
|
||||
endif()
|
||||
|
||||
set(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin")
|
||||
if(ANDROID)
|
||||
set(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${ANDROID_NDK_ABI_NAME}")
|
||||
else()
|
||||
set(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin")
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_TEST_INSTALL_PATH)
|
||||
set(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
|
||||
@@ -270,6 +299,7 @@ if(ANDROID)
|
||||
set(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
|
||||
set(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni)
|
||||
set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
|
||||
set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
|
||||
else()
|
||||
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
|
||||
set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
|
||||
@@ -280,9 +310,11 @@ else()
|
||||
set(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}lib${LIB_SUFFIX}")
|
||||
endif()
|
||||
set(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
|
||||
set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
|
||||
else()
|
||||
set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX})
|
||||
set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
|
||||
set(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
|
||||
endif()
|
||||
set(OPENCV_INCLUDE_INSTALL_PATH "include")
|
||||
|
||||
@@ -413,6 +445,19 @@ endif()
|
||||
include(cmake/OpenCVPCHSupport.cmake)
|
||||
include(cmake/OpenCVModule.cmake)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect endianness of build platform
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||
# test_big_endian needs try_compile, which doesn't work for iOS
|
||||
# http://public.kitware.com/Bug/view.php?id=12288
|
||||
set(WORDS_BIGENDIAN 0)
|
||||
else()
|
||||
include(TestBigEndian)
|
||||
test_big_endian(WORDS_BIGENDIAN)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect 3rd-party libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -422,7 +467,6 @@ include(cmake/OpenCVFindLibsGUI.cmake)
|
||||
include(cmake/OpenCVFindLibsVideo.cmake)
|
||||
include(cmake/OpenCVFindLibsPerf.cmake)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect other 3rd-party libraries/tools
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -458,10 +502,17 @@ if(WITH_OPENCL)
|
||||
include(cmake/OpenCVDetectOpenCL.cmake)
|
||||
endif()
|
||||
|
||||
# --- VTK support ---
|
||||
include(cmake/OpenCVDetectVTK.cmake)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Add CUDA libraries (needed for apps/tools, samples)
|
||||
# ----------------------------------------------------------------------------
|
||||
if(HAVE_CUDA)
|
||||
if(NOT HAVE_CUDA)
|
||||
set(ENABLE_DYNAMIC_CUDA OFF)
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
if(HAVE_CUBLAS)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cublas_LIBRARY})
|
||||
@@ -470,6 +521,7 @@ if(HAVE_CUDA)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Solution folders:
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -540,6 +592,49 @@ include(cmake/OpenCVGenConfig.cmake)
|
||||
# Generate Info.plist for the IOS framework
|
||||
include(cmake/OpenCVGenInfoPlist.cmake)
|
||||
|
||||
# Generate environment setup file
|
||||
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX)
|
||||
if(ANDROID)
|
||||
get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests)
|
||||
else()
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
|
||||
DESTINATION /etc/profile.d/ COMPONENT tests)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_README_FILE)
|
||||
if(ANDROID)
|
||||
set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_LICENSE_FILE)
|
||||
set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
|
||||
endif()
|
||||
|
||||
# for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
|
||||
if(ANDROID OR NOT UNIX)
|
||||
install(FILES ${OPENCV_LICENSE_FILE}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs)
|
||||
if(OPENCV_README_FILE)
|
||||
install(FILES ${OPENCV_README_FILE}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Summary:
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -649,7 +744,7 @@ endif()
|
||||
if(WIN32)
|
||||
status("")
|
||||
status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO)
|
||||
if (ENABLE_WINRT_MODE)
|
||||
if (ENABLE_WINRT_MODE OR ENABLE_WINRT_MODE_NATIVE)
|
||||
status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH})
|
||||
status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH})
|
||||
endif()
|
||||
@@ -687,6 +782,7 @@ else()
|
||||
endif()
|
||||
|
||||
status(" OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE NO)
|
||||
status(" VTK support:" HAVE_VTK THEN "YES (ver ${VTK_VERSION})" ELSE NO)
|
||||
|
||||
# ========================== MEDIA IO ==========================
|
||||
status("")
|
||||
@@ -829,6 +925,11 @@ if(DEFINED WITH_XINE)
|
||||
status(" Xine:" HAVE_XINE THEN "YES (ver ${ALIASOF_libxine_VERSION})" ELSE NO)
|
||||
endif(DEFINED WITH_XINE)
|
||||
|
||||
if(DEFINED WITH_INTELPERC)
|
||||
status(" Intel PerC:" HAVE_INTELPERC THEN "YES" ELSE NO)
|
||||
endif(DEFINED WITH_INTELPERC)
|
||||
|
||||
|
||||
# ========================== Other third-party libraries ==========================
|
||||
status("")
|
||||
status(" Other third-party libraries:")
|
||||
@@ -952,3 +1053,9 @@ ocv_finalize_status()
|
||||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CPack stuff
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
include(cmake/OpenCVPackaging.cmake)
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
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.
|
||||
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) 2008-2011, Willow Garage Inc., all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
(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:
|
||||
@@ -22,13 +17,14 @@ are permitted provided that the following conditions are met:
|
||||
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.
|
||||
* 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 the Intel Corporation or contributors be liable for any direct,
|
||||
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
|
||||
@@ -1,5 +1,7 @@
|
||||
### OpenCV: Open Source Computer Vision Library
|
||||
|
||||
[](https://www.gittip.com/OpenCV/)
|
||||
|
||||
#### Resources
|
||||
|
||||
* Homepage: <http://opencv.org>
|
||||
@@ -18,6 +20,3 @@ Summary of guidelines:
|
||||
* Include tests and documentation;
|
||||
* Clean up "oops" commits before submitting;
|
||||
* Follow the coding style guide.
|
||||
|
||||
[](https://www.gittip.com/OpenCV/)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?item_name=Donation+to+OpenCV&cmd=_donations&business=accountant%40opencv.org)
|
||||
@@ -71,14 +71,14 @@ set_target_properties(opencv_performance PROPERTIES
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS opencv_haartraining RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT main)
|
||||
install(TARGETS opencv_createsamples RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT main)
|
||||
install(TARGETS opencv_performance RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT main)
|
||||
install(TARGETS opencv_haartraining RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
|
||||
install(TARGETS opencv_createsamples RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
|
||||
install(TARGETS opencv_performance RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS opencv_haartraining RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT main)
|
||||
install(TARGETS opencv_createsamples RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT main)
|
||||
install(TARGETS opencv_performance RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT main)
|
||||
install(TARGETS opencv_haartraining RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
install(TARGETS opencv_createsamples RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
install(TARGETS opencv_performance RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
|
||||
@@ -338,7 +338,7 @@ typedef enum CvBoostType
|
||||
CV_LKCLASS = 5, /* classification (K class problem) */
|
||||
CV_LSREG = 6, /* least squares regression */
|
||||
CV_LADREG = 7, /* least absolute deviation regression */
|
||||
CV_MREG = 8, /* M-regression (Huber loss) */
|
||||
CV_MREG = 8 /* M-regression (Huber loss) */
|
||||
} CvBoostType;
|
||||
|
||||
/****************************************************************************************\
|
||||
|
||||
@@ -35,8 +35,8 @@ endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT main)
|
||||
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 main)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
|
||||
@@ -70,7 +70,7 @@ bool CvCascadeImageReader::NegReader::nextImg()
|
||||
_offset.x = std::min( (int)round % winSize.width, src.cols - winSize.width );
|
||||
_offset.y = std::min( (int)round / winSize.width, src.rows - winSize.height );
|
||||
if( !src.empty() && src.type() == CV_8UC1
|
||||
&& offset.x >= 0 && offset.y >= 0 )
|
||||
&& _offset.x >= 0 && _offset.y >= 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ set(HAVE_WINRT FALSE)
|
||||
# search Windows Platform SDK
|
||||
message(STATUS "Checking for Windows Platform SDK")
|
||||
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
|
||||
if (WINDOWS_SDK_PATH STREQUAL "")
|
||||
if(WINDOWS_SDK_PATH STREQUAL "")
|
||||
set(HAVE_MSPDK FALSE)
|
||||
message(STATUS "Windows Platform SDK 8.0 was not found")
|
||||
else()
|
||||
@@ -19,7 +19,7 @@ endif()
|
||||
#search for Visual Studio 11.0 install directory
|
||||
message(STATUS "Checking for Visual Studio 2012")
|
||||
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE)
|
||||
if (VISUAL_STUDIO_PATH STREQUAL "")
|
||||
if(VISUAL_STUDIO_PATH STREQUAL "")
|
||||
set(HAVE_MSVC2012 FALSE)
|
||||
message(STATUS "Visual Studio 2012 was not found")
|
||||
else()
|
||||
@@ -30,11 +30,15 @@ try_compile(HAVE_WINRT_SDK
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp")
|
||||
|
||||
if (ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK)
|
||||
if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK)
|
||||
set(HAVE_WINRT TRUE)
|
||||
set(HAVE_WINRT_CX TRUE)
|
||||
elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK)
|
||||
set(HAVE_WINRT TRUE)
|
||||
set(HAVE_WINRT_CX FALSE)
|
||||
endif()
|
||||
|
||||
if (HAVE_WINRT)
|
||||
if(HAVE_WINRT)
|
||||
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer")
|
||||
|
||||
@@ -130,6 +130,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(ENABLE_SSE2)
|
||||
add_extra_compiler_option(-msse2)
|
||||
endif()
|
||||
if (ENABLE_NEON)
|
||||
add_extra_compiler_option("-mfpu=neon")
|
||||
endif()
|
||||
if (ENABLE_VFPV3 AND NOT ENABLE_NEON)
|
||||
add_extra_compiler_option("-mfpu=vfpv3")
|
||||
endif()
|
||||
|
||||
# SSE3 and further should be disabled under MingW because it generates compiler errors
|
||||
if(NOT MINGW)
|
||||
@@ -181,6 +187,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_extra_compiler_option(-ffunction-sections)
|
||||
endif()
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage")
|
||||
endif()
|
||||
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
|
||||
endif()
|
||||
|
||||
@@ -180,7 +180,7 @@ unset(__android_project_chain CACHE)
|
||||
# add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11)
|
||||
macro(add_android_project target path)
|
||||
# parse arguments
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA IGNORE_MANIFEST)
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA IGNORE_MANIFEST EMBED_CUDA FORCE_EMBED_OPENCV)
|
||||
set(__varname "android_proj_")
|
||||
foreach(v ${android_proj_arglist})
|
||||
set(${__varname}${v} "")
|
||||
@@ -303,6 +303,46 @@ macro(add_android_project target path)
|
||||
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# copy opencv_java, tbb if it is shared and dynamicuda if present if FORCE_EMBED_OPENCV flag is set
|
||||
if(android_proj_FORCE_EMBED_OPENCV)
|
||||
set(native_deps ${android_proj_NATIVE_DEPS})
|
||||
# filter out gpu module as it is always static library on Android
|
||||
list(REMOVE_ITEM native_deps "opencv_gpu")
|
||||
if(ENABLE_DYNAMIC_CUDA)
|
||||
list(APPEND native_deps "opencv_dynamicuda")
|
||||
endif()
|
||||
foreach(lib ${native_deps})
|
||||
get_property(f TARGET ${lib} PROPERTY LOCATION)
|
||||
get_filename_component(f_name ${f} NAME)
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f_name}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${f}" "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f_name}"
|
||||
DEPENDS "${lib}" VERBATIM
|
||||
COMMENT "Embedding ${f}")
|
||||
list(APPEND android_proj_file_deps "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f_name}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# copy all needed CUDA libs to project if EMBED_CUDA flag is present
|
||||
if(android_proj_EMBED_CUDA)
|
||||
set(android_proj_culibs ${CUDA_npp_LIBRARY_ABS} ${CUDA_LIBRARIES_ABS})
|
||||
if(HAVE_CUFFT)
|
||||
list(INSERT android_proj_culibs 0 ${CUDA_cufft_LIBRARY_ABS})
|
||||
endif()
|
||||
if(HAVE_CUBLAS)
|
||||
list(INSERT android_proj_culibs 0 ${CUDA_cublas_LIBRARY_ABS})
|
||||
endif()
|
||||
foreach(lib ${android_proj_culibs})
|
||||
get_filename_component(f "${lib}" NAME)
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${lib}" "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f}"
|
||||
DEPENDS "${lib}" VERBATIM
|
||||
COMMENT "Embedding ${f}")
|
||||
list(APPEND android_proj_file_deps "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${f}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# build java part
|
||||
@@ -344,20 +384,20 @@ macro(add_android_project target path)
|
||||
add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${android_proj_bin_dir}/bin/${target}-debug.apk" "${OpenCV_BINARY_DIR}/bin/${target}.apk")
|
||||
if(INSTALL_ANDROID_EXAMPLES AND "${target}" MATCHES "^example-")
|
||||
#apk
|
||||
install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT main)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT samples)
|
||||
get_filename_component(sample_dir "${path}" NAME)
|
||||
#java part
|
||||
list(REMOVE_ITEM android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main)
|
||||
install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT samples)
|
||||
endforeach()
|
||||
#jni part + eclipse files
|
||||
file(GLOB_RECURSE jni_files RELATIVE "${path}" "${path}/jni/*" "${path}/.cproject")
|
||||
ocv_list_filterout(jni_files "\\\\.svn")
|
||||
foreach(f ${jni_files} ".classpath" ".project" ".settings/org.eclipse.jdt.core.prefs")
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${path}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main)
|
||||
install(FILES "${path}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT samples)
|
||||
endforeach()
|
||||
#update proj
|
||||
if(android_proj_lib_deps_commands)
|
||||
@@ -365,9 +405,9 @@ macro(add_android_project target path)
|
||||
endif()
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt}
|
||||
WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\"
|
||||
)" COMPONENT main)
|
||||
)" COMPONENT samples)
|
||||
#empty 'gen'
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT main)
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT samples)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -180,6 +180,9 @@ if(CUDA_FOUND)
|
||||
# we remove -Wsign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wno-sign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wno-sign-promo" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler
|
||||
# but NVCC uses C compiler by default
|
||||
string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}")
|
||||
@@ -216,3 +219,42 @@ else()
|
||||
unset(CUDA_ARCH_BIN CACHE)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
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})
|
||||
set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY})
|
||||
ocv_convert_to_lib_name(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})
|
||||
endif()
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
@@ -81,24 +81,39 @@ if(PYTHON_EXECUTABLE)
|
||||
SET(PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages.")
|
||||
|
||||
if(NOT PYTHON_NUMPY_INCLUDE_DIR)
|
||||
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
|
||||
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
|
||||
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
message(STATUS "Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)")
|
||||
message(STATUS "If you want to enable Python/Numpy support, set the following variables:")
|
||||
message(STATUS " PYTHON_INCLUDE_PATH")
|
||||
message(STATUS " PYTHON_LIBRARIES")
|
||||
message(STATUS " PYTHON_NUMPY_INCLUDE_DIR")
|
||||
else()
|
||||
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
|
||||
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
|
||||
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(PYTHON_NUMPY_PROCESS EQUAL 0)
|
||||
file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" _PYTHON_NUMPY_INCLUDE_DIR)
|
||||
set(PYTHON_NUMPY_INCLUDE_DIR ${_PYTHON_NUMPY_INCLUDE_DIR} CACHE PATH "Path to numpy headers")
|
||||
if(NOT PYTHON_NUMPY_PROCESS EQUAL 0)
|
||||
unset(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PYTHON_NUMPY_INCLUDE_DIR)
|
||||
file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" _PYTHON_NUMPY_INCLUDE_DIR)
|
||||
set(PYTHON_NUMPY_INCLUDE_DIR ${_PYTHON_NUMPY_INCLUDE_DIR} CACHE PATH "Path to numpy headers")
|
||||
set(PYTHON_USE_NUMPY TRUE)
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.version.version"
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(NOT PYTHON_NUMPY_VERSION)
|
||||
set(PYTHON_NUMPY_VERSION "undefined - cannot be probed because of the cross-compilation")
|
||||
endif()
|
||||
else()
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.version.version"
|
||||
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
|
||||
OUTPUT_VARIABLE PYTHON_NUMPY_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
endif()
|
||||
endif(NOT ANDROID AND NOT IOS)
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
if(NOT WITH_VTK OR ANDROID OR IOS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# VTK 6.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
|
||||
# VTK 5.x components
|
||||
if(NOT VTK_FOUND)
|
||||
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE)
|
||||
endif()
|
||||
|
||||
if(NOT VTK_FOUND)
|
||||
set(HAVE_VTK OFF)
|
||||
message(STATUS "VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Don't support ealier VTKs
|
||||
if(${VTK_VERSION} VERSION_LESS "5.8.0")
|
||||
message(STATUS "VTK support is disabled. VTK ver. 5.8.0 is minimum required, but found VTK ver. ${VTK_VERSION}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_LESS "6.0.0")
|
||||
if(VTK_USE_QT)
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
||||
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(HAVE_VTK ON)
|
||||
message(STATUS "Found VTK ver. ${VTK_VERSION} (usefile: ${VTK_USE_FILE})")
|
||||
@@ -4,7 +4,7 @@
|
||||
CONFIGURE_FILE(
|
||||
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
@ONLY)
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
|
||||
@@ -163,9 +163,16 @@ function(set_ipp_new_libraries _LATEST_VERSION)
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
PARENT_SCOPE)
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
|
||||
|
||||
if (UNIX)
|
||||
set(IPP_LIBRARIES
|
||||
${IPP_LIBRARIES}
|
||||
${IPP_LIB_PREFIX}irc${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${IPP_LIB_PREFIX}imf${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
return()
|
||||
|
||||
endfunction()
|
||||
@@ -208,19 +215,39 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
|
||||
|
||||
if (APPLE)
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE)
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib)
|
||||
elseif (IPP_X64)
|
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64)
|
||||
message(SEND_ERROR "IPP EM64T libraries not found")
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE)
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64)
|
||||
else()
|
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32)
|
||||
message(SEND_ERROR "IPP IA32 libraries not found")
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE)
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH)
|
||||
if (IPP_X64)
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||
message(SEND_ERROR "Intel compiler EM64T libraries not found")
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIRS
|
||||
${IPP_LIBRARY_DIRS}
|
||||
${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||
else()
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||
message(SEND_ERROR "Intel compiler IA32 libraries not found")
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIRS
|
||||
${IPP_LIBRARY_DIRS}
|
||||
${INTEL_COMPILER_LIBRARY_DIR}/ia32)
|
||||
endif()
|
||||
endif()
|
||||
set(IPP_LIBRARY_DIRS ${IPP_LIBRARY_DIRS} PARENT_SCOPE)
|
||||
|
||||
# set IPP_LIBRARIES variable (7.x or 8.x lib names)
|
||||
set_ipp_new_libraries(${_LATEST_VERSION})
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Main variables:
|
||||
# INTELPERC_LIBRARIES and INTELPERC_INCLUDE to link Intel Perceptial Computing SDK modules
|
||||
# HAVE_INTELPERC for conditional compilation OpenCV with/without Intel Perceptial Computing SDK
|
||||
|
||||
if(X86_64)
|
||||
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
|
||||
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/x64" DOC "Path to Intel Perceptual Computing SDK interface libraries")
|
||||
else()
|
||||
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
|
||||
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/Win32" DOC "Path to Intel Perceptual Computing SDK interface libraries")
|
||||
endif()
|
||||
|
||||
if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
|
||||
set(HAVE_INTELPERC TRUE)
|
||||
else()
|
||||
set(HAVE_INTELPERC FALSE)
|
||||
message(WARNING "Intel Perceptual Computing SDK library directory (set by INTELPERC_LIB_DIR variable) is not found or does not have Intel Perceptual Computing SDK libraries.")
|
||||
endif() #if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
|
||||
|
||||
mark_as_advanced(FORCE INTELPERC_LIBRARIES INTELPERC_INCLUDE_DIR)
|
||||
@@ -250,3 +250,8 @@ if (NOT IOS)
|
||||
set(HAVE_QTKIT YES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- Intel Perceptual Computing SDK ---
|
||||
if(WITH_INTELPERC)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIntelPerCSDK.cmake")
|
||||
endif(WITH_INTELPERC)
|
||||
|
||||
@@ -44,6 +44,7 @@ if(ANDROID)
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
set(OPENCV_MODULES_CONFIGMAKE "")
|
||||
set(OPENCV_HAVE_GPU_MODULE_CONFIGMAKE "off")
|
||||
set(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "")
|
||||
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "")
|
||||
foreach(m ${OPENCV_MODULES_PUBLIC})
|
||||
@@ -53,6 +54,32 @@ if(ANDROID)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# remove CUDA runtime and NPP from regular deps
|
||||
# it can be added separately if needed.
|
||||
ocv_list_filterout(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "cusparse")
|
||||
ocv_list_filterout(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "cufft")
|
||||
ocv_list_filterout(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "cublas")
|
||||
ocv_list_filterout(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "npp")
|
||||
ocv_list_filterout(OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "cudart")
|
||||
|
||||
if(HAVE_CUDA)
|
||||
# CUDA runtime libraries and are required always
|
||||
set(culibs ${CUDA_LIBRARIES})
|
||||
|
||||
# right now NPP is requared always too
|
||||
list(INSERT culibs 0 ${CUDA_npp_LIBRARY})
|
||||
|
||||
if(HAVE_CUFFT)
|
||||
list(INSERT culibs 0 ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HAVE_CUBLAS)
|
||||
list(INSERT culibs 0 ${CUDA_cublas_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ocv_convert_to_lib_name(CUDA_RUNTIME_LIBS_CONFIGMAKE ${culibs})
|
||||
|
||||
# split 3rdparty libs and modules
|
||||
foreach(mod ${OPENCV_MODULES_CONFIGMAKE})
|
||||
if(NOT mod MATCHES "^opencv_.+$")
|
||||
@@ -63,6 +90,18 @@ if(ANDROID)
|
||||
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
|
||||
endif()
|
||||
|
||||
if(ENABLE_DYNAMIC_CUDA)
|
||||
set(OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE "dynamicuda")
|
||||
endif()
|
||||
|
||||
# GPU module enabled separately
|
||||
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE "opencv_gpu")
|
||||
list(REMOVE_ITEM OPENCV_MODULES_CONFIGMAKE "opencv_dynamicuda")
|
||||
|
||||
if(HAVE_opencv_gpu)
|
||||
set(OPENCV_HAVE_GPU_MODULE_CONFIGMAKE "on")
|
||||
endif()
|
||||
|
||||
# convert CMake lists to makefile literals
|
||||
foreach(lst OPENCV_MODULES_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE)
|
||||
ocv_list_unique(${lst})
|
||||
@@ -70,6 +109,7 @@ if(ANDROID)
|
||||
string(REPLACE ";" " " ${lst} "${${lst}}")
|
||||
endforeach()
|
||||
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
string(REPLACE ";" " " CUDA_RUNTIME_LIBS_CONFIGMAKE "${CUDA_RUNTIME_LIBS_CONFIGMAKE}")
|
||||
|
||||
# prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
|
||||
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
|
||||
@@ -91,7 +131,7 @@ if(ANDROID)
|
||||
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/lib/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" @ONLY)
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
|
||||
@@ -101,6 +141,6 @@ if(ANDROID)
|
||||
set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../libs/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(OPENCV_TARGET_ARCH_ABI)")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH})
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev)
|
||||
endif(ANDROID)
|
||||
|
||||
+19
-19
@@ -83,9 +83,9 @@ endif()
|
||||
|
||||
export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules${modules_file_suffix}.cmake")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" @ONLY)
|
||||
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work.
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" @ONLY)
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
|
||||
@@ -98,8 +98,8 @@ if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE}\"")
|
||||
endif()
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" @ONLY)
|
||||
|
||||
if(UNIX) # ANDROID configuration is created here also
|
||||
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference
|
||||
@@ -109,18 +109,18 @@ if(UNIX) # ANDROID configuration is created here also
|
||||
# <prefix>/(share|lib)/<name>*/ (U)
|
||||
# <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/)
|
||||
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ COMPONENT dev)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
else()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
|
||||
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev)
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
@@ -131,15 +131,15 @@ if(WIN32)
|
||||
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
|
||||
|
||||
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" @ONLY)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
else()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" COMPONENT dev)
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
|
||||
endif()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/")
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT dev)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/" COMPONENT dev)
|
||||
endif()
|
||||
|
||||
@@ -23,4 +23,4 @@ set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE
|
||||
#endforeach()
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")
|
||||
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT main)
|
||||
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev)
|
||||
|
||||
@@ -78,8 +78,8 @@ else()
|
||||
endif()
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}"
|
||||
@ONLY IMMEDIATE)
|
||||
@ONLY)
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig COMPONENT dev)
|
||||
endif()
|
||||
|
||||
+58
-28
@@ -27,7 +27,8 @@
|
||||
# The verbose template for OpenCV module:
|
||||
#
|
||||
# ocv_add_module(modname <dependencies>)
|
||||
# ocv_glob_module_sources() or glob them manually and ocv_set_module_sources(...)
|
||||
# ocv_glob_module_sources(([EXCLUDE_CUDA] <extra sources&headers>)
|
||||
# or glob them manually and ocv_set_module_sources(...)
|
||||
# ocv_module_include_directories(<extra include directories>)
|
||||
# ocv_create_module()
|
||||
# <add extra link dependencies, compiler options, etc>
|
||||
@@ -135,13 +136,13 @@ macro(ocv_add_module _name)
|
||||
|
||||
# parse list of dependencies
|
||||
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The category of the module")
|
||||
set(__ocv_argn__ ${ARGN})
|
||||
list(REMOVE_AT __ocv_argn__ 0)
|
||||
ocv_add_dependencies(${the_module} ${__ocv_argn__})
|
||||
unset(__ocv_argn__)
|
||||
else()
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The cathegory of the module")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The category of the module")
|
||||
ocv_add_dependencies(${the_module} ${ARGN})
|
||||
if(BUILD_${the_module})
|
||||
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export")
|
||||
@@ -478,22 +479,38 @@ endmacro()
|
||||
|
||||
# finds and sets headers and sources for the standard OpenCV module
|
||||
# Usage:
|
||||
# ocv_glob_module_sources(<extra sources&headers in the same format as used in ocv_set_module_sources>)
|
||||
# ocv_glob_module_sources([EXCLUDE_CUDA] <extra sources&headers in the same format as used in ocv_set_module_sources>)
|
||||
macro(ocv_glob_module_sources)
|
||||
set(_argn ${ARGN})
|
||||
list(FIND _argn "EXCLUDE_CUDA" exclude_cuda)
|
||||
if(NOT exclude_cuda EQUAL -1)
|
||||
list(REMOVE_AT _argn ${exclude_cuda})
|
||||
endif()
|
||||
|
||||
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_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
||||
if (APPLE)
|
||||
list(APPEND lib_srcs ${lib_srcs_apple})
|
||||
endif()
|
||||
|
||||
file(GLOB lib_cuda_srcs "src/cuda/*.cu")
|
||||
set(cuda_objs "")
|
||||
set(lib_cuda_hdrs "")
|
||||
if(HAVE_CUDA AND lib_cuda_srcs)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp")
|
||||
if (exclude_cuda EQUAL -1)
|
||||
file(GLOB lib_cuda_srcs "src/cuda/*.cu")
|
||||
set(cuda_objs "")
|
||||
set(lib_cuda_hdrs "")
|
||||
if(HAVE_CUDA)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp")
|
||||
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
endif()
|
||||
else()
|
||||
set(cuda_objs "")
|
||||
set(lib_cuda_srcs "")
|
||||
set(lib_cuda_hdrs "")
|
||||
endif()
|
||||
|
||||
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
@@ -512,8 +529,8 @@ macro(ocv_glob_module_sources)
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Include\\detail" FILES ${lib_hdrs_detail})
|
||||
|
||||
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail}
|
||||
SOURCES ${lib_srcs} ${lib_int_hdrs} ${cuda_objs} ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
ocv_set_module_sources(${_argn} HEADERS ${lib_hdrs} ${lib_hdrs_detail}
|
||||
SOURCES ${lib_srcs} ${lib_int_hdrs} ${cuda_objs} ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
endmacro()
|
||||
|
||||
# creates OpenCV module in current folder
|
||||
@@ -537,9 +554,6 @@ macro(ocv_create_module)
|
||||
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})
|
||||
if (HAVE_CUDA)
|
||||
target_link_libraries(${the_module} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@@ -580,9 +594,9 @@ macro(ocv_create_module)
|
||||
endif()
|
||||
|
||||
ocv_install_target(${the_module} EXPORT OpenCVModules
|
||||
RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT main
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
|
||||
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
|
||||
RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs
|
||||
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev
|
||||
)
|
||||
|
||||
# only "public" headers need to be installed
|
||||
@@ -590,7 +604,7 @@ macro(ocv_create_module)
|
||||
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
||||
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
|
||||
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
|
||||
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -615,11 +629,20 @@ endmacro()
|
||||
# short command for adding simple OpenCV module
|
||||
# see ocv_add_module for argument details
|
||||
# Usage:
|
||||
# ocv_define_module(module_name [INTERNAL] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
# ocv_define_module(module_name [INTERNAL] [EXCLUDE_CUDA] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
macro(ocv_define_module module_name)
|
||||
ocv_add_module(${module_name} ${ARGN})
|
||||
set(_argn ${ARGN})
|
||||
set(exclude_cuda "")
|
||||
foreach(arg ${_argn})
|
||||
if("${arg}" STREQUAL "EXCLUDE_CUDA")
|
||||
set(exclude_cuda "${arg}")
|
||||
list(REMOVE_ITEM _argn ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
ocv_add_module(${module_name} ${_argn})
|
||||
ocv_module_include_directories()
|
||||
ocv_glob_module_sources()
|
||||
ocv_glob_module_sources(${exclude_cuda})
|
||||
ocv_create_module()
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
@@ -714,6 +737,9 @@ function(ocv_add_perf_tests)
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
endif(OCV_DEPENDENCIES_FOUND)
|
||||
if(INSTALL_TESTS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@@ -744,8 +770,8 @@ function(ocv_add_accuracy_tests)
|
||||
endif()
|
||||
|
||||
get_native_precompiled_header(${the_target} test_precomp.hpp)
|
||||
|
||||
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
|
||||
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
@@ -767,6 +793,10 @@ function(ocv_add_accuracy_tests)
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
endif(OCV_DEPENDENCIES_FOUND)
|
||||
|
||||
if(INSTALL_TESTS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@@ -798,7 +828,7 @@ function(ocv_add_samples)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${module_id}" COMPONENT main)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${module_id}" COMPONENT samples)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -807,8 +837,8 @@ function(ocv_add_samples)
|
||||
if(INSTALL_C_EXAMPLES AND NOT WIN32 AND EXISTS "${samples_path}")
|
||||
file(GLOB sample_files "${samples_path}/*")
|
||||
install(FILES ${sample_files}
|
||||
DESTINATION share/OpenCV/samples/${module_id}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/${module_id}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
set(CPACK_set_DESTDIR "on")
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library")
|
||||
set(CPACK_PACKAGE_DESCRIPTION
|
||||
"OpenCV (Open Source Computer Vision Library) is an open source computer vision
|
||||
and machine learning software library. OpenCV was built to provide a common
|
||||
infrastructure for computer vision applications and to accelerate the use of
|
||||
machine perception in the commercial products. Being a BSD-licensed product,
|
||||
OpenCV makes it easy for businesses to utilize and modify the code.")
|
||||
set(CPACK_PACKAGE_VENDOR "OpenCV Foundation")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_CONTACT "admin@opencv.org")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
#arch
|
||||
if(X86)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "i386")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
|
||||
elseif(X86_64)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "amd64")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
|
||||
elseif(ARM)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "armhf")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
|
||||
else()
|
||||
set(CPACK_DEBIAN_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})
|
||||
elseif(CPACK_GENERATOR STREQUAL "RPM")
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
|
||||
else()
|
||||
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
|
||||
|
||||
#rpm options
|
||||
set(CPACK_RPM_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
|
||||
set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
|
||||
|
||||
#deb options
|
||||
set(CPACK_DEB_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
|
||||
|
||||
#depencencies
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
|
||||
set(CPACK_COMPONENT_samples_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_dev_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_docs_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_java_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_python_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_tests_DEPENDS libs)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
|
||||
set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
|
||||
set(CPACK_COMPONENT_dev_DEPENDS libs)
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
set(CPACK_COMPONENT_libs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}")
|
||||
set(CPACK_COMPONENT_libs_DESCRIPTION "Open Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_python_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-python")
|
||||
set(CPACK_COMPONENT_python_DESCRIPTION "Python bindings for Open Source Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_java_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-java")
|
||||
set(CPACK_COMPONENT_java_DESCRIPTION "Java bindings for Open Source Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_dev_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-dev")
|
||||
set(CPACK_COMPONENT_dev_DESCRIPTION "Development files for Open Source Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_docs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-docs")
|
||||
set(CPACK_COMPONENT_docs_DESCRIPTION "Documentation for Open Source Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_samples_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-samples")
|
||||
set(CPACK_COMPONENT_samples_DESCRIPTION "Samples for Open Source Computer Vision Library")
|
||||
|
||||
set(CPACK_COMPONENT_tests_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-tests")
|
||||
set(CPACK_COMPONENT_tests_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
if(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT)
|
||||
set(CPACK_libs_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_dev_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_docs_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_python_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_java_COMPONENT_INSTALL TRUE)
|
||||
set(CPACK_samples_COMPONENT_INSTALL TRUE)
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT)
|
||||
|
||||
include(CPack)
|
||||
|
||||
ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
|
||||
endmacro()
|
||||
|
||||
|
||||
# convert list of paths to libraries names without lib prefix
|
||||
macro(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}")
|
||||
endforeach()
|
||||
set(${var} ${__tmp})
|
||||
unset(__tmp)
|
||||
unset(__tmp_name)
|
||||
endmacro()
|
||||
|
||||
|
||||
# add install command
|
||||
function(ocv_install_target)
|
||||
install(TARGETS ${ARGN})
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
# you might need to define NDK_USE_CYGPATH=1 before calling the ndk-build
|
||||
|
||||
USER_LOCAL_PATH:=$(LOCAL_PATH)
|
||||
|
||||
USER_LOCAL_C_INCLUDES:=$(LOCAL_C_INCLUDES)
|
||||
USER_LOCAL_CFLAGS:=$(LOCAL_CFLAGS)
|
||||
USER_LOCAL_STATIC_LIBRARIES:=$(LOCAL_STATIC_LIBRARIES)
|
||||
USER_LOCAL_SHARED_LIBRARIES:=$(LOCAL_SHARED_LIBRARIES)
|
||||
USER_LOCAL_LDLIBS:=$(LOCAL_LDLIBS)
|
||||
|
||||
LOCAL_PATH:=$(subst ?,,$(firstword ?$(subst \, ,$(subst /, ,$(call my-dir)))))
|
||||
|
||||
OPENCV_TARGET_ARCH_ABI:=$(TARGET_ARCH_ABI)
|
||||
@@ -13,6 +20,22 @@ OPENCV_BASEDIR:=@OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE@
|
||||
OPENCV_LOCAL_C_INCLUDES:=@OPENCV_INCLUDE_DIRS_CONFIGCMAKE@
|
||||
OPENCV_MODULES:=@OPENCV_MODULES_CONFIGMAKE@
|
||||
|
||||
OPENCV_HAVE_GPU_MODULE:=@OPENCV_HAVE_GPU_MODULE_CONFIGMAKE@
|
||||
OPENCV_USE_GPU_MODULE:=
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
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
|
||||
|
||||
CUDA_RUNTIME_LIBS:=@CUDA_RUNTIME_LIBS_CONFIGMAKE@
|
||||
|
||||
ifeq ($(OPENCV_LIB_TYPE),)
|
||||
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
|
||||
endif
|
||||
@@ -47,7 +70,7 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${OPENCV_CAMERA_MODULES},on)
|
||||
ifeq ($(OPENCV_CAMERA_MODULES),on)
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_CONFIGCMAKE@
|
||||
endif
|
||||
@@ -78,6 +101,13 @@ define add_opencv_module
|
||||
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
|
||||
endef
|
||||
|
||||
define add_cuda_module
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=$1
|
||||
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$1.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
endef
|
||||
|
||||
define add_opencv_3rdparty_component
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=$1
|
||||
@@ -95,6 +125,17 @@ endef
|
||||
ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
|
||||
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
||||
$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
|
||||
ifneq ($(OPENCV_DYNAMICUDA_MODULE),)
|
||||
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
$(eval $(call add_opencv_module,$(OPENCV_DYNAMICUDA_MODULE)))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_USE_GPU_MODULE),on)
|
||||
ifeq ($(INSTALL_CUDA_LIBRARIES),on)
|
||||
$(foreach module,$(CUDA_RUNTIME_LIBS),$(eval $(call add_cuda_module,$(module))))
|
||||
endif
|
||||
endif
|
||||
|
||||
$(foreach module,$(OPENCV_3RDPARTY_COMPONENTS),$(eval $(call add_opencv_3rdparty_component,$(module))))
|
||||
@@ -102,22 +143,51 @@ ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
|
||||
|
||||
ifneq ($(OPENCV_BASEDIR),)
|
||||
OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include)
|
||||
ifeq ($(OPENCV_USE_GPU_MODULE),on)
|
||||
OPENCV_LOCAL_C_INCLUDES += $(OPENCV_BASEDIR)/modules/gpu/include
|
||||
endif
|
||||
endif
|
||||
|
||||
#turn off module installation to prevent their redefinition
|
||||
OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED:=on
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_GPU_ALREADY_INCLUDED),)
|
||||
ifeq ($(OPENCV_USE_GPU_MODULE),on)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE:=opencv_gpu
|
||||
LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libopencv_gpu.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
endif
|
||||
OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_GPU_ALREADY_INCLUDED:=on
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_LOCAL_CFLAGS),)
|
||||
OPENCV_LOCAL_CFLAGS := -fPIC -DANDROID -fsigned-char
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_C_INCLUDES:=$(USER_LOCAL_C_INCLUDES)
|
||||
LOCAL_CFLAGS:=$(USER_LOCAL_CFLAGS)
|
||||
LOCAL_STATIC_LIBRARIES:=$(USER_LOCAL_STATIC_LIBRARIES)
|
||||
LOCAL_SHARED_LIBRARIES:=$(USER_LOCAL_SHARED_LIBRARIES)
|
||||
LOCAL_LDLIBS:=$(USER_LOCAL_LDLIBS)
|
||||
|
||||
LOCAL_C_INCLUDES += $(OPENCV_LOCAL_C_INCLUDES)
|
||||
LOCAL_CFLAGS += $(OPENCV_LOCAL_CFLAGS)
|
||||
|
||||
ifeq ($(OPENCV_USE_GPU_MODULE),on)
|
||||
LOCAL_C_INCLUDES += $(CUDA_TOOLKIT_DIR)/include
|
||||
endif
|
||||
|
||||
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
||||
LOCAL_$(OPENCV_LIB_TYPE)_LIBRARIES += $(foreach mod, $(OPENCV_LIBS), opencv_$(mod))
|
||||
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
ifneq ($(OPENCV_DYNAMICUDA_MODULE),)
|
||||
LOCAL_$(OPENCV_LIB_TYPE)_LIBRARIES += $(OPENCV_DYNAMICUDA_MODULE)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
LOCAL_LDLIBS += -L$(call host-path,$(LOCAL_PATH)/$(OPENCV_LIBS_DIR)) $(foreach lib, $(OPENCV_LIBS), -lopencv_$(lib))
|
||||
endif
|
||||
@@ -128,5 +198,14 @@ endif
|
||||
|
||||
LOCAL_LDLIBS += $(foreach lib,$(OPENCV_EXTRA_COMPONENTS), -l$(lib))
|
||||
|
||||
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))
|
||||
endif
|
||||
LOCAL_STATIC_LIBRARIES+=libopencv_gpu
|
||||
endif
|
||||
|
||||
#restore the LOCAL_PATH
|
||||
LOCAL_PATH:=$(USER_LOCAL_PATH)
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
# This file will define the following variables:
|
||||
# - OpenCV_LIBS : The list of all imported targets for OpenCV modules.
|
||||
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
|
||||
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
|
||||
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability.
|
||||
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
|
||||
# - OpenCV_VERSION : The version of this OpenCV build: "@OPENCV_VERSION@"
|
||||
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
|
||||
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@"
|
||||
@@ -27,22 +27,26 @@
|
||||
# - OpenCV_VERSION_TWEAK : Tweak version part of OpenCV_VERSION: "@OPENCV_VERSION_TWEAK@"
|
||||
#
|
||||
# Advanced variables:
|
||||
# - OpenCV_SHARED
|
||||
# - OpenCV_CONFIG_PATH
|
||||
# - OpenCV_INSTALL_PATH (not set on Windows)
|
||||
# - OpenCV_LIB_COMPONENTS
|
||||
# - OpenCV_USE_MANGLED_PATHS
|
||||
# - OpenCV_HAVE_ANDROID_CAMERA
|
||||
# - OpenCV_SHARED : Use OpenCV as shared library
|
||||
# - OpenCV_CONFIG_PATH : Path to this OpenCVConfig.cmake
|
||||
# - OpenCV_INSTALL_PATH : OpenCV location (not set on Windows)
|
||||
# - OpenCV_LIB_COMPONENTS : Present OpenCV modules list
|
||||
# - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag
|
||||
# - OpenCV_MODULES_SUFFIX : The suffix for OpenCVModules-XXX.cmake file
|
||||
# - OpenCV_HAVE_ANDROID_CAMERA : Presence of Android native camera wrappers
|
||||
#
|
||||
# ===================================================================================
|
||||
|
||||
set(modules_file_suffix "")
|
||||
if(ANDROID)
|
||||
string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}")
|
||||
if(NOT DEFINED OpenCV_MODULES_SUFFIX)
|
||||
if(ANDROID)
|
||||
string(REPLACE - _ OpenCV_MODULES_SUFFIX "_${ANDROID_NDK_ABI_NAME}")
|
||||
else()
|
||||
set(OpenCV_MODULES_SUFFIX "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET opencv_core)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
|
||||
endif()
|
||||
|
||||
# TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)
|
||||
@@ -206,7 +210,7 @@ foreach(__opttype OPT DBG)
|
||||
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
|
||||
|
||||
# CUDA
|
||||
if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
|
||||
if(OpenCV_CUDA_VERSION)
|
||||
if(NOT CUDA_FOUND)
|
||||
find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
|
||||
else()
|
||||
@@ -215,32 +219,41 @@ foreach(__opttype OPT DBG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_LIBRARIES})
|
||||
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
|
||||
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.5")
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_npp_LIBRARY})
|
||||
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_EXTRA_LIBS_${__opttype} ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUBLAS)
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_CUBLAS_LIBRARIES})
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_CUFFT)
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_CUFFT_LIBRARIES})
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(OpenCV_USE_NVCUVID)
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_nvcuvid_LIBRARIES})
|
||||
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_nvcuvenc_LIBRARIES})
|
||||
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()
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@
|
||||
/* Apple ImageIO Framework */
|
||||
#cmakedefine HAVE_IMAGEIO
|
||||
|
||||
/* Intel Perceptual Computing SDK library */
|
||||
#cmakedefine HAVE_INTELPERC
|
||||
|
||||
/* Intel Integrated Performance Primitives */
|
||||
#cmakedefine HAVE_IPP
|
||||
|
||||
@@ -158,6 +161,6 @@
|
||||
/* Xine video library */
|
||||
#cmakedefine HAVE_XINE
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
/* Define if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
BASE_DIR=`dirname $0`
|
||||
OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
|
||||
OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Device architecture is not preset in command line"
|
||||
echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
|
||||
echo "Usage: $0 <target_device_arch>"
|
||||
return 1
|
||||
else
|
||||
TARGET_ARCH=$1
|
||||
fi
|
||||
|
||||
if [ -z `which adb` ]; then
|
||||
echo "adb command was not found in PATH"
|
||||
return 1
|
||||
fi
|
||||
|
||||
adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata
|
||||
|
||||
adb shell "mkdir -p /data/local/tmp/opencv_test"
|
||||
SUMMARY_STATUS=0
|
||||
for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*;
|
||||
do
|
||||
test_name=`basename "$t"`
|
||||
report="$test_name-`date --rfc-3339=date`.xml"
|
||||
adb push $t /data/local/tmp/opencv_test/
|
||||
adb shell "export OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata && /data/local/tmp/opencv_test/$test_name --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:/data/local/tmp/opencv_test/$report"
|
||||
adb pull "/data/local/tmp/opencv_test/$report" $report
|
||||
TEST_STATUS=0
|
||||
if [ -e $report ]; then
|
||||
if [ `grep -c "<fail" $report` -ne 0 ]; then
|
||||
TEST_STATUS=2
|
||||
fi
|
||||
else
|
||||
TEST_STATUS=3
|
||||
fi
|
||||
if [ $TEST_STATUS -ne 0 ]; then
|
||||
SUMMARY_STATUS=$TEST_STATUS
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then
|
||||
echo "All OpenCV tests finished successfully"
|
||||
else
|
||||
echo "OpenCV tests finished with status $SUMMARY_STATUS"
|
||||
fi
|
||||
|
||||
return $SUMMARY_STATUS
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
OPENCV_TEST_PATH=@CMAKE_INSTALL_PREFIX@/@OPENCV_TEST_INSTALL_PATH@
|
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
|
||||
|
||||
SUMMARY_STATUS=0
|
||||
for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*;
|
||||
do
|
||||
report="`basename "$t"`-`date --rfc-3339=date`.xml"
|
||||
"$t" --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:"$report"
|
||||
TEST_STATUS=$?
|
||||
if [ $TEST_STATUS -ne 0 ]; then
|
||||
SUMMARY_STATUS=$TEST_STATUS
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f /tmp/__opencv_temp.*
|
||||
|
||||
if [ $SUMMARY_STATUS -eq 0 ]; then
|
||||
echo "All OpenCV tests finished successfully"
|
||||
else
|
||||
echo "OpenCV tests finished with status $SUMMARY_STATUS"
|
||||
fi
|
||||
|
||||
return $SUMMARY_STATUS
|
||||
@@ -0,0 +1,2 @@
|
||||
# Environment setup for OpenCV testing
|
||||
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
|
||||
+16
-4
@@ -2,9 +2,21 @@ file(GLOB HAAR_CASCADES haarcascades/*.xml)
|
||||
file(GLOB LBP_CASCADES lbpcascades/*.xml)
|
||||
|
||||
if(ANDROID)
|
||||
install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT main)
|
||||
install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT main)
|
||||
install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs)
|
||||
install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs)
|
||||
elseif(NOT WIN32)
|
||||
install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT main)
|
||||
install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT main)
|
||||
install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs)
|
||||
install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs)
|
||||
endif()
|
||||
|
||||
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
|
||||
if(ANDROID)
|
||||
install(DIRECTORY ${OPENCV_TEST_DATA_PATH} DESTINATION sdk/etc/testdata COMPONENT tests)
|
||||
elseif(NOT WIN32)
|
||||
# CPack does not set correct permissions by default, so we do it explicitly.
|
||||
install(DIRECTORY ${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)
|
||||
endif()
|
||||
endif()
|
||||
+2
-2
@@ -143,11 +143,11 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
endif()
|
||||
|
||||
foreach(f ${DOC_LIST})
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT docs)
|
||||
endforeach()
|
||||
|
||||
foreach(f ${OPTIONAL_DOC_LIST})
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL)
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL COMPONENT docs)
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
+49
-47
@@ -44,7 +44,7 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'OpenCV'
|
||||
copyright = u'2011-2013, opencv dev team'
|
||||
copyright = u'2011-2014, opencv dev team'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@@ -293,11 +293,11 @@ extlinks = {
|
||||
'oldbasicstructures' : ('http://docs.opencv.org/modules/core/doc/old_basic_structures.html#%s', None),
|
||||
'readwriteimagevideo' : ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#%s', None),
|
||||
'operationsonarrays' : ('http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#%s', None),
|
||||
'utilitysystemfunctions':('http://docs.opencv.org/modules/core/doc/utility_and_system_functions_and_macros.html#%s', None),
|
||||
'imgprocfilter':('http://docs.opencv.org/modules/imgproc/doc/filtering.html#%s', None),
|
||||
'svms':('http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#%s', None),
|
||||
'drawingfunc':('http://docs.opencv.org/modules/core/doc/drawing_functions.html#%s', None),
|
||||
'xmlymlpers':('http://docs.opencv.org/modules/core/doc/xml_yaml_persistence.html#%s', None),
|
||||
'utilitysystemfunctions' : ('http://docs.opencv.org/modules/core/doc/utility_and_system_functions_and_macros.html#%s', None),
|
||||
'imgprocfilter' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html#%s', None),
|
||||
'svms' : ('http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#%s', None),
|
||||
'drawingfunc' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#%s', None),
|
||||
'xmlymlpers' : ('http://docs.opencv.org/modules/core/doc/xml_yaml_persistence.html#%s', None),
|
||||
'hgvideo' : ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#%s', None),
|
||||
'gpuinit' : ('http://docs.opencv.org/modules/gpu/doc/initalization_and_information.html#%s', None),
|
||||
'gpudatastructure' : ('http://docs.opencv.org/modules/gpu/doc/data_structures.html#%s', None),
|
||||
@@ -305,56 +305,58 @@ extlinks = {
|
||||
'gpuperelement' : ('http://docs.opencv.org/modules/gpu/doc/per_element_operations.html#%s', None),
|
||||
'gpuimgproc' : ('http://docs.opencv.org/modules/gpu/doc/image_processing.html#%s', None),
|
||||
'gpumatrixreduct' : ('http://docs.opencv.org/modules/gpu/doc/matrix_reductions.html#%s', None),
|
||||
'filtering':('http://docs.opencv.org/modules/imgproc/doc/filtering.html#%s', None),
|
||||
'filtering' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html#%s', None),
|
||||
'flann' : ('http://docs.opencv.org/modules/flann/doc/flann_fast_approximate_nearest_neighbor_search.html#%s', None ),
|
||||
'calib3d' : ('http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#%s', None ),
|
||||
'feature2d' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html#%s', None ),
|
||||
'imgproc_geometric' : ('http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#%s', None ),
|
||||
'miscellaneous_transformations' : ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#%s', None),
|
||||
'user_interface' : ('http://docs.opencv.org/modules/highgui/doc/user_interface.html#%s', None),
|
||||
|
||||
# 'opencv_group' : ('http://answers.opencv.org/%s', None),
|
||||
'opencv_qa' : ('http://answers.opencv.org/%s', None),
|
||||
'how_to_contribute' : ('http://code.opencv.org/projects/opencv/wiki/How_to_contribute/%s', None),
|
||||
|
||||
'cvt_color': ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=cvtcolor#cvtcolor%s', None),
|
||||
'imread': ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread%s', None),
|
||||
'imwrite': ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imwrite#imwrite%s', None),
|
||||
'imshow': ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=imshow#imshow%s', None),
|
||||
'named_window': ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=namedwindow#namedwindow%s', None),
|
||||
'wait_key': ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=waitkey#waitkey%s', None),
|
||||
'add_weighted': ('http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=addweighted#addweighted%s', None),
|
||||
'saturate_cast': ('http://docs.opencv.org/modules/core/doc/utility_and_system_functions_and_macros.html?highlight=saturate_cast#saturate-cast%s', None),
|
||||
'mat_zeros': ('http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=zeros#mat-zeros%s', None),
|
||||
'convert_to': ('http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-convertto%s', None),
|
||||
'create_trackbar': ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=createtrackbar#createtrackbar%s', None),
|
||||
'point': ('http://docs.opencv.org/modules/core/doc/basic_structures.html#point%s', None),
|
||||
'scalar': ('http://docs.opencv.org/modules/core/doc/basic_structures.html#scalar%s', None),
|
||||
'line': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#line%s', None),
|
||||
'ellipse': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#ellipse%s', None),
|
||||
'rectangle': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#rectangle%s', None),
|
||||
'circle': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#circle%s', None),
|
||||
'fill_poly': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#fillpoly%s', None),
|
||||
'rng': ('http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=rng#rng%s', None),
|
||||
'put_text': ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#puttext%s', None),
|
||||
'gaussian_blur': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=gaussianblur#gaussianblur%s', None),
|
||||
'blur': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=blur#blur%s', None),
|
||||
'median_blur': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=medianblur#medianblur%s', None),
|
||||
'bilateral_filter': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=bilateralfilter#bilateralfilter%s', None),
|
||||
'erode': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=erode#erode%s', None),
|
||||
'dilate': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=dilate#dilate%s', None),
|
||||
'get_structuring_element': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=getstructuringelement#getstructuringelement%s', None),
|
||||
'flood_fill': ( 'http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=floodfill#floodfill%s', None),
|
||||
'morphology_ex': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=morphologyex#morphologyex%s', None),
|
||||
'pyr_down': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=pyrdown#pyrdown%s', None),
|
||||
'pyr_up': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=pyrup#pyrup%s', None),
|
||||
'resize': ('http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html?highlight=resize#resize%s', None),
|
||||
'threshold': ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#threshold%s', None),
|
||||
'filter2d': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=filter2d#filter2d%s', None),
|
||||
'copy_make_border': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=copymakeborder#copymakeborder%s', None),
|
||||
'sobel': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=sobel#sobel%s', None),
|
||||
'scharr': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=scharr#scharr%s', None),
|
||||
'laplacian': ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=laplacian#laplacian%s', None),
|
||||
'canny': ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=canny#canny%s', None),
|
||||
'copy_to': ('http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=copyto#mat-copyto%s', None),
|
||||
'cvt_color' : ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=cvtcolor#cvtcolor%s', None),
|
||||
'imread' : ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread%s', None),
|
||||
'imwrite' : ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imwrite#imwrite%s', None),
|
||||
'imshow' : ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=imshow#imshow%s', None),
|
||||
'named_window' : ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=namedwindow#namedwindow%s', None),
|
||||
'wait_key' : ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=waitkey#waitkey%s', None),
|
||||
'add_weighted' : ('http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=addweighted#addweighted%s', None),
|
||||
'saturate_cast' : ('http://docs.opencv.org/modules/core/doc/utility_and_system_functions_and_macros.html?highlight=saturate_cast#saturate-cast%s', None),
|
||||
'mat_zeros' : ('http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=zeros#mat-zeros%s', None),
|
||||
'convert_to' : ('http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-convertto%s', None),
|
||||
'create_trackbar' : ('http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=createtrackbar#createtrackbar%s', None),
|
||||
'point' : ('http://docs.opencv.org/modules/core/doc/basic_structures.html#point%s', None),
|
||||
'scalar' : ('http://docs.opencv.org/modules/core/doc/basic_structures.html#scalar%s', None),
|
||||
'line' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#line%s', None),
|
||||
'ellipse' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#ellipse%s', None),
|
||||
'rectangle' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#rectangle%s', None),
|
||||
'circle' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#circle%s', None),
|
||||
'fill_poly' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#fillpoly%s', None),
|
||||
'rng' : ('http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=rng#rng%s', None),
|
||||
'put_text' : ('http://docs.opencv.org/modules/core/doc/drawing_functions.html#puttext%s', None),
|
||||
'gaussian_blur' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=gaussianblur#gaussianblur%s', None),
|
||||
'blur' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=blur#blur%s', None),
|
||||
'median_blur' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=medianblur#medianblur%s', None),
|
||||
'bilateral_filter' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=bilateralfilter#bilateralfilter%s', None),
|
||||
'erode' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=erode#erode%s', None),
|
||||
'dilate' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=dilate#dilate%s', None),
|
||||
'get_structuring_element' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=getstructuringelement#getstructuringelement%s', None),
|
||||
'flood_fill' : ( 'http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=floodfill#floodfill%s', None),
|
||||
'morphology_ex' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=morphologyex#morphologyex%s', None),
|
||||
'pyr_down' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=pyrdown#pyrdown%s', None),
|
||||
'pyr_up' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=pyrup#pyrup%s', None),
|
||||
'resize' : ('http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html?highlight=resize#resize%s', None),
|
||||
'threshold' : ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#threshold%s', None),
|
||||
'filter2d' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=filter2d#filter2d%s', None),
|
||||
'copy_make_border' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=copymakeborder#copymakeborder%s', None),
|
||||
'sobel' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=sobel#sobel%s', None),
|
||||
'scharr' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=scharr#scharr%s', None),
|
||||
'laplacian' : ('http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=laplacian#laplacian%s', None),
|
||||
'canny' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=canny#canny%s', None),
|
||||
'copy_to' : ('http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=copyto#mat-copyto%s', None),
|
||||
'hough_lines' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=houghlines#houghlines%s', None),
|
||||
'hough_lines_p' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=houghlinesp#houghlinesp%s', None),
|
||||
'hough_circles' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=houghcircles#houghcircles%s', None),
|
||||
|
||||
@@ -492,7 +492,7 @@ class=Typewch><span lang=EN-US>- weighttrimming <weight_trimming></span></
|
||||
<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
|
||||
class=Typewch><span lang=EN-US> </span></span><span class=Typewch><span
|
||||
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>Specifies
|
||||
wheter and how much weight trimming should be used. A decent choice is 0.90.</span></span></p>
|
||||
whether and how much weight trimming should be used. A decent choice is 0.90.</span></span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
|
||||
class=Typewch><span lang=EN-US>- eqw</span></span></p>
|
||||
|
||||
@@ -6,12 +6,12 @@ Adding (blending) two images using OpenCV
|
||||
Goal
|
||||
=====
|
||||
|
||||
In this tutorial you will learn how to:
|
||||
In this tutorial you will learn:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* What is *linear blending* and why it is useful.
|
||||
* Add two images using :add_weighted:`addWeighted <>`
|
||||
* what is *linear blending* and why it is useful;
|
||||
* how to add two images using :add_weighted:`addWeighted <>`
|
||||
|
||||
Theory
|
||||
=======
|
||||
|
||||
@@ -18,7 +18,7 @@ We'll seek answers for the following questions:
|
||||
Our test case
|
||||
=============
|
||||
|
||||
Let us consider a simple color reduction method. Using the unsigned char C and C++ type for matrix item storing a channel of pixel may have up to 256 different values. For a three channel image this can allow the formation of way too many colors (16 million to be exact). Working with so many color shades may give a heavy blow to our algorithm performance. However, sometimes it is enough to work with a lot less of them to get the same final result.
|
||||
Let us consider a simple color reduction method. By using the unsigned char C and C++ type for matrix item storing, a channel of pixel may have up to 256 different values. For a three channel image this can allow the formation of way too many colors (16 million to be exact). Working with so many color shades may give a heavy blow to our algorithm performance. However, sometimes it is enough to work with a lot less of them to get the same final result.
|
||||
|
||||
In this cases it's common that we make a *color space reduction*. This means that we divide the color space current value with a new input value to end up with fewer colors. For instance every value between zero and nine takes the new value zero, every value between ten and nineteen the value ten and so on.
|
||||
|
||||
|
||||
@@ -32,14 +32,14 @@ Here's a function that will do this:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
void Sharpen(const Mat& myImage,Mat& Result)
|
||||
void Sharpen(const Mat& myImage, Mat& Result)
|
||||
{
|
||||
CV_Assert(myImage.depth() == CV_8U); // accept only uchar images
|
||||
|
||||
Result.create(myImage.size(),myImage.type());
|
||||
Result.create(myImage.size(), myImage.type());
|
||||
const int nChannels = myImage.channels();
|
||||
|
||||
for(int j = 1 ; j < myImage.rows-1; ++j)
|
||||
for(int j = 1; j < myImage.rows - 1; ++j)
|
||||
{
|
||||
const uchar* previous = myImage.ptr<uchar>(j - 1);
|
||||
const uchar* current = myImage.ptr<uchar>(j );
|
||||
@@ -47,17 +47,17 @@ Here's a function that will do this:
|
||||
|
||||
uchar* output = Result.ptr<uchar>(j);
|
||||
|
||||
for(int i= nChannels;i < nChannels*(myImage.cols-1); ++i)
|
||||
for(int i = nChannels; i < nChannels * (myImage.cols - 1); ++i)
|
||||
{
|
||||
*output++ = saturate_cast<uchar>(5*current[i]
|
||||
-current[i-nChannels] - current[i+nChannels] - previous[i] - next[i]);
|
||||
*output++ = saturate_cast<uchar>(5 * current[i]
|
||||
-current[i - nChannels] - current[i + nChannels] - previous[i] - next[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Result.row(0).setTo(Scalar(0));
|
||||
Result.row(Result.rows-1).setTo(Scalar(0));
|
||||
Result.row(Result.rows - 1).setTo(Scalar(0));
|
||||
Result.col(0).setTo(Scalar(0));
|
||||
Result.col(Result.cols-1).setTo(Scalar(0));
|
||||
Result.col(Result.cols - 1).setTo(Scalar(0));
|
||||
}
|
||||
|
||||
At first we make sure that the input images data is in unsigned char format. For this we use the :utilitysystemfunctions:`CV_Assert <cv-assert>` function that throws an error when the expression inside it is false.
|
||||
@@ -70,14 +70,14 @@ We create an output image with the same size and the same type as our input. As
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
Result.create(myImage.size(),myImage.type());
|
||||
Result.create(myImage.size(), myImage.type());
|
||||
const int nChannels = myImage.channels();
|
||||
|
||||
We'll use the plain C [] operator to access pixels. Because we need to access multiple rows at the same time we'll acquire the pointers for each of them (a previous, a current and a next line). We need another pointer to where we're going to save the calculation. Then simply access the right items with the [] operator. For moving the output pointer ahead we simply increase this (with one byte) after each operation:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
for(int j = 1 ; j < myImage.rows-1; ++j)
|
||||
for(int j = 1; j < myImage.rows - 1; ++j)
|
||||
{
|
||||
const uchar* previous = myImage.ptr<uchar>(j - 1);
|
||||
const uchar* current = myImage.ptr<uchar>(j );
|
||||
@@ -85,21 +85,21 @@ We'll use the plain C [] operator to access pixels. Because we need to access mu
|
||||
|
||||
uchar* output = Result.ptr<uchar>(j);
|
||||
|
||||
for(int i= nChannels;i < nChannels*(myImage.cols-1); ++i)
|
||||
for(int i = nChannels; i < nChannels * (myImage.cols - 1); ++i)
|
||||
{
|
||||
*output++ = saturate_cast<uchar>(5*current[i]
|
||||
-current[i-nChannels] - current[i+nChannels] - previous[i] - next[i]);
|
||||
*output++ = saturate_cast<uchar>(5 * current[i]
|
||||
-current[i - nChannels] - current[i + nChannels] - previous[i] - next[i]);
|
||||
}
|
||||
}
|
||||
|
||||
On the borders of the image the upper notation results inexistent pixel locations (like minus one - minus one). In these points our formula is undefined. A simple solution is to not apply the mask in these points and, for example, set the pixels on the borders to zeros:
|
||||
On the borders of the image the upper notation results inexistent pixel locations (like minus one - minus one). In these points our formula is undefined. A simple solution is to not apply the kernel in these points and, for example, set the pixels on the borders to zeros:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
Result.row(0).setTo(Scalar(0)); // The top row
|
||||
Result.row(Result.rows-1).setTo(Scalar(0)); // The bottom row
|
||||
Result.col(0).setTo(Scalar(0)); // The left column
|
||||
Result.col(Result.cols-1).setTo(Scalar(0)); // The right column
|
||||
Result.row(0).setTo(Scalar(0)); // The top row
|
||||
Result.row(Result.rows - 1).setTo(Scalar(0)); // The bottom row
|
||||
Result.col(0).setTo(Scalar(0)); // The left column
|
||||
Result.col(Result.cols - 1).setTo(Scalar(0)); // The right column
|
||||
|
||||
The filter2D function
|
||||
=====================
|
||||
@@ -116,7 +116,7 @@ Then call the :filtering:`filter2D <filter2d>` function specifying the input, th
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
filter2D(I, K, I.depth(), kern );
|
||||
filter2D(I, K, I.depth(), kern);
|
||||
|
||||
The function even has a fifth optional argument to specify the center of the kernel, and a sixth one for determining what to do in the regions where the operation is undefined (borders). Using this function has the advantage that it's shorter, less verbose and because there are some optimization techniques implemented it is usually faster than the *hand-coded method*. For example in my test while the second one took only 13 milliseconds the first took around 31 milliseconds. Quite some difference.
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ All the above objects, in the end, point to the same single data matrix. Their h
|
||||
:linenos:
|
||||
|
||||
Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
|
||||
Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries
|
||||
Mat E = A(Range::all(), Range(1,3)); // using row and column boundaries
|
||||
|
||||
Now you may ask if the matrix itself may belong to multiple *Mat* objects who takes responsibility for cleaning it up when it's no longer needed. The short answer is: the last object that used it. This is handled by using a reference counting mechanism. Whenever somebody copies a header of a *Mat* object, a counter is increased for the matrix. Whenever a header is cleaned this counter is decreased. When the counter reaches zero the matrix too is freed. Sometimes you will want to copy the matrix itself too, so OpenCV provides the :basicstructures:`clone() <mat-clone>` and :basicstructures:`copyTo() <mat-copyto>` functions.
|
||||
|
||||
@@ -86,7 +86,7 @@ Each of the building components has their own valid domains. This leads to the d
|
||||
Creating a *Mat* object explicitly
|
||||
==================================
|
||||
|
||||
In the :ref:`Load_Save_Image` tutorial you have already learned how to write a matrix to an image file by using the :readWriteImageVideo:` imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can do this using the << operator of *Mat*. Be aware that this only works for two dimensional matrices.
|
||||
In the :ref:`Load_Save_Image` tutorial you have already learned how to write a matrix to an image file by using the :readwriteimagevideo:`imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can do this using the << operator of *Mat*. Be aware that this only works for two dimensional matrices.
|
||||
|
||||
Although *Mat* works really well as an image container, it is also a general matrix class. Therefore, it is possible to create and manipulate multidimensional matrices. You can create a Mat object in multiple ways:
|
||||
|
||||
|
||||
@@ -11,4 +11,5 @@
|
||||
.. |Author_EricCh| unicode:: Eric U+0020 Christiansen
|
||||
.. |Author_AndreyP| unicode:: Andrey U+0020 Pavlenko
|
||||
.. |Author_AlexS| unicode:: Alexander U+0020 Smorkalov
|
||||
.. |Author_BarisD| unicode:: Bar U+0131 U+015F U+0020 Evrim U+0020 Demir U+00F6 z
|
||||
.. |Author_MimmoC| unicode:: Mimmo U+0020 Cosenza
|
||||
.. |Author_BarisD| unicode:: Bar U+0131 U+015F U+0020 Evrim U+0020 Demir U+00F6 z
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -84,88 +84,10 @@ Code
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
.. code-block:: cpp
|
||||
.. literalinclude:: ../../../../../samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp
|
||||
:language: cpp
|
||||
:tab-width: 4
|
||||
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
/** @function main */
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
Mat src_base, hsv_base;
|
||||
Mat src_test1, hsv_test1;
|
||||
Mat src_test2, hsv_test2;
|
||||
Mat hsv_half_down;
|
||||
|
||||
/// Load three images with different environment settings
|
||||
if( argc < 4 )
|
||||
{ printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_setting1> <image_settings2>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
src_base = imread( argv[1], 1 );
|
||||
src_test1 = imread( argv[2], 1 );
|
||||
src_test2 = imread( argv[3], 1 );
|
||||
|
||||
/// Convert to HSV
|
||||
cvtColor( src_base, hsv_base, CV_BGR2HSV );
|
||||
cvtColor( src_test1, hsv_test1, CV_BGR2HSV );
|
||||
cvtColor( src_test2, hsv_test2, CV_BGR2HSV );
|
||||
|
||||
hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );
|
||||
|
||||
/// Using 30 bins for hue and 32 for saturation
|
||||
int h_bins = 50; int s_bins = 60;
|
||||
int histSize[] = { h_bins, s_bins };
|
||||
|
||||
// hue varies from 0 to 256, saturation from 0 to 180
|
||||
float h_ranges[] = { 0, 256 };
|
||||
float s_ranges[] = { 0, 180 };
|
||||
|
||||
const float* ranges[] = { h_ranges, s_ranges };
|
||||
|
||||
// Use the o-th and 1-st channels
|
||||
int channels[] = { 0, 1 };
|
||||
|
||||
/// Histograms
|
||||
MatND hist_base;
|
||||
MatND hist_half_down;
|
||||
MatND hist_test1;
|
||||
MatND hist_test2;
|
||||
|
||||
/// Calculate the histograms for the HSV images
|
||||
calcHist( &hsv_base, 1, channels, Mat(), hist_base, 2, histSize, ranges, true, false );
|
||||
normalize( hist_base, hist_base, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_half_down, 1, channels, Mat(), hist_half_down, 2, histSize, ranges, true, false );
|
||||
normalize( hist_half_down, hist_half_down, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_test1, 1, channels, Mat(), hist_test1, 2, histSize, ranges, true, false );
|
||||
normalize( hist_test1, hist_test1, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_test2, 1, channels, Mat(), hist_test2, 2, histSize, ranges, true, false );
|
||||
normalize( hist_test2, hist_test2, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
|
||||
/// Apply the histogram comparison methods
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{ int compare_method = i;
|
||||
double base_base = compareHist( hist_base, hist_base, compare_method );
|
||||
double base_half = compareHist( hist_base, hist_half_down, compare_method );
|
||||
double base_test1 = compareHist( hist_base, hist_test1, compare_method );
|
||||
double base_test2 = compareHist( hist_base, hist_test2, compare_method );
|
||||
|
||||
printf( " Method [%d] Perfect, Base-Half, Base-Test(1), Base-Test(2) : %f, %f, %f, %f \n", i, base_base, base_half , base_test1, base_test2 );
|
||||
}
|
||||
|
||||
printf( "Done \n" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Explanation
|
||||
@@ -211,11 +133,11 @@ Explanation
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
int h_bins = 50; int s_bins = 32;
|
||||
int h_bins = 50; int s_bins = 60;
|
||||
int histSize[] = { h_bins, s_bins };
|
||||
|
||||
float h_ranges[] = { 0, 256 };
|
||||
float s_ranges[] = { 0, 180 };
|
||||
float h_ranges[] = { 0, 180 };
|
||||
float s_ranges[] = { 0, 256 };
|
||||
|
||||
const float* ranges[] = { h_ranges, s_ranges };
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ d. **method=CV\_TM\_CCORR\_NORMED**
|
||||
|
||||
.. math::
|
||||
|
||||
R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I'(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}
|
||||
R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}
|
||||
|
||||
|
||||
e. **method=CV\_TM\_CCOEFF**
|
||||
|
||||
@@ -48,10 +48,10 @@ The structure of package contents looks as follows:
|
||||
|
||||
::
|
||||
|
||||
OpenCV-2.4.7-android-sdk
|
||||
OpenCV-2.4.9-android-sdk
|
||||
|_ apk
|
||||
| |_ OpenCV_2.4.7_binary_pack_armv7a.apk
|
||||
| |_ OpenCV_2.4.7_Manager_2.14_XXX.apk
|
||||
| |_ OpenCV_2.4.9_binary_pack_armv7a.apk
|
||||
| |_ OpenCV_2.4.9_Manager_2.18_XXX.apk
|
||||
|
|
||||
|_ doc
|
||||
|_ samples
|
||||
@@ -66,7 +66,7 @@ The structure of package contents looks as follows:
|
||||
| |_ armeabi-v7a
|
||||
| |_ x86
|
||||
|
|
||||
|_ license.txt
|
||||
|_ LICENSE
|
||||
|_ README.android
|
||||
|
||||
* :file:`sdk` folder contains OpenCV API and libraries for Android:
|
||||
@@ -157,10 +157,10 @@ Get the OpenCV4Android SDK
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
unzip ~/Downloads/OpenCV-2.4.7-android-sdk.zip
|
||||
unzip ~/Downloads/OpenCV-2.4.9-android-sdk.zip
|
||||
|
||||
.. |opencv_android_bin_pack| replace:: :file:`OpenCV-2.4.7-android-sdk.zip`
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.7/OpenCV-2.4.7-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack| replace:: :file:`OpenCV-2.4.9-android-sdk.zip`
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.9/OpenCV-2.4.9-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
|
||||
.. |seven_zip| replace:: 7-Zip
|
||||
.. _seven_zip: http://www.7-zip.org/
|
||||
@@ -295,7 +295,7 @@ Well, running samples from Eclipse is very simple:
|
||||
.. code-block:: sh
|
||||
:linenos:
|
||||
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.7_Manager_2.14_armv7a-neon.apk
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk
|
||||
|
||||
.. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
|
||||
platform targets:
|
||||
|
||||
@@ -55,14 +55,14 @@ Manager to access OpenCV libraries externally installed in the target system.
|
||||
:guilabel:`File -> Import -> Existing project in your workspace`.
|
||||
|
||||
Press :guilabel:`Browse` button and locate OpenCV4Android SDK
|
||||
(:file:`OpenCV-2.4.7-android-sdk/sdk`).
|
||||
(:file:`OpenCV-2.4.9-android-sdk/sdk`).
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency0.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. In application project add a reference to the OpenCV Java SDK in
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.7``.
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.9``.
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency1.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
@@ -128,27 +128,27 @@ described above.
|
||||
#. Add the OpenCV library project to your workspace the same way as for the async initialization
|
||||
above. Use menu :guilabel:`File -> Import -> Existing project in your workspace`,
|
||||
press :guilabel:`Browse` button and select OpenCV SDK path
|
||||
(:file:`OpenCV-2.4.7-android-sdk/sdk`).
|
||||
(:file:`OpenCV-2.4.9-android-sdk/sdk`).
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency0.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. In the application project add a reference to the OpenCV4Android SDK in
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.7``;
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.9``;
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency1.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. If your application project **doesn't have a JNI part**, just copy the corresponding OpenCV
|
||||
native libs from :file:`<OpenCV-2.4.7-android-sdk>/sdk/native/libs/<target_arch>` to your
|
||||
native libs from :file:`<OpenCV-2.4.9-android-sdk>/sdk/native/libs/<target_arch>` to your
|
||||
project directory to folder :file:`libs/<target_arch>`.
|
||||
|
||||
In case of the application project **with a JNI part**, instead of manual libraries copying you
|
||||
need to modify your ``Android.mk`` file:
|
||||
add the following two code lines after the ``"include $(CLEAR_VARS)"`` and before
|
||||
``"include path_to_OpenCV-2.4.7-android-sdk/sdk/native/jni/OpenCV.mk"``
|
||||
``"include path_to_OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk"``
|
||||
|
||||
.. code-block:: make
|
||||
:linenos:
|
||||
@@ -221,7 +221,7 @@ taken:
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
include C:\Work\OpenCV4Android\OpenCV-2.4.7-android-sdk\sdk\native\jni\OpenCV.mk
|
||||
include C:\Work\OpenCV4Android\OpenCV-2.4.9-android-sdk\sdk\native\jni\OpenCV.mk
|
||||
|
||||
Should be inserted into the :file:`jni/Android.mk` file **after** this line:
|
||||
|
||||
@@ -382,7 +382,7 @@ result.
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);
|
||||
}
|
||||
|
||||
#. Defines that your activity implements ``CvViewFrameListener2`` interface and fix activity related
|
||||
#. Defines that your activity implements ``CvCameraViewListener2`` interface and fix activity related
|
||||
errors by defining missed methods. For this activity define ``onCreate``, ``onDestroy`` and
|
||||
``onPause`` and implement them according code snippet bellow. Fix errors by adding requited
|
||||
imports.
|
||||
@@ -432,7 +432,7 @@ result.
|
||||
Lets discuss some most important steps. Every Android application with UI must implement Activity
|
||||
and View. By the first steps we create blank activity and default view layout. The simplest
|
||||
OpenCV-centric application must implement OpenCV initialization, create its own view to show
|
||||
preview from camera and implements ``CvViewFrameListener2`` interface to get frames from camera and
|
||||
preview from camera and implements ``CvCameraViewListener2`` interface to get frames from camera and
|
||||
process it.
|
||||
|
||||
First of all we create our application view using xml layout. Our layout consists of the only
|
||||
|
||||
@@ -0,0 +1,728 @@
|
||||
.. _clojure_dev_intro:
|
||||
|
||||
Introduction to OpenCV Development with Clojure
|
||||
***********************************************
|
||||
|
||||
As of OpenCV 2.4.4, OpenCV supports desktop Java development using
|
||||
nearly the same interface as for Android development.
|
||||
|
||||
`Clojure <http://clojure.org/>`_ is a contemporary LISP dialect hosted
|
||||
by the Java Virtual Machine and it offers a complete interoperability
|
||||
with the underlying JVM. This means that we should even be able to use
|
||||
the Clojure REPL (Read Eval Print Loop) as and interactive programmable
|
||||
interface to the underlying OpenCV engine.
|
||||
|
||||
What we'll do in this tutorial
|
||||
==============================
|
||||
|
||||
This tutorial will help you in setting up a basic Clojure environment
|
||||
for interactively learning OpenCV within the fully programmable
|
||||
CLojure REPL.
|
||||
|
||||
Tutorial source code
|
||||
--------------------
|
||||
|
||||
You can find a runnable source code of the sample in the
|
||||
:file:`samples/java/clojure/simple-sample` folder of the OpenCV
|
||||
repository. After having installed OpenCV and Clojure as explained in
|
||||
the tutorial, issue the following command to run the sample from the
|
||||
command line.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd path/to/samples/java/clojure/simple-sample
|
||||
lein run
|
||||
|
||||
Preamble
|
||||
========
|
||||
|
||||
For detailed instruction on installing OpenCV with desktop Java support
|
||||
refer to the `corresponding tutorial <http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html>`_.
|
||||
|
||||
If you are in hurry, here is a minimum quick start guide to install
|
||||
OpenCV on Mac OS X:
|
||||
|
||||
NOTE 1: I'm assuming you already installed
|
||||
`xcode <https://developer.apple.com/xcode/>`_,
|
||||
`jdk <http://www.oracle.com/technetwork/java/javase/downloads/index.html>`_
|
||||
and `Cmake <http://www.cmake.org/cmake/resources/software.html>`_.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd ~/
|
||||
mkdir opt
|
||||
git clone https://github.com/Itseez/opencv.git
|
||||
cd opencv
|
||||
git checkout 2.4
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILD_SHARED_LIBS=OFF ..
|
||||
...
|
||||
...
|
||||
make -j8
|
||||
# optional
|
||||
# make install
|
||||
|
||||
Install Leiningen
|
||||
=================
|
||||
|
||||
Once you installed OpenCV with desktop java support the only other
|
||||
requirement is to install
|
||||
`Leiningeng <https://github.com/technomancy/leiningen>`_ which allows
|
||||
you to manage the entire life cycle of your CLJ projects.
|
||||
|
||||
The available `installation guide <https://github.com/technomancy/leiningen#installation>`_ is very easy to be followed:
|
||||
|
||||
1. `Download the script <https://raw.github.com/technomancy/leiningen/stable/bin/lein>`_
|
||||
2. Place it on your ``$PATH`` (cf. ``~/bin`` is a good choice if it is
|
||||
on your ``path``.)
|
||||
3. Set the script to be executable. (i.e. ``chmod 755 ~/bin/lein``).
|
||||
|
||||
If you work on Windows, follow `this instruction <https://github.com/technomancy/leiningen#windows>`_
|
||||
|
||||
You now have both the OpenCV library and a fully installed basic Clojure
|
||||
environment. What is now needed is to configure the Clojure environment
|
||||
to interact with the OpenCV library.
|
||||
|
||||
Install the localrepo Leiningen plugin
|
||||
=======================================
|
||||
|
||||
The set of commands (tasks in Leiningen parlance) natively supported by
|
||||
Leiningen can be very easily extended by various plugins. One of them is
|
||||
the `lein-localrepo <https://github.com/kumarshantanu/lein-localrepo>`_
|
||||
plugin which allows to install any jar lib as an artifact in the local
|
||||
maven repository of your machine (typically in the ``~/.m2/repository``
|
||||
directory of your username).
|
||||
|
||||
We're going to use this ``lein`` plugin to add to the local maven
|
||||
repository the opencv components needed by Java and Clojure to use the
|
||||
opencv lib.
|
||||
|
||||
Generally speaking, if you want to use a plugin on project base only, it
|
||||
can be added directly to a CLJ project created by ``lein``.
|
||||
|
||||
Instead, when you want a plugin to be available to any CLJ project in
|
||||
your username space, you can add it to the ``profiles.clj`` in the
|
||||
``~/.lein/`` directory.
|
||||
|
||||
The ``lein-localrepo`` plugin will be useful to me in other CLJ
|
||||
projects where I need to call native libs wrapped by a Java interface.
|
||||
So I decide to make it available to any CLJ project:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
mkdir ~/.lein
|
||||
|
||||
Create a file named ``profiles.clj`` in the ``~/.lein`` directory and
|
||||
copy into it the following content:
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
{:user {:plugins [[lein-localrepo "0.5.2"]]}}
|
||||
|
||||
Here we're saying that the version release ``"0.5.2"`` of the
|
||||
``lein-localrepo`` plugin will be available to the ``:user`` profile for
|
||||
any CLJ project created by ``lein``.
|
||||
|
||||
You do not need to do anything else to install the plugin because it
|
||||
will be automatically downloaded from a remote repository the very first
|
||||
time you issue any ``lein`` task.
|
||||
|
||||
Install the java specific libs as local repository
|
||||
==================================================
|
||||
|
||||
If you followed the standard documentation for installing OpenCV on your
|
||||
computer, you should find the following two libs under the directory
|
||||
where you built OpenCV:
|
||||
|
||||
- the ``build/bin/opencv-247.jar`` java lib
|
||||
- the ``build/lib/libopencv_java247.dylib`` native lib (or ``.so`` in
|
||||
you built OpenCV a GNU/Linux OS)
|
||||
|
||||
They are the only opencv libs needed by the JVM to interact with OpenCV.
|
||||
|
||||
Take apart the needed opencv libs
|
||||
---------------------------------
|
||||
|
||||
Create a new directory to store in the above two libs. Start by copying
|
||||
into it the ``opencv-247.jar`` lib.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd ~/opt
|
||||
mkdir clj-opencv
|
||||
cd clj-opencv
|
||||
cp ~/opt/opencv/build/bin/opencv-247.jar .
|
||||
|
||||
First lib done.
|
||||
|
||||
Now, to be able to add the ``libopencv_java247.dylib`` shared native lib
|
||||
to the local maven repository, we first need to package it as a jar
|
||||
file.
|
||||
|
||||
The native lib has to be copied into a directories layout which mimics
|
||||
the names of your operating system and architecture. I'm using a Mac OS
|
||||
X with a X86 64 bit architecture. So my layout will be the following:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
mkdir -p native/macosx/x86_64
|
||||
|
||||
Copy into the ``x86_64`` directory the ``libopencv_java247.dylib`` lib.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cp ~/opt/opencv/build/lib/libopencv_java247.dylib native/macosx/x86_64/
|
||||
|
||||
If you're running OpenCV from a different OS/Architecture pair, here
|
||||
is a summary of the mapping you can choose from.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
OS
|
||||
|
||||
Mac OS X -> macosx
|
||||
Windows -> windows
|
||||
Linux -> linux
|
||||
SunOS -> solaris
|
||||
|
||||
Architectures
|
||||
|
||||
amd64 -> x86_64
|
||||
x86_64 -> x86_64
|
||||
x86 -> x86
|
||||
i386 -> x86
|
||||
arm -> arm
|
||||
sparc -> sparc
|
||||
|
||||
Package the native lib as a jar
|
||||
-------------------------------
|
||||
|
||||
Next you need to package the native lib in a jar file by using the
|
||||
``jar`` command to create a new jar file from a directory.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
jar -cMf opencv-native-247.jar native
|
||||
|
||||
Note that ehe ``M`` option instructs the ``jar`` command to not create
|
||||
a MANIFEST file for the artifact.
|
||||
|
||||
Your directories layout should look like the following:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
tree
|
||||
.
|
||||
|__ native
|
||||
| |__ macosx
|
||||
| |__ x86_64
|
||||
| |__ libopencv_java247.dylib
|
||||
|
|
||||
|__ opencv-247.jar
|
||||
|__ opencv-native-247.jar
|
||||
|
||||
3 directories, 3 files
|
||||
|
||||
Locally install the jars
|
||||
------------------------
|
||||
|
||||
We are now ready to add the two jars as artifacts to the local maven
|
||||
repository with the help of the ``lein-localrepo`` plugin.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
lein localrepo install opencv-247.jar opencv/opencv 2.4.7
|
||||
|
||||
Here the ``localrepo install`` task creates the ``2.4.7.`` release of
|
||||
the ``opencv/opencv`` maven artifact from the ``opencv-247.jar`` lib and
|
||||
then installs it into the local maven repository. The ``opencv/opencv``
|
||||
artifact will then be available to any maven compliant project
|
||||
(Leiningen is internally based on maven).
|
||||
|
||||
Do the same thing with the native lib previously wrapped in a new jar
|
||||
file.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
lein localrepo install opencv-native-247.jar opencv/opencv-native 2.4.7
|
||||
|
||||
Note that the groupId, ``opencv``, of the two artifacts is the same. We
|
||||
are now ready to create a new CLJ project to start interacting with
|
||||
OpenCV.
|
||||
|
||||
Create a project
|
||||
----------------
|
||||
|
||||
Create a new CLJ project by using the ``lein new`` task from the
|
||||
terminal.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
# cd in the directory where you work with your development projects (e.g. ~/devel)
|
||||
lein new simple-sample
|
||||
Generating a project called simple-sample based on the 'default' template.
|
||||
To see other templates (app, lein plugin, etc), try `lein help new`.
|
||||
|
||||
The above task creates the following ``simple-sample`` directories
|
||||
layout:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
tree simple-sample/
|
||||
simple-sample/
|
||||
|__ LICENSE
|
||||
|__ README.md
|
||||
|__ doc
|
||||
| |__ intro.md
|
||||
|
|
||||
|__ project.clj
|
||||
|__ resources
|
||||
|__ src
|
||||
| |__ simple_sample
|
||||
| |__ core.clj
|
||||
|__ test
|
||||
|__ simple_sample
|
||||
|__ core_test.clj
|
||||
|
||||
6 directories, 6 files
|
||||
|
||||
We need to add the two ``opencv`` artifacts as dependencies of the newly
|
||||
created project. Open the ``project.clj`` and modify its dependencies
|
||||
section as follows:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
(defproject simple-sample "0.1.0-SNAPSHOT"
|
||||
:description "FIXME: write description"
|
||||
:url "http://example.com/FIXME"
|
||||
:license {:name "Eclipse Public License"
|
||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||
:dependencies [[org.clojure/clojure "1.5.1"]
|
||||
[opencv/opencv "2.4.7"] ; added line
|
||||
[opencv/opencv-native "2.4.7"]]) ;added line
|
||||
|
||||
|
||||
Note that The Clojure Programming Language is a jar artifact too. This
|
||||
is why Clojure is called an hosted language.
|
||||
|
||||
To verify that everything went right issue the ``lein deps`` task. The
|
||||
very first time you run a ``lein`` task it will take sometime to
|
||||
download all the required dependencies before executing the task
|
||||
itself.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd simple-sample
|
||||
lein deps
|
||||
...
|
||||
|
||||
The ``deps`` task reads and merges from the ``project.clj`` and the
|
||||
``~/.lein/profiles.clj`` files all the dependencies of the
|
||||
``simple-sample`` project and verifies if they have already been
|
||||
cached in the local maven repository. If the task returns without
|
||||
messages about not being able to retrieve the two new artifacts your
|
||||
installation is correct, otherwise go back and double check that you
|
||||
did everything right.
|
||||
|
||||
REPLing with OpenCV
|
||||
-------------------
|
||||
|
||||
Now ``cd`` in the ``simple-sample`` directory and issue the following
|
||||
``lein`` task:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd simple-sample
|
||||
lein repl
|
||||
...
|
||||
...
|
||||
nREPL server started on port 50907 on host 127.0.0.1
|
||||
REPL-y 0.3.0
|
||||
Clojure 1.5.1
|
||||
Docs: (doc function-name-here)
|
||||
(find-doc "part-of-name-here")
|
||||
Source: (source function-name-here)
|
||||
Javadoc: (javadoc java-object-or-class-here)
|
||||
Exit: Control+D or (exit) or (quit)
|
||||
Results: Stored in vars *1, *2, *3, an exception in *e
|
||||
|
||||
user=>
|
||||
|
||||
You can immediately interact with the REPL by issuing any CLJ expression
|
||||
to be evaluated.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (+ 41 1)
|
||||
42
|
||||
user=> (println "Hello, OpenCV!")
|
||||
Hello, OpenCV!
|
||||
nil
|
||||
user=> (defn foo [] (str "bar"))
|
||||
#'user/foo
|
||||
user=> (foo)
|
||||
"bar"
|
||||
|
||||
When ran from the home directory of a lein based project, even if the
|
||||
``lein repl`` task automatically loads all the project dependencies, you
|
||||
still need to load the opencv native library to be able to interact with
|
||||
the OpenCV.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)
|
||||
nil
|
||||
|
||||
Then you can start interacting with OpenCV by just referencing the fully
|
||||
qualified names of its classes.
|
||||
|
||||
NOTE 2: `Here <http://docs.opencv.org/java/>`_ you can find the
|
||||
full OpenCV Java API.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (org.opencv.core.Point. 0 0)
|
||||
#<Point {0.0, 0.0}>
|
||||
|
||||
Here we created a two dimensions opencv ``Point`` instance. Even if all
|
||||
the java packages included within the java interface to OpenCV are
|
||||
immediately available from the CLJ REPL, it's very annoying to prefix
|
||||
the ``Point.`` instance constructors with the fully qualified package
|
||||
name.
|
||||
|
||||
Fortunately CLJ offer a very easy way to overcome this annoyance by
|
||||
directly importing the ``Point`` class.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (import 'org.opencv.core.Point)
|
||||
org.opencv.core.Point
|
||||
user=> (def p1 (Point. 0 0))
|
||||
#'user/p1
|
||||
user=> p1
|
||||
#<Point {0.0, 0.0}>
|
||||
user=> (def p2 (Point. 100 100))
|
||||
#'user/p2
|
||||
|
||||
We can even inspect the class of an instance and verify if the value of
|
||||
a symbol is an instance of a ``Point`` java class.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (class p1)
|
||||
org.opencv.core.Point
|
||||
user=> (instance? org.opencv.core.Point p1)
|
||||
true
|
||||
|
||||
If we now want to use the opencv ``Rect`` class to create a rectangle,
|
||||
we again have to fully qualify its constructor even if it leaves in
|
||||
the same ``org.opencv.core`` package of the ``Point`` class.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (org.opencv.core.Rect. p1 p2)
|
||||
#<Rect {0, 0, 100x100}>
|
||||
|
||||
Again, the CLJ importing facilities is very handy and let you to map
|
||||
more symbols in one shot.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (import '[org.opencv.core Point Rect Size])
|
||||
org.opencv.core.Size
|
||||
user=> (def r1 (Rect. p1 p2))
|
||||
#'user/r1
|
||||
user=> r1
|
||||
#<Rect {0, 0, 100x100}>
|
||||
user=> (class r1)
|
||||
org.opencv.core.Rect
|
||||
user=> (instance? org.opencv.core.Rect r1)
|
||||
true
|
||||
user=> (Size. 100 100)
|
||||
#<Size 100x100>
|
||||
user=> (def sq-100 (Size. 100 100))
|
||||
#'user/sq-100
|
||||
user=> (class sq-100)
|
||||
org.opencv.core.Size
|
||||
user=> (instance? org.opencv.core.Size sq-100)
|
||||
true
|
||||
|
||||
Obviously you can call methods on instances as well.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (.area r1)
|
||||
10000.0
|
||||
user=> (.area sq-100)
|
||||
10000.0
|
||||
|
||||
Or modify the value of a member field.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (set! (.x p1) 10)
|
||||
10
|
||||
user=> p1
|
||||
#<Point {10.0, 0.0}>
|
||||
user=> (set! (.width sq-100) 10)
|
||||
10
|
||||
user=> (set! (.height sq-100) 10)
|
||||
10
|
||||
user=> (.area sq-100)
|
||||
100.0
|
||||
|
||||
If you find yourself not remembering a OpenCV class behavior, the
|
||||
REPL gives you the opportunity to easily search the corresponding
|
||||
javadoc documention:
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (javadoc Rect)
|
||||
"http://www.google.com/search?btnI=I%27m%20Feeling%20Lucky&q=allinurl:org/opencv/core/Rect.html"
|
||||
|
||||
Mimic the OpenCV Java Tutorial Sample in the REPL
|
||||
-------------------------------------------------
|
||||
|
||||
Let's now try to port to Clojure the `opencv java tutorial sample <http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html>`_.
|
||||
Instead of writing it in a source file we're going to evaluate it at the
|
||||
REPL.
|
||||
|
||||
Following is the original Java source code of the cited sample.
|
||||
|
||||
.. code:: java
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Scalar;
|
||||
|
||||
class SimpleSample {
|
||||
|
||||
static{ System.loadLibrary("opencv_java244"); }
|
||||
|
||||
public static void main(String[] args) {
|
||||
Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
|
||||
System.out.println("OpenCV Mat: " + m);
|
||||
Mat mr1 = m.row(1);
|
||||
mr1.setTo(new Scalar(1));
|
||||
Mat mc5 = m.col(5);
|
||||
mc5.setTo(new Scalar(5));
|
||||
System.out.println("OpenCV Mat data:\n" + m.dump());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Add injections to the project
|
||||
-----------------------------
|
||||
|
||||
Before start coding, we'd like to eliminate the boring need of
|
||||
interactively loading the native opencv lib any time we start a new REPL
|
||||
to interact with it.
|
||||
|
||||
First, stop the REPL by evaluating the ``(exit)`` expression at the REPL
|
||||
prompt.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (exit)
|
||||
Bye for now!
|
||||
|
||||
Then open your ``project.clj`` file and edit it as follows:
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
(defproject simple-sample "0.1.0-SNAPSHOT"
|
||||
...
|
||||
:injections [(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)])
|
||||
|
||||
Here we're saying to load the opencv native lib anytime we run the REPL
|
||||
in such a way that we have not anymore to remember to manually do it.
|
||||
|
||||
Rerun the ``lein repl`` task
|
||||
|
||||
.. code:: bash
|
||||
|
||||
lein repl
|
||||
nREPL server started on port 51645 on host 127.0.0.1
|
||||
REPL-y 0.3.0
|
||||
Clojure 1.5.1
|
||||
Docs: (doc function-name-here)
|
||||
(find-doc "part-of-name-here")
|
||||
Source: (source function-name-here)
|
||||
Javadoc: (javadoc java-object-or-class-here)
|
||||
Exit: Control+D or (exit) or (quit)
|
||||
Results: Stored in vars *1, *2, *3, an exception in *e
|
||||
|
||||
user=>
|
||||
|
||||
Import the interested OpenCV java interfaces.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (import '[org.opencv.core Mat CvType Scalar])
|
||||
org.opencv.core.Scalar
|
||||
|
||||
We're going to mimic almost verbatim the original OpenCV java tutorial
|
||||
to:
|
||||
|
||||
- create a 5x10 matrix with all its elements intialized to 0
|
||||
- change the value of every element of the second row to 1
|
||||
- change the value of every element of the 6th column to 5
|
||||
- print the content of the obtained matrix
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (def m (Mat. 5 10 CvType/CV_8UC1 (Scalar. 0 0)))
|
||||
#'user/m
|
||||
user=> (def mr1 (.row m 1))
|
||||
#'user/mr1
|
||||
user=> (.setTo mr1 (Scalar. 1 0))
|
||||
#<Mat Mat [ 1*10*CV_8UC1, isCont=true, isSubmat=true, nativeObj=0x7fc9dac49880, dataAddr=0x7fc9d9c98d5a ]>
|
||||
user=> (def mc5 (.col m 5))
|
||||
#'user/mc5
|
||||
user=> (.setTo mc5 (Scalar. 5 0))
|
||||
#<Mat Mat [ 5*1*CV_8UC1, isCont=false, isSubmat=true, nativeObj=0x7fc9d9c995a0, dataAddr=0x7fc9d9c98d55 ]>
|
||||
user=> (println (.dump m))
|
||||
[0, 0, 0, 0, 0, 5, 0, 0, 0, 0;
|
||||
1, 1, 1, 1, 1, 5, 1, 1, 1, 1;
|
||||
0, 0, 0, 0, 0, 5, 0, 0, 0, 0;
|
||||
0, 0, 0, 0, 0, 5, 0, 0, 0, 0;
|
||||
0, 0, 0, 0, 0, 5, 0, 0, 0, 0]
|
||||
nil
|
||||
|
||||
If you are accustomed to a functional language all those abused and
|
||||
mutating nouns are going to irritate your preference for verbs. Even
|
||||
if the CLJ interop syntax is very handy and complete, there is still
|
||||
an impedance mismatch between any OOP language and any FP language
|
||||
(bein Scala a mixed paradigms programming language).
|
||||
|
||||
To exit the REPL type ``(exit)``, ``ctr-D`` or ``(quit)`` at the REPL
|
||||
prompt.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (exit)
|
||||
Bye for now!
|
||||
|
||||
Interactively load and blur an image
|
||||
------------------------------------
|
||||
|
||||
In the next sample you will learn how to interactively load and blur and
|
||||
image from the REPL by using the following OpenCV methods:
|
||||
|
||||
- the ``imread`` static method from the ``Highgui`` class to read an
|
||||
image from a file
|
||||
- the ``imwrite`` static method from the ``Highgui`` class to write an
|
||||
image to a file
|
||||
- the ``GaussianBlur`` static method from the ``Imgproc`` class to
|
||||
apply to blur the original image
|
||||
|
||||
We're also going to use the ``Mat`` class which is returned from the
|
||||
``imread`` method and accpeted as the main argument to both the
|
||||
``GaussianBlur`` and the ``imwrite`` methods.
|
||||
|
||||
Add an image to the project
|
||||
---------------------------
|
||||
|
||||
First we want to add an image file to a newly create directory for
|
||||
storing static resources of the project.
|
||||
|
||||
.. image:: images/lena.png
|
||||
:alt: Original Image
|
||||
:align: center
|
||||
|
||||
.. code:: bash
|
||||
|
||||
mkdir -p resources/images
|
||||
cp ~/opt/opencv/doc/tutorials/introduction/desktop_java/images/lena.png resource/images/
|
||||
|
||||
Read the image
|
||||
--------------
|
||||
|
||||
Now launch the REPL as usual and start by importing all the OpenCV
|
||||
classes we're going to use:
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
lein repl
|
||||
nREPL server started on port 50624 on host 127.0.0.1
|
||||
REPL-y 0.3.0
|
||||
Clojure 1.5.1
|
||||
Docs: (doc function-name-here)
|
||||
(find-doc "part-of-name-here")
|
||||
Source: (source function-name-here)
|
||||
Javadoc: (javadoc java-object-or-class-here)
|
||||
Exit: Control+D or (exit) or (quit)
|
||||
Results: Stored in vars *1, *2, *3, an exception in *e
|
||||
|
||||
user=> (import '[org.opencv.core Mat Size CvType]
|
||||
'[org.opencv.highgui Highgui]
|
||||
'[org.opencv.imgproc Imgproc])
|
||||
org.opencv.imgproc.Imgproc
|
||||
|
||||
Now read the image from the ``resources/images/lena.png`` file.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (def lena (Highgui/imread "resources/images/lena.png"))
|
||||
#'user/lena
|
||||
user=> lena
|
||||
#<Mat Mat [ 512*512*CV_8UC3, isCont=true, isSubmat=false, nativeObj=0x7f9ab3054c40, dataAddr=0x19fea9010 ]>
|
||||
|
||||
As you see, by simply evaluating the ``lena`` symbol we know that
|
||||
``lena.png`` is a ``512x512`` matrix of ``CV_8UC3`` elements type. Let's
|
||||
create a new ``Mat`` instance of the same dimensions and elements type.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (def blurred (Mat. 512 512 CvType/CV_8UC3))
|
||||
#'user/blurred
|
||||
user=>
|
||||
|
||||
Now apply a ``GaussianBlur`` filter using ``lena`` as the source matrix
|
||||
and ``blurred`` as the destination matrix.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (Imgproc/GaussianBlur lena blurred (Size. 5 5) 3 3)
|
||||
nil
|
||||
|
||||
As a last step just save the ``blurred`` matrix in a new image file.
|
||||
|
||||
.. code:: clojure
|
||||
|
||||
user=> (Highgui/imwrite "resources/images/blurred.png" blurred)
|
||||
true
|
||||
user=> (exit)
|
||||
Bye for now!
|
||||
|
||||
Following is the new blurred image of Lena.
|
||||
|
||||
.. image:: images/blurred.png
|
||||
:alt: Blurred Image
|
||||
:align: center
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
This tutorial only introduces the very basic environment set up to be
|
||||
able to interact with OpenCV in a CLJ REPL.
|
||||
|
||||
I recommend any Clojure newbie to read the `Clojure Java Interop chapter <http://clojure.org/java_interop>`_ to get all you need to know
|
||||
to interoperate with any plain java lib that has not been wrapped in
|
||||
Clojure to make it usable in a more idiomatic and functional way within
|
||||
Clojure.
|
||||
|
||||
The OpenCV Java API does not wrap the ``highgui`` module
|
||||
functionalities depending on ``Qt`` (e.g. ``namedWindow`` and
|
||||
``imshow``. If you want to create windows and show images into them
|
||||
while interacting with OpenCV from the REPL, at the moment you're left
|
||||
at your own. You could use Java Swing to fill the gap.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright © 2013 Giacomo (Mimmo) Cosenza aka Magomimmo
|
||||
|
||||
Distributed under the BSD 3-clause License, the same of OpenCV.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 351 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 606 KiB |
@@ -106,8 +106,8 @@ Enable hardware optimizations
|
||||
-----------------------------
|
||||
|
||||
Depending on target platform architecture different instruction sets can be used. By default
|
||||
compiler generates code for armv5l without VFPv3 and NEON extensions. Add ``-DUSE_VFPV3=ON``
|
||||
to cmake command line to enable code generation for VFPv3 and ``-DUSE_NEON=ON`` for using
|
||||
compiler generates code for armv5l without VFPv3 and NEON extensions. Add ``-DENABLE_VFPV3=ON``
|
||||
to cmake command line to enable code generation for VFPv3 and ``-DENABLE_NEON=ON`` for using
|
||||
NEON SIMD extensions.
|
||||
|
||||
TBB is supported on multi core ARM SoCs also.
|
||||
|
||||
@@ -25,29 +25,34 @@ Let's use a simple program such as DisplayImage.cpp shown below.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include <stdio.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <stdio.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
Mat image;
|
||||
image = imread( argv[1], 1 );
|
||||
int main(int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 )
|
||||
{
|
||||
printf("usage: DisplayImage.out <Image_Path>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( argc != 2 || !image.data )
|
||||
{
|
||||
printf( "No image data \n" );
|
||||
return -1;
|
||||
}
|
||||
Mat image;
|
||||
image = imread( argv[1], 1 );
|
||||
|
||||
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
|
||||
imshow( "Display Image", image );
|
||||
if ( !image.data )
|
||||
{
|
||||
printf("No image data \n");
|
||||
return -1;
|
||||
}
|
||||
namedWindow("Display Image", CV_WINDOW_AUTOSIZE );
|
||||
imshow("Display Image", image);
|
||||
|
||||
waitKey(0);
|
||||
waitKey(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Create a CMake file
|
||||
---------------------
|
||||
|
||||
@@ -16,7 +16,7 @@ Required Packages
|
||||
* CMake 2.6 or higher;
|
||||
* Git;
|
||||
* GTK+2.x or higher, including headers (libgtk2.0-dev);
|
||||
* pkgconfig;
|
||||
* pkg-config;
|
||||
* Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy);
|
||||
* ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev;
|
||||
* [optional] libdc1394 2.x;
|
||||
|
||||
@@ -5,7 +5,7 @@ Load, Modify, and Save an Image
|
||||
|
||||
.. note::
|
||||
|
||||
We assume that by now you know how to load an image using :imread:`imread <>` and to display it in a window (using :imshow:`imshow <>`). Read the :ref:`Display_Image` tutorial otherwise.
|
||||
We assume that by now you know how to load an image using :readwriteimagevideo:`imread <imread>` and to display it in a window (using :user_interface:`imshow <imshow>`). Read the :ref:`Display_Image` tutorial otherwise.
|
||||
|
||||
Goals
|
||||
======
|
||||
@@ -14,9 +14,9 @@ In this tutorial you will learn how to:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* Load an image using :imread:`imread <>`
|
||||
* Transform an image from BGR to Grayscale format by using :cvt_color:`cvtColor <>`
|
||||
* Save your transformed image in a file on disk (using :imwrite:`imwrite <>`)
|
||||
* Load an image using :readwriteimagevideo:`imread <imread>`
|
||||
* Transform an image from BGR to Grayscale format by using :miscellaneous_transformations:`cvtColor <cvtcolor>`
|
||||
* Save your transformed image in a file on disk (using :readwriteimagevideo:`imwrite <imwrite>`)
|
||||
|
||||
Code
|
||||
======
|
||||
@@ -63,10 +63,7 @@ Here it is:
|
||||
Explanation
|
||||
============
|
||||
|
||||
#. We begin by:
|
||||
|
||||
* Creating a Mat object to store the image information
|
||||
* Load an image using :imread:`imread <>`, located in the path given by *imageName*. Fort 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 RGB 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:
|
||||
|
||||
@@ -74,15 +71,15 @@ Explanation
|
||||
|
||||
cvtColor( image, gray_image, CV_BGR2GRAY );
|
||||
|
||||
As you can see, :cvt_color:`cvtColor <>` takes as arguments:
|
||||
As you can see, :miscellaneous_transformations:`cvtColor <cvtcolor>` takes as arguments:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* a source image (*image*)
|
||||
* a destination image (*gray_image*), in which we will save the converted image.
|
||||
* an additional parameter that indicates what kind of transformation will be performed. In this case we use **CV_BGR2GRAY** (because of :imread:`imread <>` has BGR default channel order in case of color images).
|
||||
* an additional parameter that indicates what kind of transformation will be performed. In this case we use **CV_BGR2GRAY** (because of :readwriteimagevideo:`imread <imread>` has BGR default channel order in case of color images).
|
||||
|
||||
#. So now we have our new *gray_image* and want to save it on disk (otherwise it will get lost after the program ends). To save it, we will use a function analagous to :imread:`imread <>`: :imwrite:`imwrite <>`
|
||||
#. So now we have our new *gray_image* and want to save it on disk (otherwise it will get lost after the program ends). To save it, we will use a function analagous to :readwriteimagevideo:`imread <imread>`: :readwriteimagevideo:`imwrite <imwrite>`
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@@ -100,7 +97,7 @@ Explanation
|
||||
imshow( imageName, image );
|
||||
imshow( "Gray image", gray_image );
|
||||
|
||||
#. Add add the *waitKey(0)* function call for the program to wait forever for an user key press.
|
||||
#. Add the *waitKey(0)* function call for the program to wait forever for an user key press.
|
||||
|
||||
|
||||
Result
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
+16
@@ -156,6 +156,21 @@ world of the OpenCV.
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
================ =================================================
|
||||
|ClojureLogo| **Title:** :ref:`clojure_dev_intro`
|
||||
|
||||
*Compatibility:* > OpenCV 2.4.4
|
||||
|
||||
*Author:* |Author_MimmoC|
|
||||
|
||||
A tutorial on how to interactively use OpenCV from the Clojure REPL.
|
||||
|
||||
================ =================================================
|
||||
|
||||
.. |ClojureLogo| image:: images/clojure-logo.png
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
* **Android**
|
||||
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
@@ -314,6 +329,7 @@ world of the OpenCV.
|
||||
../windows_visual_studio_image_watch/windows_visual_studio_image_watch
|
||||
../desktop_java/java_dev_intro
|
||||
../java_eclipse/java_eclipse
|
||||
../clojure_dev_intro/clojure_dev_intro
|
||||
../android_binary_package/android_dev_intro
|
||||
../android_binary_package/O4A_SDK
|
||||
../android_binary_package/dev_with_OCV_on_Android
|
||||
|
||||
@@ -81,7 +81,7 @@ Building the OpenCV library from scratch requires a couple of tools installed be
|
||||
|
||||
+ An IDE of choice (preferably), or just a C\C++ compiler that will actually make the binary files. Here we will use the `Microsoft Visual Studio <https://www.microsoft.com/visualstudio/en-us>`_. However, you can use any other IDE that has a valid C\C++ compiler.
|
||||
|
||||
+ |CMake|_, which is a neat tool to make the project files (for your choosen IDE) from the OpenCV source files. It will also allow an easy configuration of the OpenCV build files, in order to make binary files that fits exactly to your needs.
|
||||
+ |CMake|_, which is a neat tool to make the project files (for your chosen IDE) from the OpenCV source files. It will also allow an easy configuration of the OpenCV build files, in order to make binary files that fits exactly to your needs.
|
||||
|
||||
+ Git to acquire the OpenCV source files. A good tool for this is |TortoiseGit|_. Alternatively, you can just download an archived version of the source files from our `page on Sourceforge <http://sourceforge.net/projects/opencvlibrary/files/opencv-win/>`_
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ As always, we would be happy to hear your comments and receive your contribution
|
||||
.. cssclass:: toctableopencv
|
||||
|
||||
=========== =======================================================
|
||||
|Video| Look here in order to find use on your video stream algoritms like: motion extraction, feature tracking and foreground extractions.
|
||||
|Video| Look here in order to find use on your video stream algorithms like: motion extraction, feature tracking and foreground extractions.
|
||||
|
||||
=========== =======================================================
|
||||
|
||||
@@ -186,6 +186,21 @@ As always, we would be happy to hear your comments and receive your contribution
|
||||
:width: 80pt
|
||||
:alt: gpu icon
|
||||
|
||||
* :ref:`Table-Of-Content-Viz`
|
||||
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
.. cssclass:: toctableopencv
|
||||
|
||||
=========== =======================================================
|
||||
|Viz| These tutorials show how to use Viz module effectively.
|
||||
|
||||
=========== =======================================================
|
||||
|
||||
.. |Viz| image:: images/viz.jpg
|
||||
:height: 80pt
|
||||
:width: 80pt
|
||||
:alt: viz icon
|
||||
|
||||
* :ref:`Table-Of-Content-General`
|
||||
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
@@ -221,4 +236,5 @@ As always, we would be happy to hear your comments and receive your contribution
|
||||
gpu/table_of_content_gpu/table_of_content_gpu
|
||||
contrib/table_of_content_contrib/table_of_content_contrib
|
||||
ios/table_of_content_ios/table_of_content_ios
|
||||
viz/table_of_content_viz/table_of_content_viz
|
||||
general/table_of_content_general/table_of_content_general
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*video* module. Video analysis
|
||||
-----------------------------------------------------------
|
||||
|
||||
Look here in order to find use on your video stream algoritms like: motion extraction, feature tracking and foreground extractions.
|
||||
Look here in order to find use on your video stream algorithms like: motion extraction, feature tracking and foreground extractions.
|
||||
|
||||
.. include:: ../../definitions/noContent.rst
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
.. _creating_widgets:
|
||||
|
||||
Creating Widgets
|
||||
****************
|
||||
|
||||
Goal
|
||||
====
|
||||
|
||||
In this tutorial you will learn how to
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* Create your own widgets using WidgetAccessor and VTK.
|
||||
* Show your widget in the visualization window.
|
||||
|
||||
Code
|
||||
====
|
||||
|
||||
You can download the code from :download:`here <../../../../samples/cpp/tutorial_code/viz/creating_widgets.cpp>`.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include <opencv2/viz/vizcore.hpp>
|
||||
#include <opencv2/viz/widget_accessor.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkTriangle.h>
|
||||
#include <vtkCellArray.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkActor.h>
|
||||
#include <vtkProp.h>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @class WTriangle
|
||||
* @brief Defining our own 3D Triangle widget
|
||||
*/
|
||||
class WTriangle : public viz::Widget3D
|
||||
{
|
||||
public:
|
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
};
|
||||
|
||||
/**
|
||||
* @function WTriangle::WTriangle
|
||||
*/
|
||||
WTriangle::WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color)
|
||||
{
|
||||
// Create a triangle
|
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
|
||||
points->InsertNextPoint(pt1.x, pt1.y, pt1.z);
|
||||
points->InsertNextPoint(pt2.x, pt2.y, pt2.z);
|
||||
points->InsertNextPoint(pt3.x, pt3.y, pt3.z);
|
||||
|
||||
vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();
|
||||
triangle->GetPointIds()->SetId(0,0);
|
||||
triangle->GetPointIds()->SetId(1,1);
|
||||
triangle->GetPointIds()->SetId(2,2);
|
||||
|
||||
vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
|
||||
cells->InsertNextCell(triangle);
|
||||
|
||||
// Create a polydata object
|
||||
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
|
||||
|
||||
// Add the geometry and topology to the polydata
|
||||
polyData->SetPoints(points);
|
||||
polyData->SetPolys(cells);
|
||||
|
||||
// Create mapper and actor
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
mapper->SetInput(polyData);
|
||||
#else
|
||||
mapper->SetInputData(polyData);
|
||||
#endif
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
|
||||
// Store this actor in the widget in order that visualizer can access it
|
||||
viz::WidgetAccessor::setProp(*this, actor);
|
||||
|
||||
// Set the color of the widget. This has to be called after WidgetAccessor.
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function main
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
/// Create a window
|
||||
viz::Viz3d myWindow("Creating Widgets");
|
||||
|
||||
/// Create a triangle widget
|
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
|
||||
/// Show widget in the visualizer window
|
||||
myWindow.showWidget("TRIANGLE", tw);
|
||||
|
||||
/// Start event loop
|
||||
myWindow.spin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Explanation
|
||||
===========
|
||||
|
||||
Here is the general structure of the program:
|
||||
|
||||
* Extend Widget3D class to create a new 3D widget.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
class WTriangle : public viz::Widget3D
|
||||
{
|
||||
public:
|
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
};
|
||||
|
||||
* Assign a VTK actor to the widget.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
// Store this actor in the widget in order that visualizer can access it
|
||||
viz::WidgetAccessor::setProp(*this, actor);
|
||||
|
||||
* Set color of the widget.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
// Set the color of the widget. This has to be called after WidgetAccessor.
|
||||
setColor(color);
|
||||
|
||||
* Construct a triangle widget and display it in the window.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/// Create a triangle widget
|
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
|
||||
/// Show widget in the visualizer window
|
||||
myWindow.showWidget("TRIANGLE", tw);
|
||||
|
||||
Results
|
||||
=======
|
||||
|
||||
Here is the result of the program.
|
||||
|
||||
.. image:: images/red_triangle.png
|
||||
:alt: Creating Widgets
|
||||
:align: center
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user