Compare commits
382 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75ed282b20 | |||
| 754956857c | |||
| a4ab60920f | |||
| a574788e89 | |||
| 22dbcf98c5 | |||
| d7540c9a3c | |||
| bea312bd65 | |||
| 3705648c9b | |||
| 940dc1f2b7 | |||
| f54b230906 | |||
| 3bbc4e44c3 | |||
| f81370232a | |||
| 85fad1504a | |||
| 1d10d56651 | |||
| ef5d921eac | |||
| 8409aa9eba | |||
| ca9aa180c1 | |||
| ce46cc9852 | |||
| 39f327acdb | |||
| 6189b47648 | |||
| dd6f5949c2 | |||
| a62539489d | |||
| d6b2739525 | |||
| 846a500fb4 | |||
| 8b7f805642 | |||
| cc5190eb91 | |||
| 4eff798270 | |||
| 4e40e5bb88 | |||
| a456b968cf | |||
| a6387c3012 | |||
| 5f2074d757 | |||
| 2a9c81eb25 | |||
| 65fb8ae33e | |||
| dc88c9f3a2 | |||
| fc3fc6005e | |||
| 27fd913c86 | |||
| e0e828ef5c | |||
| 9992c4d275 | |||
| ab65b9745b | |||
| 4e3ab026fe | |||
| f5b212a9d4 | |||
| e31eb46123 | |||
| 326be0d7ba | |||
| e5c39ed48a | |||
| 0d65397ae7 | |||
| a7f30391d0 | |||
| c96850ba59 | |||
| 5459c11e99 | |||
| e755a2a6e4 | |||
| 1913482cf5 | |||
| c7d04c6c5c | |||
| 1ba7c728a6 | |||
| be9b676db3 | |||
| 75a6eaf147 | |||
| 10e1c2b3cd | |||
| a1dd30ed50 | |||
| f74f1a94fe | |||
| 96bf26611e | |||
| 841741aa52 | |||
| 8f15a609af | |||
| 8cdf7bb84b | |||
| 6fb780eae6 | |||
| 858ba6c798 | |||
| 386733aea1 | |||
| 11eafca3e2 | |||
| 5087ff0814 | |||
| ebc8015638 | |||
| 35c7cab742 | |||
| c1921f1b12 | |||
| 9b978afaa2 | |||
| 997ad12730 | |||
| 777eaa7352 | |||
| bb61a2547a | |||
| 5869415a57 | |||
| b5248da826 | |||
| b059a361dd | |||
| 3c99dc96b1 | |||
| dadba232de | |||
| 787f5236a9 | |||
| 31498ebbea | |||
| 9636ffc471 | |||
| b17e1531d2 | |||
| 05dc645b81 | |||
| d4f038dfcc | |||
| c972c94662 | |||
| 33c9d57c6f | |||
| 2c6f1ab57d | |||
| 000110e760 | |||
| 7a686a0c43 | |||
| 835e4b6de9 | |||
| 0a5301bc5b | |||
| 3a4bc0d41e | |||
| cfb02b5370 | |||
| b8175f8976 | |||
| 182f43b6f9 | |||
| 6d2a97e954 | |||
| 66e4ace39f | |||
| a920ed9e1e | |||
| 6c8ec5336f | |||
| 687fa6a8ca | |||
| 32797515de | |||
| 0f622206e4 | |||
| ca55982669 | |||
| ea67060081 | |||
| 2dfaad3259 | |||
| 06ffa408ce | |||
| 34e9d1eb3c | |||
| 3914c17b0d | |||
| c92e0838c1 | |||
| 443fed796a | |||
| 08536943ad | |||
| 936523ae52 | |||
| 7fff245f87 | |||
| 6e3ea8b49d | |||
| 220b278575 | |||
| 2b022311a4 | |||
| 853f5111c2 | |||
| 65ab6ed59f | |||
| 389aae59ae | |||
| c9abb823a7 | |||
| e6dd9a78ae | |||
| e0c888acf7 | |||
| 50bec53afc | |||
| 828091cfbb | |||
| eb981cc7d7 | |||
| 31be03a805 | |||
| ca3848d773 | |||
| e6d9486a6c | |||
| 9a8e47a766 | |||
| 13f244b6a5 | |||
| 28556f1498 | |||
| 0ccd810738 | |||
| e959f449ae | |||
| e4aea680b9 | |||
| 5d3822f15e | |||
| 465ae048a0 | |||
| 71009c9b4d | |||
| dbed39a931 | |||
| ea31c09384 | |||
| 329a1fb781 | |||
| 043e7e3516 | |||
| 9c23f2f1a6 | |||
| 5e9750d1f5 | |||
| 2180a67670 | |||
| 1188c6fe14 | |||
| a2e754c136 | |||
| 5339ef3004 | |||
| 6a2b3c8d4c | |||
| edacd91a27 | |||
| 5dd46b54c1 | |||
| ea502b6e84 | |||
| 954536073d | |||
| cc45c10f3d | |||
| 13aa23f706 | |||
| 78b51fb574 | |||
| 922d5796b9 | |||
| f0ddc2a53c | |||
| d5d059690f | |||
| fd832bb57d | |||
| 09cb329d73 | |||
| 4a9291fd89 | |||
| 5115e5decb | |||
| 1ed9ff17e1 | |||
| f1fdfa1a51 | |||
| 0f3fe957f5 | |||
| fc4679d4cf | |||
| 35c53204cb | |||
| f731515628 | |||
| 59bf2a34fa | |||
| abbb73e894 | |||
| dada5a422d | |||
| 8bb3d363a4 | |||
| 1522722fab | |||
| 8f1f4273a2 | |||
| a9c8a526cf | |||
| 699db77293 | |||
| 690fb0544c | |||
| ae4c72a153 | |||
| ea92c2b1a6 | |||
| 9ac7aea930 | |||
| 5f17cc1abd | |||
| 8f6695acc7 | |||
| 9524abcd28 | |||
| 83efde6243 | |||
| 8eb987e393 | |||
| 2c6ab65476 | |||
| 66fdddc339 | |||
| 5575171652 | |||
| a8b0db4e5d | |||
| e104fcc000 | |||
| e4f71994c2 | |||
| 29e88e50ff | |||
| 852f061b26 | |||
| f0d277e452 | |||
| 2e8483bd1c | |||
| 3eec8fd0eb | |||
| d8d025c33b | |||
| 8811dabbac | |||
| efca746d36 | |||
| e0f524d3b7 | |||
| d1c842cf29 | |||
| 4d23a5d92d | |||
| 0739d1c2eb | |||
| 475c775b25 | |||
| b7e8ce4523 | |||
| e8fcd721b8 | |||
| ef5579dc86 | |||
| 84ae8097b1 | |||
| 295b988657 | |||
| 68942affdb | |||
| e0980c4d73 | |||
| c5920df159 | |||
| 86ddff0b88 | |||
| 908978d00b | |||
| a956732874 | |||
| 879e046b22 | |||
| 5fb0f34e8a | |||
| 861415133e | |||
| fce75cd858 | |||
| b6d5565df1 | |||
| 53ad291ef1 | |||
| 145d3ba99d | |||
| e6171d17f8 | |||
| aa1c86f95e | |||
| 699565828d | |||
| 38de2a8754 | |||
| 8b661cde15 | |||
| e628fd7bce | |||
| 808ba552c5 | |||
| a024593fa6 | |||
| 87b5737293 | |||
| b80c978f5d | |||
| 10ae0c4364 | |||
| cb3ae1232b | |||
| e73e393c82 | |||
| b01f63835e | |||
| 6d7f5871db | |||
| 89720ae24d | |||
| 9097ccf515 | |||
| dca657a2fd | |||
| df8b057b44 | |||
| 64b3c1e691 | |||
| 15aee09c7f | |||
| 80610ca054 | |||
| fd0df5a89b | |||
| b487e2df0b | |||
| c6ed2bf9aa | |||
| 40b1dc12de | |||
| 8eba3c1e7e | |||
| b50c70bbfa | |||
| af021e79d9 | |||
| 73bfe68821 | |||
| 4a73b4859f | |||
| f5d181db3a | |||
| da7e1cfb49 | |||
| 43b64140ae | |||
| d74b98c3d9 | |||
| e0bfe44cac | |||
| 10fb88d027 | |||
| f826709452 | |||
| f10fd64630 | |||
| 09837928d9 | |||
| dce4e94f02 | |||
| ee6415bd1c | |||
| 78835ad87a | |||
| 4e6be21a44 | |||
| f89e4e7dd0 | |||
| dfa8467a08 | |||
| 669ee0415a | |||
| 367668710c | |||
| 94dea84915 | |||
| 9f1218b00b | |||
| fcfa488250 | |||
| 2bbe31a8f6 | |||
| 7cdb0eafeb | |||
| 90f47eb952 | |||
| 15e57d28f5 | |||
| 532eace7d6 | |||
| d4ac4fcde1 | |||
| c1db75e0c7 | |||
| acfdd0e1fc | |||
| 9fb8f6347f | |||
| 7f73b105ca | |||
| ae8dcdf40d | |||
| ee1e1ce377 | |||
| 6d165dae5e | |||
| 335e61dc47 | |||
| 64380baa85 | |||
| b5eb65e53e | |||
| f1ca05c822 | |||
| 900df21b7d | |||
| 93bad514a8 | |||
| d8cd1d8fcc | |||
| 6356403964 | |||
| e8a14a775e | |||
| 7b90a1e85a | |||
| 49283ec035 | |||
| 7d4bb9428b | |||
| 76eb389761 | |||
| e9a1ccb89a | |||
| db262fa76a | |||
| 4e59d6fd12 | |||
| e136c11c7c | |||
| 0e80f56e44 | |||
| 94758c18de | |||
| e76b375a31 | |||
| 9f5f64e14e | |||
| 4eb2966559 | |||
| 293facbae7 | |||
| 053259fd92 | |||
| da41ac9e60 | |||
| 82c477c9f7 | |||
| 57bead3a5e | |||
| d044ac1c66 | |||
| 9787ab598b | |||
| 7e9b5d9e30 | |||
| 3d141280aa | |||
| 9df7517dea | |||
| 4560909a5e | |||
| 3f65924c45 | |||
| 5e31c82b5b | |||
| 4382bdc859 | |||
| fa66c6b797 | |||
| 2da96be217 | |||
| 43f821afb9 | |||
| 3165baa1f1 | |||
| 9a8a964b69 | |||
| 17888ce0fd | |||
| 051b40f956 | |||
| cc8db99695 | |||
| b39cd06249 | |||
| 46def2fdc1 | |||
| 2195f0cc62 | |||
| 387e92353c | |||
| 2047abd9c3 | |||
| 64f2b1b250 | |||
| 577546ccd9 | |||
| e858c21e1f | |||
| 0d6518aaa0 | |||
| d1a598c652 | |||
| bfc227b8d4 | |||
| 45dd575ed2 | |||
| 80709697e5 | |||
| 1b53a4fccc | |||
| 4bb220bb90 | |||
| e1b3cf5c14 | |||
| 0f298a4203 | |||
| 5e68f35500 | |||
| ba1bd64bf9 | |||
| db88cd1b25 | |||
| 936d2963a2 | |||
| 4378b4d03d | |||
| 6ddef3b7a9 | |||
| 68c92908d5 | |||
| 51e543050c | |||
| 000a13b6a3 | |||
| 84b3b5b4a4 | |||
| 4e83f4c579 | |||
| cd2b188c9a | |||
| 1e0a60be2a | |||
| fc5bba66af | |||
| 4d7d630e92 | |||
| 4b2d1aaeea | |||
| 7e5581cd86 | |||
| 8b6a6d4546 | |||
| 7ae83df8aa | |||
| 779a42678d | |||
| 10ba6a93a6 | |||
| c917be2189 | |||
| c6aa97c9aa | |||
| 250941bd47 | |||
| 5b17a60dde | |||
| b07f772f36 | |||
| d4688e6474 | |||
| e7e29cb63c | |||
| ca922443db | |||
| 2385a5870e | |||
| e567135ed3 | |||
| 98c8584b88 | |||
| 2b2fa58f97 | |||
| 2d54fed3cc | |||
| 964a4d75b4 |
@@ -2,6 +2,14 @@
|
||||
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
|
||||
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
|
||||
|
||||
Please:
|
||||
|
||||
* Read the documentation to test with the latest developer build.
|
||||
* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
|
||||
* Try to be as detailed as possible in your report.
|
||||
* Report only one problem per created issue.
|
||||
|
||||
|
||||
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
|
||||
-->
|
||||
|
||||
@@ -27,4 +35,4 @@ This is a template helping you to create an issue which can be processed as quic
|
||||
// C++ code example
|
||||
```
|
||||
or attach as .txt or .zip file
|
||||
-->
|
||||
-->
|
||||
|
||||
@@ -49,12 +49,12 @@ namespace {
|
||||
|
||||
enum
|
||||
{
|
||||
SHIFT = 14,
|
||||
SHIFT = 15,
|
||||
SHIFT_DELTA = 1 << (SHIFT - 1),
|
||||
|
||||
R2Y_BT601 = 4899,
|
||||
G2Y_BT601 = 9617,
|
||||
B2Y_BT601 = 1868,
|
||||
R2Y_BT601 = 9798,
|
||||
G2Y_BT601 = 19235,
|
||||
B2Y_BT601 = 3735,
|
||||
|
||||
R2Y_BT709 = 3483,
|
||||
G2Y_BT709 = 11718,
|
||||
|
||||
@@ -151,6 +151,10 @@ void div(const Size2D &size,
|
||||
typedef typename internal::VecTraits<T>::vec128 vec128;
|
||||
typedef typename internal::VecTraits<T>::vec64 vec64;
|
||||
|
||||
#if defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||
static_assert(std::numeric_limits<T>::is_integer, "template implementation is for integer types only");
|
||||
#endif
|
||||
|
||||
if (scale == 0.0f ||
|
||||
(std::numeric_limits<T>::is_integer &&
|
||||
(scale * std::numeric_limits<T>::max()) < 1.0f &&
|
||||
@@ -311,6 +315,10 @@ void recip(const Size2D &size,
|
||||
typedef typename internal::VecTraits<T>::vec128 vec128;
|
||||
typedef typename internal::VecTraits<T>::vec64 vec64;
|
||||
|
||||
#if defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||
static_assert(std::numeric_limits<T>::is_integer, "template implementation is for integer types only");
|
||||
#endif
|
||||
|
||||
if (scale == 0.0f ||
|
||||
(std::numeric_limits<T>::is_integer &&
|
||||
scale < 1.0f &&
|
||||
@@ -463,8 +471,6 @@ void div(const Size2D &size,
|
||||
return;
|
||||
}
|
||||
|
||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
||||
|
||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
||||
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
||||
|
||||
@@ -485,9 +491,7 @@ void div(const Size2D &size,
|
||||
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_f32(v_src0, internal::vrecpq_f32(v_src1))), v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_f32(v_src0, internal::vrecpq_f32(v_src1)));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
@@ -495,14 +499,12 @@ void div(const Size2D &size,
|
||||
float32x2_t v_src0 = vld1_f32(src0 + j);
|
||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_f32(v_src0, internal::vrecp_f32(v_src1))), v_mask)));
|
||||
vst1_f32(dst + j, vmul_f32(v_src0, internal::vrecp_f32(v_src1)));
|
||||
}
|
||||
|
||||
for (; j < size.width; j++)
|
||||
{
|
||||
dst[j] = src1[j] ? src0[j] / src1[j] : 0.0f;
|
||||
dst[j] = src0[j] / src1[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,10 +525,8 @@ void div(const Size2D &size,
|
||||
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_f32(vmulq_n_f32(v_src0, scale),
|
||||
internal::vrecpq_f32(v_src1))), v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_f32(vmulq_n_f32(v_src0, scale),
|
||||
internal::vrecpq_f32(v_src1)));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
@@ -534,15 +534,13 @@ void div(const Size2D &size,
|
||||
float32x2_t v_src0 = vld1_f32(src0 + j);
|
||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_f32(vmul_n_f32(v_src0, scale),
|
||||
internal::vrecp_f32(v_src1))), v_mask)));
|
||||
vst1_f32(dst + j, vmul_f32(vmul_n_f32(v_src0, scale),
|
||||
internal::vrecp_f32(v_src1)));
|
||||
}
|
||||
|
||||
for (; j < size.width; j++)
|
||||
{
|
||||
dst[j] = src1[j] ? src0[j] * scale / src1[j] : 0.0f;
|
||||
dst[j] = src0[j] * scale / src1[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -620,8 +618,6 @@ void reciprocal(const Size2D &size,
|
||||
return;
|
||||
}
|
||||
|
||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
||||
|
||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
||||
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
||||
|
||||
@@ -639,23 +635,19 @@ void reciprocal(const Size2D &size,
|
||||
|
||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(internal::vrecpq_f32(v_src1)), v_mask)));
|
||||
vst1q_f32(dst + j, internal::vrecpq_f32(v_src1));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
{
|
||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(internal::vrecp_f32(v_src1)), v_mask)));
|
||||
vst1_f32(dst + j, internal::vrecp_f32(v_src1));
|
||||
}
|
||||
|
||||
for (; j < size.width; j++)
|
||||
{
|
||||
dst[j] = src1[j] ? 1.0f / src1[j] : 0;
|
||||
dst[j] = 1.0f / src1[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,25 +665,19 @@ void reciprocal(const Size2D &size,
|
||||
|
||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_n_f32(internal::vrecpq_f32(v_src1),
|
||||
scale)),v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_n_f32(internal::vrecpq_f32(v_src1), scale));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
{
|
||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_n_f32(internal::vrecp_f32(v_src1),
|
||||
scale)), v_mask)));
|
||||
vst1_f32(dst + j, vmul_n_f32(internal::vrecp_f32(v_src1), scale));
|
||||
}
|
||||
|
||||
for (; j < size.width; j++)
|
||||
{
|
||||
dst[j] = src1[j] ? scale / src1[j] : 0;
|
||||
dst[j] = scale / src1[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Binaries branch name: ffmpeg/3.4_20181103
|
||||
# Binaries were created for OpenCV: c6d2f0399a706028f476f3d08358ea787503020d
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "fe71c0ad807fdc33c2178e48e488f1e9b177c39a")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "41b81bb9a50cabd4bea385f7b50a069a")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "a9ea7dbbc8e5afd08e00e223a831b578")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c")
|
||||
# Binaries branch name: ffmpeg/master_20181106
|
||||
# Binaries were created for OpenCV: 2c6f1ab57d4250ee46e32d1b51c056431965b470
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "759a23e24ab787a0979f8a93103dcc3105ec10c1")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "849286ccc527c99e5a218b67f13c6e8c")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "96444a4645753aaafa296479665c9185")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "f710891525a04586d565d0e700e62a9c")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2014-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VK_PLATFORM_H_
|
||||
#define VK_PLATFORM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* Platform-specific directives and type declarations
|
||||
***************************************************************************************************
|
||||
*/
|
||||
|
||||
/* Platform-specific calling convention macros.
|
||||
*
|
||||
* Platforms should define these so that Vulkan clients call Vulkan commands
|
||||
* with the same calling conventions that the Vulkan implementation expects.
|
||||
*
|
||||
* VKAPI_ATTR - Placed before the return type in function declarations.
|
||||
* Useful for C++11 and GCC/Clang-style function attribute syntax.
|
||||
* VKAPI_CALL - Placed after the return type in function declarations.
|
||||
* Useful for MSVC-style calling convention syntax.
|
||||
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
|
||||
*
|
||||
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
|
||||
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
// On Windows, Vulkan commands use the stdcall convention
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL __stdcall
|
||||
#define VKAPI_PTR VKAPI_CALL
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
|
||||
// calling convention, i.e. float parameters are passed in registers. This
|
||||
// is true even if the rest of the application passes floats on the stack,
|
||||
// as it does by default when compiling for the armeabi-v7a NDK ABI.
|
||||
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR VKAPI_ATTR
|
||||
#else
|
||||
// On other platforms, use the default calling convention
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(VK_NO_STDINT_H)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // !defined(VK_NO_STDINT_H)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef VULKAN_H_
|
||||
#define VULKAN_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include "vk_platform.h"
|
||||
#include "vulkan_core.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include "vulkan_android.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
#include <zircon/types.h>
|
||||
#include "vulkan_fuchsia.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_IOS_MVK
|
||||
#include "vulkan_ios.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_MACOS_MVK
|
||||
#include "vulkan_macos.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
#include <mir_toolkit/client_types.h>
|
||||
#include "vulkan_mir.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_VI_NN
|
||||
#include "vulkan_vi.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include <wayland-client.h>
|
||||
#include "vulkan_wayland.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#include <windows.h>
|
||||
#include "vulkan_win32.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#include <xcb/xcb.h>
|
||||
#include "vulkan_xcb.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#include <X11/Xlib.h>
|
||||
#include "vulkan_xlib.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include "vulkan_xlib_xrandr.h"
|
||||
#endif
|
||||
|
||||
#endif // VULKAN_H_
|
||||
@@ -0,0 +1,126 @@
|
||||
#ifndef VULKAN_ANDROID_H_
|
||||
#define VULKAN_ANDROID_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_android_surface 1
|
||||
struct ANativeWindow;
|
||||
|
||||
#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
|
||||
|
||||
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkAndroidSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkAndroidSurfaceCreateFlagsKHR flags;
|
||||
struct ANativeWindow* window;
|
||||
} VkAndroidSurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#define VK_ANDROID_external_memory_android_hardware_buffer 1
|
||||
struct AHardwareBuffer;
|
||||
|
||||
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3
|
||||
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
|
||||
|
||||
typedef struct VkAndroidHardwareBufferUsageANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint64_t androidHardwareBufferUsage;
|
||||
} VkAndroidHardwareBufferUsageANDROID;
|
||||
|
||||
typedef struct VkAndroidHardwareBufferPropertiesANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkDeviceSize allocationSize;
|
||||
uint32_t memoryTypeBits;
|
||||
} VkAndroidHardwareBufferPropertiesANDROID;
|
||||
|
||||
typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkFormat format;
|
||||
uint64_t externalFormat;
|
||||
VkFormatFeatureFlags formatFeatures;
|
||||
VkComponentMapping samplerYcbcrConversionComponents;
|
||||
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
||||
VkSamplerYcbcrRange suggestedYcbcrRange;
|
||||
VkChromaLocation suggestedXChromaOffset;
|
||||
VkChromaLocation suggestedYChromaOffset;
|
||||
} VkAndroidHardwareBufferFormatPropertiesANDROID;
|
||||
|
||||
typedef struct VkImportAndroidHardwareBufferInfoANDROID {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
struct AHardwareBuffer* buffer;
|
||||
} VkImportAndroidHardwareBufferInfoANDROID;
|
||||
|
||||
typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
} VkMemoryGetAndroidHardwareBufferInfoANDROID;
|
||||
|
||||
typedef struct VkExternalFormatANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint64_t externalFormat;
|
||||
} VkExternalFormatANDROID;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
|
||||
VkDevice device,
|
||||
const struct AHardwareBuffer* buffer,
|
||||
VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
|
||||
VkDevice device,
|
||||
const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
|
||||
struct AHardwareBuffer** pBuffer);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef VULKAN_FUCHSIA_H_
|
||||
#define VULKAN_FUCHSIA_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_FUCHSIA_imagepipe_surface 1
|
||||
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1
|
||||
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface"
|
||||
|
||||
typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA;
|
||||
|
||||
typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImagePipeSurfaceCreateFlagsFUCHSIA flags;
|
||||
zx_handle_t imagePipeHandle;
|
||||
} VkImagePipeSurfaceCreateInfoFUCHSIA;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
|
||||
VkInstance instance,
|
||||
const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef VULKAN_IOS_H_
|
||||
#define VULKAN_IOS_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_MVK_ios_surface 1
|
||||
#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2
|
||||
#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
|
||||
|
||||
typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
|
||||
|
||||
typedef struct VkIOSSurfaceCreateInfoMVK {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkIOSSurfaceCreateFlagsMVK flags;
|
||||
const void* pView;
|
||||
} VkIOSSurfaceCreateInfoMVK;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(
|
||||
VkInstance instance,
|
||||
const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef VULKAN_MACOS_H_
|
||||
#define VULKAN_MACOS_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_MVK_macos_surface 1
|
||||
#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2
|
||||
#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
|
||||
|
||||
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||
|
||||
typedef struct VkMacOSSurfaceCreateInfoMVK {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMacOSSurfaceCreateFlagsMVK flags;
|
||||
const void* pView;
|
||||
} VkMacOSSurfaceCreateInfoMVK;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
|
||||
VkInstance instance,
|
||||
const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef VULKAN_MIR_H_
|
||||
#define VULKAN_MIR_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_mir_surface 1
|
||||
#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4
|
||||
#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface"
|
||||
|
||||
typedef VkFlags VkMirSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkMirSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMirSurfaceCreateFlagsKHR flags;
|
||||
MirConnection* connection;
|
||||
MirSurface* mirSurface;
|
||||
} VkMirSurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkMirSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
MirConnection* connection);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef VULKAN_VI_H_
|
||||
#define VULKAN_VI_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_NN_vi_surface 1
|
||||
#define VK_NN_VI_SURFACE_SPEC_VERSION 1
|
||||
#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
|
||||
|
||||
typedef VkFlags VkViSurfaceCreateFlagsNN;
|
||||
|
||||
typedef struct VkViSurfaceCreateInfoNN {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkViSurfaceCreateFlagsNN flags;
|
||||
void* window;
|
||||
} VkViSurfaceCreateInfoNN;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(
|
||||
VkInstance instance,
|
||||
const VkViSurfaceCreateInfoNN* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef VULKAN_WAYLAND_H_
|
||||
#define VULKAN_WAYLAND_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_wayland_surface 1
|
||||
#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
|
||||
|
||||
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkWaylandSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkWaylandSurfaceCreateFlagsKHR flags;
|
||||
struct wl_display* display;
|
||||
struct wl_surface* surface;
|
||||
} VkWaylandSurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
struct wl_display* display);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,276 @@
|
||||
#ifndef VULKAN_WIN32_H_
|
||||
#define VULKAN_WIN32_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_win32_surface 1
|
||||
#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
|
||||
|
||||
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkWin32SurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkWin32SurfaceCreateFlagsKHR flags;
|
||||
HINSTANCE hinstance;
|
||||
HWND hwnd;
|
||||
} VkWin32SurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex);
|
||||
#endif
|
||||
|
||||
#define VK_KHR_external_memory_win32 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
|
||||
|
||||
typedef struct VkImportMemoryWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportMemoryWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportMemoryWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportMemoryWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkMemoryWin32HandlePropertiesKHR {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t memoryTypeBits;
|
||||
} VkMemoryWin32HandlePropertiesKHR;
|
||||
|
||||
typedef struct VkMemoryGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
} VkMemoryGetWin32HandleInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
|
||||
VkDevice device,
|
||||
VkExternalMemoryHandleTypeFlagBits handleType,
|
||||
HANDLE handle,
|
||||
VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||
#endif
|
||||
|
||||
#define VK_KHR_win32_keyed_mutex 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
|
||||
|
||||
typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t acquireCount;
|
||||
const VkDeviceMemory* pAcquireSyncs;
|
||||
const uint64_t* pAcquireKeys;
|
||||
const uint32_t* pAcquireTimeouts;
|
||||
uint32_t releaseCount;
|
||||
const VkDeviceMemory* pReleaseSyncs;
|
||||
const uint64_t* pReleaseKeys;
|
||||
} VkWin32KeyedMutexAcquireReleaseInfoKHR;
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_external_semaphore_win32 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
|
||||
|
||||
typedef struct VkImportSemaphoreWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkSemaphoreImportFlags flags;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportSemaphoreWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportSemaphoreWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportSemaphoreWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkD3D12FenceSubmitInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t waitSemaphoreValuesCount;
|
||||
const uint64_t* pWaitSemaphoreValues;
|
||||
uint32_t signalSemaphoreValuesCount;
|
||||
const uint64_t* pSignalSemaphoreValues;
|
||||
} VkD3D12FenceSubmitInfoKHR;
|
||||
|
||||
typedef struct VkSemaphoreGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
} VkSemaphoreGetWin32HandleInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
#define VK_KHR_external_fence_win32 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
|
||||
|
||||
typedef struct VkImportFenceWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkFence fence;
|
||||
VkFenceImportFlags flags;
|
||||
VkExternalFenceHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportFenceWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportFenceWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportFenceWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkFenceGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkFence fence;
|
||||
VkExternalFenceHandleTypeFlagBits handleType;
|
||||
} VkFenceGetWin32HandleInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
#define VK_NV_external_memory_win32 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
|
||||
|
||||
typedef struct VkImportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType;
|
||||
HANDLE handle;
|
||||
} VkImportMemoryWin32HandleInfoNV;
|
||||
|
||||
typedef struct VkExportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
} VkExportMemoryWin32HandleInfoNV;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||
VkDevice device,
|
||||
VkDeviceMemory memory,
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
#define VK_NV_win32_keyed_mutex 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
|
||||
|
||||
typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t acquireCount;
|
||||
const VkDeviceMemory* pAcquireSyncs;
|
||||
const uint64_t* pAcquireKeys;
|
||||
const uint32_t* pAcquireTimeoutMilliseconds;
|
||||
uint32_t releaseCount;
|
||||
const VkDeviceMemory* pReleaseSyncs;
|
||||
const uint64_t* pReleaseKeys;
|
||||
} VkWin32KeyedMutexAcquireReleaseInfoNV;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
#ifndef VULKAN_XCB_H_
|
||||
#define VULKAN_XCB_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_xcb_surface 1
|
||||
#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
|
||||
|
||||
typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkXcbSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkXcbSurfaceCreateFlagsKHR flags;
|
||||
xcb_connection_t* connection;
|
||||
xcb_window_t window;
|
||||
} VkXcbSurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
xcb_connection_t* connection,
|
||||
xcb_visualid_t visual_id);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
#ifndef VULKAN_XLIB_H_
|
||||
#define VULKAN_XLIB_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_KHR_xlib_surface 1
|
||||
#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
|
||||
|
||||
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkXlibSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkXlibSurfaceCreateFlagsKHR flags;
|
||||
Display* dpy;
|
||||
Window window;
|
||||
} VkXlibSurfaceCreateInfoKHR;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
Display* dpy,
|
||||
VisualID visualID);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef VULKAN_XLIB_XRANDR_H_
|
||||
#define VULKAN_XLIB_XRANDR_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#define VK_EXT_acquire_xlib_display 1
|
||||
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
|
||||
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
Display* dpy,
|
||||
VkDisplayKHR display);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
Display* dpy,
|
||||
RROutput rrOutput,
|
||||
VkDisplayKHR* pDisplay);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -431,7 +431,7 @@ int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah,
|
||||
return CV_HAL_ERROR_OK;
|
||||
}
|
||||
|
||||
int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4])
|
||||
int ovx_hal_warpPerspective(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4])
|
||||
{
|
||||
if (skipSmallImages<VX_KERNEL_WARP_PERSPECTIVE>(aw, ah))
|
||||
return CV_HAL_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -27,7 +27,7 @@ int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t
|
||||
int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int cn);
|
||||
int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, double inv_scale_x, double inv_scale_y, int interpolation);
|
||||
int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[6], int interpolation, int borderType, const double borderValue[4]);
|
||||
int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]);
|
||||
int ovx_hal_warpPerspective(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]);
|
||||
|
||||
struct cvhalFilter2D;
|
||||
int ovx_hal_filterInit(cvhalFilter2D **filter_context, uchar *kernel_data, size_t kernel_step, int kernel_type, int kernel_width, int kernel_height,
|
||||
@@ -97,7 +97,7 @@ int ovx_hal_integral(int depth, int sdepth, int, const uchar * a, size_t astep,
|
||||
//#undef cv_hal_warpAffine
|
||||
//#define cv_hal_warpAffine ovx_hal_warpAffine
|
||||
//#undef cv_hal_warpPerspective
|
||||
//#define cv_hal_warpPerspective ovx_hal_warpPerspectve
|
||||
//#define cv_hal_warpPerspective ovx_hal_warpPerspective
|
||||
|
||||
#undef cv_hal_filterInit
|
||||
#define cv_hal_filterInit ovx_hal_filterInit
|
||||
|
||||
@@ -153,7 +153,6 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect compiler and target platform architecture
|
||||
# ----------------------------------------------------------------------------
|
||||
OCV_OPTION(ENABLE_CXX11 "Enable C++11 compilation mode" "${OPENCV_CXX11}")
|
||||
include(cmake/OpenCVDetectCXXCompiler.cmake)
|
||||
ocv_cmake_hook(POST_DETECT_COMPILER)
|
||||
|
||||
@@ -222,7 +221,6 @@ OCV_OPTION(BUILD_ITT "Build Intel ITT from source" (NOT MI
|
||||
# ===================================================
|
||||
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON IF APPLE)
|
||||
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa (OBSOLETE)" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" ON IF (ARM OR AARCH64) AND NOT IOS AND NOT (CMAKE_VERSION VERSION_LESS "2.8.11"))
|
||||
OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON IF ANDROID)
|
||||
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT CMAKE_CROSSCOMPILING) )
|
||||
@@ -231,7 +229,6 @@ OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT)
|
||||
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" ON IF (NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" ON IF (NOT IOS AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION) IF (NOT WINRT AND NOT CMAKE_CROSSCOMPILING) )
|
||||
OCV_OPTION(WITH_VFW "Include Video for Windows support (deprecated, consider using MSMF)" OFF IF WIN32 )
|
||||
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF )
|
||||
@@ -239,6 +236,7 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON
|
||||
OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION) IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS )
|
||||
OCV_OPTION(WITH_HALIDE "Include Halide support" OFF)
|
||||
OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF)
|
||||
OCV_OPTION(WITH_INF_ENGINE "Include Intel Inference Engine support" OFF)
|
||||
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
|
||||
@@ -255,16 +253,12 @@ OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" OFF
|
||||
OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32) )
|
||||
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 AND NOT WINRT)
|
||||
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O (OBSOLETE)" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF)
|
||||
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
|
||||
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32 OR MINGW) )
|
||||
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_LIBV4L "Use libv4l for Video 4 Linux support" OFF IF (UNIX AND NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT WINRT) )
|
||||
@@ -276,6 +270,7 @@ OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF (WIN32 AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF IF (NOT WITH_INTELPERC) )
|
||||
OCV_OPTION(WITH_VA "Include VA support" OFF IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF IF ((UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)) )
|
||||
@@ -287,6 +282,7 @@ OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON
|
||||
OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON)
|
||||
OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON)
|
||||
OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON)
|
||||
|
||||
# OpenCV build components
|
||||
@@ -329,7 +325,7 @@ OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC"
|
||||
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
|
||||
OCV_OPTION(ENABLE_VSX "Enable POWER8 and above VSX (64-bit little-endian)" ON IF ((CV_GCC OR CV_CLANG) AND PPC64LE) )
|
||||
OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CV_GCC AND (X86 OR X86_64)) )
|
||||
if(NOT IOS) # Use CPU_BASELINE instead
|
||||
if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS)) # Use CPU_BASELINE instead
|
||||
OCV_OPTION(ENABLE_NEON "Enable NEON instructions" (NEON OR ANDROID_ARM_NEON OR AARCH64) IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
|
||||
OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
|
||||
endif()
|
||||
@@ -343,7 +339,7 @@ OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binarie
|
||||
OCV_OPTION(ENABLE_LTO "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
|
||||
OCV_OPTION(ENABLE_THIN_LTO "Enable Thin LTO" OFF IF CV_CLANG)
|
||||
OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
|
||||
OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" ON IF (UNIX AND NOT MSVC AND NOT IOS AND NOT ANDROID) )
|
||||
OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" OFF)
|
||||
OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
|
||||
OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
|
||||
OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
|
||||
@@ -382,8 +378,6 @@ endif()
|
||||
|
||||
if(ANDROID OR WIN32)
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH doc)
|
||||
else()
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
||||
@@ -423,8 +417,6 @@ if(ANDROID)
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata")
|
||||
elseif(WIN32)
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "testdata")
|
||||
else()
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "share/OpenCV/testdata")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -437,6 +429,7 @@ if(ANDROID)
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH sdk/etc)
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
|
||||
else()
|
||||
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
|
||||
ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
|
||||
@@ -452,24 +445,22 @@ else()
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH java)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH etc)
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
|
||||
else()
|
||||
# Note: layout differs from OpenCV 3.4
|
||||
include(GNUInstallDirs)
|
||||
ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
|
||||
ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java)
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH share/OpenCV)
|
||||
|
||||
if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH)
|
||||
math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX)
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv)
|
||||
else()
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV)
|
||||
endif()
|
||||
endif()
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/opencv4")
|
||||
ocv_update(OPENCV_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}")
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/cmake/opencv4")
|
||||
ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/opencv4/3rdparty")
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/samples")
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/doc/opencv4")
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/java/opencv4")
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/testdata")
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4")
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/licenses/opencv4")
|
||||
endif()
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
|
||||
ocv_update(OPENCV_PYTHON_INSTALL_PATH "python")
|
||||
endif()
|
||||
|
||||
@@ -477,18 +468,18 @@ ocv_update(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PAT
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION})
|
||||
foreach(v
|
||||
OPENCV_INCLUDE_INSTALL_PATH
|
||||
# file names include version (.so/.dll): OPENCV_LIB_INSTALL_PATH
|
||||
OPENCV_CONFIG_INSTALL_PATH
|
||||
OPENCV_3P_LIB_INSTALL_PATH
|
||||
OPENCV_SAMPLES_SRC_INSTALL_PATH
|
||||
OPENCV_CONFIG_INSTALL_PATH
|
||||
OPENCV_DOC_INSTALL_PATH
|
||||
OPENCV_JAR_INSTALL_PATH
|
||||
# JAR file name includes version: OPENCV_JAR_INSTALL_PATH
|
||||
OPENCV_TEST_DATA_INSTALL_PATH
|
||||
OPENCV_OTHER_INSTALL_PATH
|
||||
)
|
||||
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
string(REPLACE "opencv" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
string(REGEX REPLACE "opencv[0-9]*" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -695,6 +686,11 @@ if(WITH_HALIDE)
|
||||
include(cmake/OpenCVDetectHalide.cmake)
|
||||
endif()
|
||||
|
||||
# --- VkCom ---
|
||||
if(WITH_VULKAN)
|
||||
include(cmake/OpenCVDetectVulkan.cmake)
|
||||
endif()
|
||||
|
||||
# --- Inference Engine ---
|
||||
if(WITH_INF_ENGINE)
|
||||
include(cmake/OpenCVDetectInferenceEngine.cmake)
|
||||
@@ -861,9 +857,7 @@ ocv_cmake_hook(PRE_FINALIZE)
|
||||
include(cmake/OpenCVGenHeaders.cmake)
|
||||
|
||||
# Generate opencv.pc for pkg-config command
|
||||
if(NOT OPENCV_SKIP_PKGCONFIG_GENERATION
|
||||
AND OPENCV_GENERATE_PKGCONFIG
|
||||
AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
if(OPENCV_GENERATE_PKGCONFIG)
|
||||
include(cmake/OpenCVGenPkgconfig.cmake)
|
||||
endif()
|
||||
|
||||
@@ -1031,9 +1025,6 @@ string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
|
||||
status("")
|
||||
status(" C/C++:")
|
||||
status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
|
||||
if(ENABLE_CXX11 OR HAVE_CXX11)
|
||||
status(" C++11:" HAVE_CXX11 THEN YES ELSE NO)
|
||||
endif()
|
||||
status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
|
||||
status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
@@ -1162,12 +1153,8 @@ if(WITH_WIN32UI)
|
||||
status(" Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if(WITH_CARBON)
|
||||
status(" Carbon:" YES)
|
||||
else()
|
||||
status(" Cocoa:" YES)
|
||||
endif()
|
||||
if(HAVE_COCOA) # APPLE
|
||||
status(" Cocoa:" YES)
|
||||
endif()
|
||||
|
||||
if(WITH_GTK OR HAVE_GTK)
|
||||
@@ -1247,19 +1234,17 @@ if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
|
||||
status(" PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
|
||||
endif()
|
||||
|
||||
if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
|
||||
status(" PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
|
||||
endif()
|
||||
|
||||
# ========================== VIDEO IO ==========================
|
||||
status("")
|
||||
status(" Video I/O:")
|
||||
|
||||
if(WITH_VFW OR HAVE_VFW)
|
||||
status(" Video for Windows:" HAVE_VFW THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_1394 OR HAVE_DC1394)
|
||||
if(WITH_1394 OR HAVE_DC1394_2)
|
||||
if (HAVE_DC1394_2)
|
||||
status(" DC1394:" "YES (ver ${ALIASOF_libdc1394-2_VERSION})")
|
||||
elseif (HAVE_DC1394)
|
||||
status(" DC1394:" "YES (ver ${ALIASOF_libdc1394_VERSION})")
|
||||
else()
|
||||
status(" DC1394:" "NO")
|
||||
endif()
|
||||
@@ -1317,20 +1302,10 @@ if(APPLE)
|
||||
if(WITH_QUICKTIME OR HAVE_QUICKTIME)
|
||||
status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO)
|
||||
endif()
|
||||
if(WITH_QTKIT OR HAVE_QTKIT)
|
||||
status(" QTKit:" HAVE_QTKIT THEN "YES (deprecated)" ELSE NO)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_UNICAP OR HAVE_UNICAP)
|
||||
status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${ALIASOF_libunicap_VERSION})" ELSE NO)
|
||||
status(" UniCap ucil:" HAVE_UNICAP_UCIL THEN "YES (ver ${ALIASOF_libucil_VERSION})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_V4L OR WITH_LIBV4L OR HAVE_LIBV4L OR HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
status(" libv4l/libv4l2:" HAVE_LIBV4L THEN "${ALIASOF_libv4l1_VERSION} / ${ALIASOF_libv4l2_VERSION}" ELSE "NO")
|
||||
if(WITH_V4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
ocv_build_features_string(v4l_status
|
||||
IF HAVE_CAMV4L THEN "linux/videodev.h"
|
||||
IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
|
||||
IF HAVE_VIDEOIO THEN "sys/videoio.h"
|
||||
ELSE "NO")
|
||||
@@ -1368,7 +1343,7 @@ endif()
|
||||
# Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
|
||||
ocv_build_features_string(parallel_status EXCLUSIVE
|
||||
IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
|
||||
IF HAVE_CSTRIPES THEN "C="
|
||||
IF HAVE_HPX THEN "HPX"
|
||||
IF HAVE_OPENMP THEN "OpenMP"
|
||||
IF HAVE_GCD THEN "GCD"
|
||||
IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"
|
||||
@@ -1470,6 +1445,15 @@ if(WITH_CUDA OR HAVE_CUDA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_VULKAN OR HAVE_VULKAN)
|
||||
status("")
|
||||
status(" Vulkan:" HAVE_VULKAN THEN "YES" ELSE "NO")
|
||||
if(HAVE_VULKAN)
|
||||
status(" Include path:" VULKAN_INCLUDE_DIRS THEN "${VULKAN_INCLUDE_DIRS}" ELSE "NO")
|
||||
status(" Link libraries:" VULKAN_LIBRARIES THEN "${VULKAN_LIBRARIES}" ELSE "Dynamic load")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCL OR HAVE_OPENCL)
|
||||
ocv_build_features_string(opencl_features
|
||||
IF HAVE_OPENCL_SVM THEN "SVM"
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
### Resources
|
||||
|
||||
* Homepage: <http://opencv.org>
|
||||
* Docs: <http://docs.opencv.org/master/>
|
||||
* Homepage: <https://opencv.org>
|
||||
* Docs: <https://docs.opencv.org/master/>
|
||||
* Q&A forum: <http://answers.opencv.org>
|
||||
* Issue tracking: <https://github.com/opencv/opencv/issues>
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ macro(ocv_add_app directory)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
ocv_add_app(traincascade)
|
||||
ocv_add_app(createsamples)
|
||||
#ocv_add_app(traincascade)
|
||||
#ocv_add_app(createsamples)
|
||||
ocv_add_app(annotation)
|
||||
ocv_add_app(visualisation)
|
||||
ocv_add_app(interactive-calibration)
|
||||
|
||||
@@ -210,7 +210,7 @@ void calib::calibDataController::filterFrames()
|
||||
worstElemIndex = i;
|
||||
}
|
||||
}
|
||||
showOverlayMessage(cv::format("Frame %d is worst", worstElemIndex + 1));
|
||||
showOverlayMessage(cv::format("Frame %zu is worst", worstElemIndex + 1));
|
||||
|
||||
if(mCalibData->imagePoints.size()) {
|
||||
mCalibData->imagePoints.erase(mCalibData->imagePoints.begin() + worstElemIndex);
|
||||
|
||||
@@ -318,7 +318,7 @@ cv::Mat CalibProcessor::processFrame(const cv::Mat &frame)
|
||||
saveFrameData();
|
||||
bool isFrameBad = checkLastFrame();
|
||||
if (!isFrameBad) {
|
||||
std::string displayMessage = cv::format("Frame # %d captured", std::max(mCalibData->imagePoints.size(),
|
||||
std::string displayMessage = cv::format("Frame # %zu captured", std::max(mCalibData->imagePoints.size(),
|
||||
mCalibData->allCharucoCorners.size()));
|
||||
if(!showOverlayMessage(displayMessage))
|
||||
showCaptureMessage(frame, displayMessage);
|
||||
|
||||
@@ -30,7 +30,6 @@ using cv::ParallelLoopBody;
|
||||
#include "boost.h"
|
||||
#include "cascadeclassifier.h"
|
||||
#include <queue>
|
||||
#include "cxmisc.h"
|
||||
|
||||
#include "cvconfig.h"
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ public:
|
||||
CV_WRAP virtual void save( const char* filename, const char* name=0 ) const;
|
||||
CV_WRAP virtual void load( const char* filename, const char* name=0 );
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
virtual void write( cv::FileStorage& storage, const char* name ) const;
|
||||
virtual void read( const cv::FileNode& node );
|
||||
|
||||
protected:
|
||||
const char* default_model_name;
|
||||
@@ -210,8 +210,8 @@ public:
|
||||
bool update=false );
|
||||
CV_WRAP virtual float predict( const cv::Mat& samples, CV_OUT cv::Mat* results=0, CV_OUT cv::Mat* results_prob=0 ) const;
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
virtual void write( cv::FileStorage& storage, const char* name ) const;
|
||||
virtual void read( const cv::FileNode& node );
|
||||
|
||||
protected:
|
||||
int var_count, var_all;
|
||||
@@ -521,8 +521,8 @@ public:
|
||||
|
||||
static CvParamGrid get_default_grid( int param_id );
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
virtual void write( cv::FileStorage& storage, const char* name ) const;
|
||||
virtual void read( const cv::FileNode& node );
|
||||
CV_WRAP int get_var_count() const { return var_idx ? var_idx->cols : var_all; }
|
||||
|
||||
protected:
|
||||
@@ -538,8 +538,8 @@ protected:
|
||||
|
||||
virtual float predict( const float* row_sample, int row_len, bool returnDFVal=false ) const;
|
||||
|
||||
virtual void write_params( CvFileStorage* fs ) const;
|
||||
virtual void read_params( CvFileStorage* fs, CvFileNode* node );
|
||||
virtual void write_params( cv::FileStorage& fs ) const;
|
||||
virtual void read_params( const cv::FileNode& node );
|
||||
|
||||
void optimize_linear_svm();
|
||||
|
||||
@@ -673,8 +673,8 @@ struct CvDTreeTrainData
|
||||
|
||||
virtual CvDTreeNode* subsample_data( const CvMat* _subsample_idx );
|
||||
|
||||
virtual void write_params( CvFileStorage* fs ) const;
|
||||
virtual void read_params( CvFileStorage* fs, CvFileNode* node );
|
||||
virtual void write_params( cv::FileStorage& fs ) const;
|
||||
virtual void read_params( const cv::FileNode& node );
|
||||
|
||||
// release all the data
|
||||
virtual void clear();
|
||||
@@ -1738,7 +1738,7 @@ protected:
|
||||
// Read parameters of the gtb model and data.
|
||||
//
|
||||
// API
|
||||
// virtual void read_params( CvFileStorage* fs );
|
||||
// virtual void read_params( const cv::FileStorage& fs );
|
||||
//
|
||||
// INPUT
|
||||
// fs - file storage to read parameters from.
|
||||
@@ -2033,7 +2033,8 @@ typedef CvANN_MLP NeuralNet_MLP;
|
||||
typedef CvGBTreesParams GradientBoostingTreeParams;
|
||||
typedef CvGBTrees GradientBoostingTrees;
|
||||
|
||||
template<> void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const;
|
||||
template<> struct DefaultDeleter<CvDTreeSplit>{ void operator ()(CvDTreeSplit* obj) const; };
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -1880,10 +1880,7 @@ double CvDTree::calc_node_dir( CvDTreeNode* node )
|
||||
namespace cv
|
||||
{
|
||||
|
||||
template<> void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const
|
||||
{
|
||||
fastFree(obj);
|
||||
}
|
||||
void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const { fastFree(obj); }
|
||||
|
||||
DTreeBestSplitFinder::DTreeBestSplitFinder( CvDTree* _tree, CvDTreeNode* _node)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# Find Vulkan
|
||||
#
|
||||
# Vulkan_INCLUDE_DIRS
|
||||
# Vulkan_LIBRARIES
|
||||
# Vulkan_FOUND
|
||||
if (WIN32)
|
||||
find_path(Vulkan_INCLUDE_DIRS NAMES vulkan/vulkan.h HINTS
|
||||
"$ENV{VULKAN_SDK}/Include"
|
||||
"$ENV{VK_SDK_PATH}/Include")
|
||||
if (CMAKE_CL_64)
|
||||
find_library(Vulkan_LIBRARIES NAMES vulkan-1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Bin"
|
||||
"$ENV{VK_SDK_PATH}/Bin")
|
||||
else()
|
||||
find_library(Vulkan_LIBRARIES NAMES vulkan-1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Bin32"
|
||||
"$ENV{VK_SDK_PATH}/Bin32")
|
||||
endif()
|
||||
else()
|
||||
find_path(Vulkan_INCLUDE_DIRS NAMES vulkan/vulkan.h HINTS
|
||||
"$ENV{VULKAN_SDK}/include")
|
||||
find_library(Vulkan_LIBRARIES NAMES vulkan HINTS
|
||||
"$ENV{VULKAN_SDK}/lib")
|
||||
endif()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Vulkan DEFAULT_MSG Vulkan_LIBRARIES Vulkan_INCLUDE_DIRS)
|
||||
mark_as_advanced(Vulkan_INCLUDE_DIRS Vulkan_LIBRARIES)
|
||||
@@ -103,7 +103,9 @@ if(CV_GCC OR CV_CLANG)
|
||||
add_extra_compiler_option(-Wundef)
|
||||
add_extra_compiler_option(-Winit-self)
|
||||
add_extra_compiler_option(-Wpointer-arith)
|
||||
add_extra_compiler_option(-Wshadow)
|
||||
if(NOT (CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0"))
|
||||
add_extra_compiler_option(-Wshadow) # old GCC emits warnings for variables + methods combination
|
||||
endif()
|
||||
add_extra_compiler_option(-Wsign-promo)
|
||||
add_extra_compiler_option(-Wuninitialized)
|
||||
add_extra_compiler_option(-Winit-self)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
if(WIN32)
|
||||
find_path( CSTRIPES_LIB_DIR
|
||||
NAMES "C=.lib"
|
||||
DOC "The path to C= lib and dll")
|
||||
if(CSTRIPES_LIB_DIR)
|
||||
ocv_include_directories("${CSTRIPES_LIB_DIR}/..")
|
||||
link_directories("${CSTRIPES_LIB_DIR}")
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} "C=")
|
||||
set(HAVE_CSTRIPES 1)
|
||||
endif()
|
||||
endif()
|
||||
@@ -70,6 +70,12 @@ if(CUDA_FOUND)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
endif()
|
||||
|
||||
SET(DETECT_ARCHS_COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run")
|
||||
if(WIN32 AND CMAKE_LINKER) #Workaround for VS cl.exe not being in the env. path
|
||||
get_filename_component(host_compiler_bindir ${CMAKE_LINKER} DIRECTORY)
|
||||
SET(DETECT_ARCHS_COMMAND ${DETECT_ARCHS_COMMAND} "-ccbin" "${host_compiler_bindir}")
|
||||
endif()
|
||||
|
||||
set(__cuda_arch_ptx "")
|
||||
if(CUDA_GENERATION STREQUAL "Fermi")
|
||||
set(__cuda_arch_bin "2.0")
|
||||
@@ -84,10 +90,11 @@ if(CUDA_FOUND)
|
||||
elseif(CUDA_GENERATION STREQUAL "Turing")
|
||||
set(__cuda_arch_bin "7.5")
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
else()
|
||||
@@ -101,10 +108,11 @@ if(CUDA_FOUND)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
set(__cuda_arch_bin "5.3 6.2 7.0 7.5")
|
||||
@@ -244,7 +252,7 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
if(UNIX OR APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC --std=c++11)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
|
||||
|
||||
@@ -166,14 +166,11 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CXX11)
|
||||
#cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
|
||||
@@ -185,3 +182,6 @@ if(NOT HAVE_CXX11)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
message(FATAL_ERROR "OpenCV 4.x requires C++11")
|
||||
endif()
|
||||
|
||||
@@ -52,5 +52,18 @@ if(HAVE_QT AND VTK_VERSION VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STR
|
||||
endif()
|
||||
endif()
|
||||
|
||||
try_compile(VTK_COMPILE_STATUS
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VTK_INCLUDE_DIRS}"
|
||||
LINK_LIBRARIES ${VTK_LIBRARIES}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
if(NOT ${VTK_COMPILE_STATUS})
|
||||
message(STATUS "VTK support is disabled. Compilation of the sample code has failed.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(HAVE_VTK ON)
|
||||
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
set(VULKAN_INCLUDE_DIRS "${OpenCV_SOURCE_DIR}/3rdparty/include" CACHE PATH "Vulkan include directory")
|
||||
set(VULKAN_LIBRARIES "")
|
||||
|
||||
try_compile(VALID_VULKAN
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vulkan.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VULKAN_INCLUDE_DIRS}"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT ${VALID_VULKAN})
|
||||
message(WARNING "Can't use Vulkan")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(HAVE_VULKAN 1)
|
||||
|
||||
if(HAVE_VULKAN)
|
||||
add_definitions(-DVK_NO_PROTOTYPES)
|
||||
include_directories(${VULKAN_INCLUDE_DIRS})
|
||||
endif()
|
||||
@@ -2,22 +2,22 @@
|
||||
# Detect frameworks that may be used by 3rd-party libraries as well as OpenCV
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# --- C= ---
|
||||
if(WITH_CSTRIPES AND NOT HAVE_TBB)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCStripes.cmake")
|
||||
else()
|
||||
set(HAVE_CSTRIPES 0)
|
||||
endif()
|
||||
# --- HPX ---
|
||||
if(WITH_HPX)
|
||||
find_package(HPX REQUIRED)
|
||||
ocv_include_directories(${HPX_INCLUDE_DIRS})
|
||||
set(HAVE_HPX TRUE)
|
||||
endif(WITH_HPX)
|
||||
|
||||
# --- GCD ---
|
||||
if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
if(APPLE AND NOT HAVE_TBB)
|
||||
set(HAVE_GCD 1)
|
||||
else()
|
||||
set(HAVE_GCD 0)
|
||||
endif()
|
||||
|
||||
# --- Concurrency ---
|
||||
if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
if(MSVC AND NOT HAVE_TBB)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
|
||||
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Main variables:
|
||||
# LIBREALSENSE_LIBRARIES and LIBREALSENSE_INCLUDE to link Intel librealsense modules
|
||||
# HAVE_LIBREALSENSE for conditional compilation OpenCV with/without librealsense
|
||||
|
||||
find_path(LIBREALSENSE_INCLUDE_DIR "librealsense2/rs.hpp" PATHS "$ENV{LIBREALSENSE_INCLUDE}" DOC "Path to librealsense interface headers")
|
||||
find_library(LIBREALSENSE_LIBRARIES "realsense2" PATHS "$ENV{LIBREALSENSE_LIB}" DOC "Path to librealsense interface libraries")
|
||||
|
||||
if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
|
||||
set(HAVE_LIBREALSENSE TRUE)
|
||||
else()
|
||||
set(HAVE_LIBREALSENSE FALSE)
|
||||
message( WARNING, " librealsense include directory (set by LIBREALSENSE_INCLUDE_DIR variable) is not found or does not have librealsense include files." )
|
||||
endif() #if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
|
||||
|
||||
mark_as_advanced(FORCE LIBREALSENSE_LIBRARIES LIBREALSENSE_INCLUDE_DIR)
|
||||
@@ -80,11 +80,9 @@ if(WITH_OPENGL)
|
||||
endif()
|
||||
endif(WITH_OPENGL)
|
||||
|
||||
# --- Carbon & Cocoa ---
|
||||
# --- Cocoa ---
|
||||
if(APPLE)
|
||||
if(WITH_CARBON)
|
||||
set(HAVE_CARBON YES)
|
||||
elseif(NOT IOS AND CV_CLANG)
|
||||
if(NOT IOS AND CV_CLANG)
|
||||
set(HAVE_COCOA YES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -268,3 +268,8 @@ if(WITH_IMGCODEC_PXM)
|
||||
elseif(DEFINED WITH_IMGCODEC_PXM)
|
||||
set(HAVE_IMGCODEC_PXM OFF)
|
||||
endif()
|
||||
if(WITH_IMGCODEC_PFM)
|
||||
set(HAVE_IMGCODEC_PFM ON)
|
||||
elseif(DEFINED WITH_IMGCODEC_PFM)
|
||||
set(HAVE_IMGCODEC_PFM OFF)
|
||||
endif()
|
||||
@@ -2,14 +2,6 @@
|
||||
# Detect 3rd-party video IO libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
ocv_clear_vars(HAVE_VFW)
|
||||
if(WITH_VFW)
|
||||
try_compile(HAVE_VFW
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vfwtest.cpp"
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32")
|
||||
endif(WITH_VFW)
|
||||
|
||||
# --- GStreamer ---
|
||||
ocv_clear_vars(HAVE_GSTREAMER)
|
||||
# try to find gstreamer 1.x first if 0.10 was not requested
|
||||
@@ -62,16 +54,6 @@ if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
|
||||
endif()
|
||||
endif(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
|
||||
|
||||
# --- unicap ---
|
||||
ocv_clear_vars(HAVE_UNICAP)
|
||||
if(WITH_UNICAP)
|
||||
CHECK_MODULE(libunicap HAVE_UNICAP_ VIDEOIO)
|
||||
CHECK_MODULE(libucil HAVE_UNICAP_UCIL VIDEOIO)
|
||||
if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)
|
||||
set(HAVE_UNICAP TRUE)
|
||||
endif()
|
||||
endif(WITH_UNICAP)
|
||||
|
||||
# --- PvApi ---
|
||||
ocv_clear_vars(HAVE_PVAPI)
|
||||
if(WITH_PVAPI)
|
||||
@@ -174,18 +156,8 @@ if(WITH_XINE)
|
||||
endif(WITH_XINE)
|
||||
|
||||
# --- V4L ---
|
||||
ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2 HAVE_VIDEOIO)
|
||||
ocv_clear_vars(HAVE_CAMV4L2 HAVE_VIDEOIO)
|
||||
if(WITH_V4L)
|
||||
if(WITH_LIBV4L)
|
||||
CHECK_MODULE(libv4l1 HAVE_LIBV4L1 VIDEOIO)
|
||||
CHECK_MODULE(libv4l2 HAVE_LIBV4L2 VIDEOIO)
|
||||
if(HAVE_LIBV4L1 AND HAVE_LIBV4L2)
|
||||
set(HAVE_LIBV4L YES)
|
||||
else()
|
||||
set(HAVE_LIBV4L NO)
|
||||
endif()
|
||||
endif()
|
||||
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
|
||||
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
|
||||
CHECK_INCLUDE_FILE(sys/videoio.h HAVE_VIDEOIO)
|
||||
endif(WITH_V4L)
|
||||
@@ -286,12 +258,8 @@ endif(WITH_MSMF)
|
||||
# --- Extra HighGUI and VideoIO libs on Windows ---
|
||||
if(WIN32)
|
||||
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32)
|
||||
if(HAVE_VFW)
|
||||
list(APPEND VIDEOIO_LIBRARIES vfw32)
|
||||
endif()
|
||||
if(MINGW64)
|
||||
list(APPEND VIDEOIO_LIBRARIES avifil32 avicap32 winmm msvfw32)
|
||||
list(REMOVE_ITEM VIDEOIO_LIBRARIES vfw32)
|
||||
elseif(MINGW)
|
||||
list(APPEND VIDEOIO_LIBRARIES winmm)
|
||||
endif()
|
||||
@@ -301,15 +269,13 @@ if(APPLE)
|
||||
if(WITH_AVFOUNDATION)
|
||||
set(HAVE_AVFOUNDATION YES)
|
||||
endif()
|
||||
if(NOT IOS)
|
||||
if(WITH_QUICKTIME)
|
||||
set(HAVE_QUICKTIME YES)
|
||||
elseif(WITH_QTKIT)
|
||||
set(HAVE_QTKIT YES)
|
||||
endif()
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
# --- Intel librealsense ---
|
||||
if(WITH_LIBREALSENSE)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindLibRealsense.cmake")
|
||||
endif(WITH_LIBREALSENSE)
|
||||
|
||||
# --- Intel Perceptual Computing SDK ---
|
||||
if(WITH_INTELPERC)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIntelPerCSDK.cmake")
|
||||
|
||||
@@ -48,7 +48,7 @@ if(ANDROID)
|
||||
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java3)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java4)
|
||||
else()
|
||||
set(OPENCV_LIBS_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
endif()
|
||||
|
||||
@@ -33,7 +33,7 @@ endif()
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\"")
|
||||
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(EXISTS "${OPENCV_MODULE_${m}_LOCATION}/include")
|
||||
@@ -68,7 +68,7 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
file(RELATIVE_PATH OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${CMAKE_INSTALL_PREFIX})
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\" \"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
|
||||
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"")
|
||||
|
||||
if(USE_IPPICV)
|
||||
file(RELATIVE_PATH IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}" "${IPPICV_INSTALL_PATH}")
|
||||
|
||||
@@ -43,9 +43,9 @@ endmacro()
|
||||
if(NOT DEFINED CMAKE_HELPER_SCRIPT)
|
||||
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
|
||||
ocv_update(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc")
|
||||
else()
|
||||
set(OPENCV_PC_FILE_NAME opencv.pc)
|
||||
ocv_update(OPENCV_PC_FILE_NAME opencv4.pc)
|
||||
endif()
|
||||
|
||||
# build the list of opencv libs and dependencies for all modules
|
||||
|
||||
@@ -15,7 +15,7 @@ endif()
|
||||
if(INSTALL_TO_MANGLED_PATHS)
|
||||
ocv_update(OPENCV_SETUPVARS_FILENAME "setup_vars_opencv-${OPENCV_VERSION}${OPENCV_SCRIPT_EXTENSION}")
|
||||
else()
|
||||
ocv_update(OPENCV_SETUPVARS_FILENAME setup_vars_opencv3${OPENCV_SCRIPT_EXTENSION})
|
||||
ocv_update(OPENCV_SETUPVARS_FILENAME setup_vars_opencv4${OPENCV_SCRIPT_EXTENSION})
|
||||
endif()
|
||||
|
||||
##### build directory
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
set(MIN_VER_CMAKE 2.8.12.2)
|
||||
set(MIN_VER_CMAKE 3.5.1)
|
||||
set(MIN_VER_CUDA 6.5)
|
||||
set(MIN_VER_PYTHON2 2.7)
|
||||
set(MIN_VER_PYTHON3 3.2)
|
||||
|
||||
@@ -1145,6 +1145,11 @@ function(ocv_add_perf_tests)
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${perf_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_PERF_${the_module}_DEPS})
|
||||
add_dependencies(opencv_perf_tests ${the_target})
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE "${HPX_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};PerfTest")
|
||||
set_source_files_properties(${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch}
|
||||
PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};PerfTest")
|
||||
@@ -1230,6 +1235,11 @@ function(ocv_add_accuracy_tests)
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE ${test_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_TEST_${the_module}_DEPS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
ocv_target_link_libraries(${the_target} LINK_PRIVATE "${HPX_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};AccuracyTest")
|
||||
set_source_files_properties(${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch}
|
||||
PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};AccuracyTest")
|
||||
|
||||
@@ -123,7 +123,7 @@ foreach(module calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudaf
|
||||
cudev features2d flann hal highgui imgcodecs imgproc ml objdetect ocl
|
||||
photo shape stitching superres ts video videoio videostab viz)
|
||||
if(HAVE_opencv_${module})
|
||||
list(APPEND STD_OPENCV_LIBS "libopencv-${module}3.0")
|
||||
list(APPEND STD_OPENCV_LIBS "libopencv-${module}4.0")
|
||||
list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -140,9 +140,9 @@ set(CPACK_COMPONENT_PYTHON_CONFLICTS python-opencv)
|
||||
set(CPACK_COMPONENT_PYTHON_PROVIDES python-opencv)
|
||||
set(CPACK_COMPONENT_PYTHON_REPLACES python-opencv)
|
||||
|
||||
set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv3.0-java, libopencv3.0-jni")
|
||||
set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv3.0-java, libopencv3.0-jni")
|
||||
set(CPACK_COMPONENT_JAVA_REPLACES "libopencv3.0-java, libopencv3.0-jni")
|
||||
set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv4.0-java, libopencv4.0-jni")
|
||||
set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv4.0-java, libopencv4.0-jni")
|
||||
set(CPACK_COMPONENT_JAVA_REPLACES "libopencv4.0-java, libopencv4.0-jni")
|
||||
|
||||
set(CPACK_COMPONENT_DOCS_CONFLICTS opencv-doc)
|
||||
set(CPACK_COMPONENT_SAMPLES_CONFLICTS opencv-doc)
|
||||
|
||||
@@ -1117,7 +1117,7 @@ function(ocv_install_3rdparty_licenses library)
|
||||
get_filename_component(name "${filename}" NAME)
|
||||
install(
|
||||
FILES "${filename}"
|
||||
DESTINATION "${OPENCV_OTHER_INSTALL_PATH}/licenses"
|
||||
DESTINATION "${OPENCV_LICENSES_INSTALL_PATH}"
|
||||
COMPONENT licenses
|
||||
RENAME "${library}-${name}"
|
||||
OPTIONAL)
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream arch;
|
||||
std::list<std::string> archs;
|
||||
|
||||
int count = 0;
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)){return -1;}
|
||||
if (count == 0) {return -1;}
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)){ return -1; }
|
||||
if (count == 0) { return -1; }
|
||||
for (int device = 0; device < count; ++device)
|
||||
{
|
||||
cudaDeviceProp prop;
|
||||
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue;}
|
||||
printf("%d.%d ", prop.major, prop.minor);
|
||||
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue; }
|
||||
arch << prop.major << "." << prop.minor;
|
||||
archs.push_back(arch.str());
|
||||
arch.str("");
|
||||
}
|
||||
archs.unique(); #Some devices might have the same arch
|
||||
for (std::list<std::string>::iterator it=archs.begin(); it!=archs.end(); ++it)
|
||||
std::cout << *it << " ";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <vfw.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
AVIFileInit();
|
||||
AVIFileExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTransform.h>
|
||||
#include <vtkMath.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -25,15 +25,9 @@
|
||||
/* AVFoundation video libraries */
|
||||
#cmakedefine HAVE_AVFOUNDATION
|
||||
|
||||
/* V4L capturing support */
|
||||
#cmakedefine HAVE_CAMV4L
|
||||
|
||||
/* V4L2 capturing support */
|
||||
#cmakedefine HAVE_CAMV4L2
|
||||
|
||||
/* Carbon windowing environment */
|
||||
#cmakedefine HAVE_CARBON
|
||||
|
||||
/* AMD's Basic Linear Algebra Subprograms Library*/
|
||||
#cmakedefine HAVE_CLAMDBLAS
|
||||
|
||||
@@ -46,9 +40,6 @@
|
||||
/* Cocoa API */
|
||||
#cmakedefine HAVE_COCOA
|
||||
|
||||
/* C= */
|
||||
#cmakedefine HAVE_CSTRIPES
|
||||
|
||||
/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/
|
||||
#cmakedefine HAVE_CUBLAS
|
||||
|
||||
@@ -95,6 +86,9 @@
|
||||
/* Halide support */
|
||||
#cmakedefine HAVE_HALIDE
|
||||
|
||||
/* Vulkan support */
|
||||
#cmakedefine HAVE_VULKAN
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
@@ -119,9 +113,6 @@
|
||||
/* GDCM DICOM codec */
|
||||
#cmakedefine HAVE_GDCM
|
||||
|
||||
/* V4L/V4L2 capturing support via libv4l */
|
||||
#cmakedefine HAVE_LIBV4L
|
||||
|
||||
/* Microsoft Media Foundation Capture library */
|
||||
#cmakedefine HAVE_MSMF
|
||||
|
||||
@@ -148,6 +139,9 @@
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI2
|
||||
|
||||
/* librealsense library */
|
||||
#cmakedefine HAVE_LIBREALSENSE
|
||||
|
||||
/* PNG codec */
|
||||
#cmakedefine HAVE_PNG
|
||||
|
||||
@@ -163,24 +157,15 @@
|
||||
/* Qt OpenGL support */
|
||||
#cmakedefine HAVE_QT_OPENGL
|
||||
|
||||
/* QuickTime video libraries */
|
||||
#cmakedefine HAVE_QUICKTIME
|
||||
|
||||
/* QTKit video libraries */
|
||||
#cmakedefine HAVE_QTKIT
|
||||
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
/* Ste||ar Group High Performance ParallelX */
|
||||
#cmakedefine HAVE_HPX
|
||||
|
||||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Unicap video capture library */
|
||||
#cmakedefine HAVE_UNICAP
|
||||
|
||||
/* Video for Windows support */
|
||||
#cmakedefine HAVE_VFW
|
||||
|
||||
/* V4L2 capturing support in videoio.h */
|
||||
#cmakedefine HAVE_VIDEOIO
|
||||
|
||||
@@ -220,8 +205,6 @@
|
||||
|
||||
#if defined(HAVE_XINE) || \
|
||||
defined(HAVE_GSTREAMER) || \
|
||||
defined(HAVE_QUICKTIME) || \
|
||||
defined(HAVE_QTKIT) || \
|
||||
defined(HAVE_AVFOUNDATION) || \
|
||||
/*defined(HAVE_OPENNI) || too specialized */ \
|
||||
defined(HAVE_FFMPEG) || \
|
||||
@@ -231,8 +214,6 @@
|
||||
|
||||
#if /*defined(HAVE_XINE) || */\
|
||||
defined(HAVE_GSTREAMER) || \
|
||||
defined(HAVE_QUICKTIME) || \
|
||||
defined(HAVE_QTKIT) || \
|
||||
defined(HAVE_AVFOUNDATION) || \
|
||||
defined(HAVE_FFMPEG) || \
|
||||
defined(HAVE_MSMF)
|
||||
|
||||
@@ -21,6 +21,12 @@ if(DOXYGEN_FOUND)
|
||||
|
||||
set(OPENCV_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0" CACHE STRING "URI to a MathJax installation")
|
||||
|
||||
set(OPENCV_DOCS_EXCLUDE_CUDA ON)
|
||||
if(";${OPENCV_MODULES_EXTRA};" MATCHES ";cudev;")
|
||||
set(OPENCV_DOCS_EXCLUDE_CUDA OFF)
|
||||
list(APPEND CMAKE_DOXYGEN_ENABLED_SECTIONS "CUDA_MODULES")
|
||||
endif()
|
||||
|
||||
# gathering headers
|
||||
set(paths_include)
|
||||
set(paths_doc)
|
||||
@@ -39,6 +45,15 @@ if(DOXYGEN_FOUND)
|
||||
if(EXISTS "${header_dir}")
|
||||
list(APPEND paths_include "${header_dir}")
|
||||
list(APPEND deps ${header_dir})
|
||||
if(OPENCV_DOCS_EXCLUDE_CUDA)
|
||||
if(EXISTS "${OPENCV_MODULE_opencv_${m}_LOCATION}/include/opencv2/${m}/cuda")
|
||||
list(APPEND CMAKE_DOXYGEN_EXCLUDE_LIST "${OPENCV_MODULE_opencv_${m}_LOCATION}/include/opencv2/${m}/cuda")
|
||||
endif()
|
||||
file(GLOB list_cuda_files "${OPENCV_MODULE_opencv_${m}_LOCATION}/include/opencv2/${m}/*cuda*.hpp")
|
||||
if(list_cuda_files)
|
||||
list(APPEND CMAKE_DOXYGEN_EXCLUDE_LIST ${list_cuda_files})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# doc folder
|
||||
set(docs_dir "${OPENCV_MODULE_opencv_${m}_LOCATION}/doc")
|
||||
@@ -125,6 +140,8 @@ if(DOXYGEN_FOUND)
|
||||
# set export variables
|
||||
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_INPUT_LIST "${rootfile} ; ${faqfile} ; ${paths_include} ; ${paths_hal_interface} ; ${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${tutorial_js_path} ; ${paths_tutorial} ; ${tutorial_contrib_root}")
|
||||
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_IMAGE_PATH "${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${tutorial_js_path} ; ${paths_tutorial}")
|
||||
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_EXCLUDE_LIST "${CMAKE_DOXYGEN_EXCLUDE_LIST}")
|
||||
string(REPLACE ";" " " CMAKE_DOXYGEN_ENABLED_SECTIONS "${CMAKE_DOXYGEN_ENABLED_SECTIONS}")
|
||||
# TODO: remove paths_doc from EXAMPLE_PATH after face module tutorials/samples moved to separate folders
|
||||
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_EXAMPLE_PATH "${example_path} ; ${paths_doc} ; ${paths_sample}")
|
||||
set(CMAKE_DOXYGEN_LAYOUT "${CMAKE_CURRENT_BINARY_DIR}/DoxygenLayout.xml")
|
||||
|
||||
@@ -85,7 +85,7 @@ GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
ENABLED_SECTIONS = @CMAKE_DOXYGEN_ENABLED_SECTIONS@
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
@@ -104,9 +104,9 @@ INPUT = @CMAKE_DOXYGEN_INPUT_LIST@
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE = @CMAKE_DOXYGEN_EXCLUDE_LIST@
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = *.inl.hpp *.impl.hpp *_detail.hpp */cudev/**/detail/*.hpp *.m */opencl/runtime/*
|
||||
EXCLUDE_PATTERNS = *.inl.hpp *.impl.hpp *_detail.hpp */cudev/**/detail/*.hpp *.m */opencl/runtime/* */legacy/* *_c.h @DOXYGEN_EXCLUDE_PATTERNS@
|
||||
EXCLUDE_SYMBOLS = cv::DataType<*> cv::traits::* int void CV__* T __CV*
|
||||
EXAMPLE_PATH = @CMAKE_DOXYGEN_EXAMPLE_PATH@
|
||||
EXAMPLE_PATTERNS = *
|
||||
@@ -234,12 +234,17 @@ PREDEFINED = __cplusplus=1 \
|
||||
CV_EXPORTS_W_SIMPLE= \
|
||||
CV_EXPORTS_AS(x)= \
|
||||
CV_EXPORTS_W_MAP= \
|
||||
GAPI_EXPORTS= \
|
||||
GAPI_EXPORTS_W= \
|
||||
CV_IN_OUT= \
|
||||
CV_OUT= \
|
||||
CV_PROP= \
|
||||
CV_PROP_RW= \
|
||||
CV_WRAP= \
|
||||
CV_WRAP_AS(x)= \
|
||||
CV_WRAP_MAPPABLE(x)= \
|
||||
CV_WRAP_PHANTOM(x)= \
|
||||
CV_WRAP_DEFAULT(x)= \
|
||||
CV_CDECL= \
|
||||
CV_Func = \
|
||||
CV_DO_PRAGMA(x)= \
|
||||
|
||||
@@ -1016,20 +1016,25 @@
|
||||
year = {2017},
|
||||
organization = {IEEE}
|
||||
}
|
||||
|
||||
@ARTICLE{gonzalez,
|
||||
title={Digital Image Fundamentals, Digital Imaging Processing},
|
||||
author={Gonzalez, Rafael C and others},
|
||||
year={1987},
|
||||
publisher={Addison Wesley Publishing Company}
|
||||
}
|
||||
|
||||
@ARTICLE{gruzman,
|
||||
title={Цифровая обработка изображений в информационных системах},
|
||||
author={Грузман, И.С. and Киричук, В.С. and Косых, В.П. and Перетягин, Г.И. and Спектор, А.А.},
|
||||
year={2000},
|
||||
publisher={Изд-во НГТУ Новосибирск}
|
||||
}
|
||||
@INPROCEEDINGS{duda2018,
|
||||
title = {Accurate Detection and Localization of Checkerboard Corners for Calibration},
|
||||
year = {2018},
|
||||
booktitle = {29th British Machine Vision Conference. British Machine Vision Conference (BMVC-29), September 3-6, Newcastle, United Kingdom},
|
||||
publisher = {BMVA Press},
|
||||
author = {Alexander Duda and Udo Frese},
|
||||
}
|
||||
|
||||
@book{jahne2000computer,
|
||||
title={Computer vision and applications: a guide for students and practitioners},
|
||||
|
||||
@@ -20,20 +20,20 @@ A simple example on extending C++ functions to Python can be found in official P
|
||||
documentation[1]. So extending all functions in OpenCV to Python by writing their wrapper functions
|
||||
manually is a time-consuming task. So OpenCV does it in a more intelligent way. OpenCV generates
|
||||
these wrapper functions automatically from the C++ headers using some Python scripts which are
|
||||
located in modules/python/src2. We will look into what they do.
|
||||
located in `modules/python/src2`. We will look into what they do.
|
||||
|
||||
First, modules/python/CMakeFiles.txt is a CMake script which checks the modules to be extended to
|
||||
First, `modules/python/CMakeFiles.txt` is a CMake script which checks the modules to be extended to
|
||||
Python. It will automatically check all the modules to be extended and grab their header files.
|
||||
These header files contain list of all classes, functions, constants etc. for that particular
|
||||
modules.
|
||||
|
||||
Second, these header files are passed to a Python script, modules/python/src2/gen2.py. This is the
|
||||
Python bindings generator script. It calls another Python script modules/python/src2/hdr_parser.py.
|
||||
Second, these header files are passed to a Python script, `modules/python/src2/gen2.py`. This is the
|
||||
Python bindings generator script. It calls another Python script `modules/python/src2/hdr_parser.py`.
|
||||
This is the header parser script. This header parser splits the complete header file into small
|
||||
Python lists. So these lists contain all details about a particular function, class etc. For
|
||||
example, a function will be parsed to get a list containing function name, return type, input
|
||||
arguments, argument types etc. Final list contains details of all the functions, structs, classes
|
||||
etc. in that header file.
|
||||
arguments, argument types etc. Final list contains details of all the functions, enums, structs,
|
||||
classes etc. in that header file.
|
||||
|
||||
But header parser doesn't parse all the functions/classes in the header file. The developer has to
|
||||
specify which functions should be exported to Python. For that, there are certain macros added to
|
||||
@@ -44,15 +44,15 @@ macros will be given in next session.
|
||||
|
||||
So header parser returns a final big list of parsed functions. Our generator script (gen2.py) will
|
||||
create wrapper functions for all the functions/classes/enums/structs parsed by header parser (You
|
||||
can find these header files during compilation in the build/modules/python/ folder as
|
||||
can find these header files during compilation in the `build/modules/python/` folder as
|
||||
pyopencv_generated_\*.h files). But there may be some basic OpenCV datatypes like Mat, Vec4i,
|
||||
Size. They need to be extended manually. For example, a Mat type should be extended to Numpy array,
|
||||
Size should be extended to a tuple of two integers etc. Similarly, there may be some complex
|
||||
structs/classes/functions etc. which need to be extended manually. All such manual wrapper functions
|
||||
are placed in modules/python/src2/cv2.cpp.
|
||||
are placed in `modules/python/src2/cv2.cpp`.
|
||||
|
||||
So now only thing left is the compilation of these wrapper files which gives us **cv2** module. So
|
||||
when you call a function, say res = equalizeHist(img1,img2) in Python, you pass two numpy arrays and
|
||||
when you call a function, say `res = equalizeHist(img1,img2)` in Python, you pass two numpy arrays and
|
||||
you expect another numpy array as the output. So these numpy arrays are converted to cv::Mat and
|
||||
then calls the equalizeHist() function in C++. Final result, res will be converted back into a Numpy
|
||||
array. So in short, almost all operations are done in C++ which gives us almost same speed as that
|
||||
@@ -67,19 +67,19 @@ Header parser parse the header files based on some wrapper macros added to funct
|
||||
Enumeration constants don't need any wrapper macros. They are automatically wrapped. But remaining
|
||||
functions, classes etc. need wrapper macros.
|
||||
|
||||
Functions are extended using CV_EXPORTS_W macro. An example is shown below.
|
||||
Functions are extended using `CV_EXPORTS_W` macro. An example is shown below.
|
||||
@code{.cpp}
|
||||
CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
|
||||
@endcode
|
||||
Header parser can understand the input and output arguments from keywords like
|
||||
InputArray, OutputArray etc. But sometimes, we may need to hardcode inputs and outputs. For that,
|
||||
macros like CV_OUT, CV_IN_OUT etc. are used.
|
||||
macros like `CV_OUT`, `CV_IN_OUT` etc. are used.
|
||||
@code{.cpp}
|
||||
CV_EXPORTS_W void minEnclosingCircle( InputArray points,
|
||||
CV_OUT Point2f& center, CV_OUT float& radius );
|
||||
@endcode
|
||||
For large classes also, CV_EXPORTS_W is used. To extend class methods, CV_WRAP is used.
|
||||
Similarly, CV_PROP is used for class fields.
|
||||
For large classes also, `CV_EXPORTS_W` is used. To extend class methods, `CV_WRAP` is used.
|
||||
Similarly, `CV_PROP` is used for class fields.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W CLAHE : public Algorithm
|
||||
{
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
CV_WRAP virtual double getClipLimit() const = 0;
|
||||
}
|
||||
@endcode
|
||||
Overloaded functions can be extended using CV_EXPORTS_AS. But we need to pass a new name so that
|
||||
Overloaded functions can be extended using `CV_EXPORTS_AS`. But we need to pass a new name so that
|
||||
each function will be called by that name in Python. Take the case of integral function below. Three
|
||||
functions are available, so each one is named with a suffix in Python. Similarly CV_WRAP_AS can be
|
||||
functions are available, so each one is named with a suffix in Python. Similarly `CV_WRAP_AS` can be
|
||||
used to wrap overloaded methods.
|
||||
@code{.cpp}
|
||||
//! computes the integral image
|
||||
@@ -107,9 +107,9 @@ CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
|
||||
OutputArray sqsum, OutputArray tilted,
|
||||
int sdepth = -1, int sqdepth = -1 );
|
||||
@endcode
|
||||
Small classes/structs are extended using CV_EXPORTS_W_SIMPLE. These structs are passed by value
|
||||
to C++ functions. Examples are KeyPoint, Match etc. Their methods are extended by CV_WRAP and
|
||||
fields are extended by CV_PROP_RW.
|
||||
Small classes/structs are extended using `CV_EXPORTS_W_SIMPLE`. These structs are passed by value
|
||||
to C++ functions. Examples are `KeyPoint`, `Match` etc. Their methods are extended by `CV_WRAP` and
|
||||
fields are extended by `CV_PROP_RW`.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W_SIMPLE DMatch
|
||||
{
|
||||
@@ -125,8 +125,8 @@ public:
|
||||
CV_PROP_RW float distance;
|
||||
};
|
||||
@endcode
|
||||
Some other small classes/structs can be exported using CV_EXPORTS_W_MAP where it is exported to a
|
||||
Python native dictionary. Moments() is an example of it.
|
||||
Some other small classes/structs can be exported using `CV_EXPORTS_W_MAP` where it is exported to a
|
||||
Python native dictionary. `Moments()` is an example of it.
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W_MAP Moments
|
||||
{
|
||||
@@ -142,6 +142,41 @@ public:
|
||||
So these are the major extension macros available in OpenCV. Typically, a developer has to put
|
||||
proper macros in their appropriate positions. Rest is done by generator scripts. Sometimes, there
|
||||
may be an exceptional cases where generator scripts cannot create the wrappers. Such functions need
|
||||
to be handled manually, to do this write your own pyopencv_*.hpp extending headers and put them into
|
||||
to be handled manually, to do this write your own `pyopencv_*.hpp` extending headers and put them into
|
||||
misc/python subdirectory of your module. But most of the time, a code written according to OpenCV
|
||||
coding guidelines will be automatically wrapped by generator scripts.
|
||||
coding guidelines will be automatically wrapped by generator scripts.
|
||||
|
||||
More advanced cases involves providing Python with additional features that does not exist
|
||||
in the C++ interface such as extra methods, type mappings, or to provide default arguments.
|
||||
We will take `UMat` datatype as an example of such cases later on.
|
||||
First, to provide Python-specific methods, `CV_WRAP_PHANTOM` is utilized in a similar manner to
|
||||
`CV_WRAP`, except that it takes the method header as its argument, and you would need to provide
|
||||
the method body in your own `pyopencv_*.hpp` extension. `UMat::queue()` and `UMat::context()` are
|
||||
an example of such phantom methods that does not exist in C++ interface, but are needed to handle
|
||||
OpenCL functionalities at the Python side.
|
||||
Second, if an already-existing datatype(s) is mappable to your class, it is highly preferable to
|
||||
indicate such capacity using `CV_WRAP_MAPPABLE` with the source type as its argument,
|
||||
rather than crafting your own binding function(s). This is the case of `UMat` which maps from `Mat`.
|
||||
Finally, if a default argument is needed, but it is not provided in the native C++ interface,
|
||||
you can provide it for Python side as the argument of `CV_WRAP_DEFAULT`. As per the `UMat::getMat`
|
||||
example below:
|
||||
@code{.cpp}
|
||||
class CV_EXPORTS_W UMat
|
||||
{
|
||||
public:
|
||||
//! Mat is mappable to UMat.
|
||||
// You would need to provide `static bool cv_mappable_to(const Ptr<Mat>& src, Ptr<UMat>& dst)`
|
||||
CV_WRAP_MAPPABLE(Ptr<Mat>);
|
||||
|
||||
/! returns the OpenCL queue used by OpenCV UMat.
|
||||
// You would need to provide the method body in the binder code
|
||||
CV_WRAP_PHANTOM(static void* queue());
|
||||
|
||||
//! returns the OpenCL context used by OpenCV UMat
|
||||
// You would need to provide the method body in the binder code
|
||||
CV_WRAP_PHANTOM(static void* context());
|
||||
|
||||
//! The wrapped method become equvalent to `get(int flags = ACCESS_RW)`
|
||||
CV_WRAP_AS(get) Mat getMat(int flags CV_WRAP_DEFAULT(ACCESS_RW)) const;
|
||||
};
|
||||
@endcode
|
||||
|
||||
@@ -23,7 +23,7 @@ import cv2 as cv
|
||||
|
||||
img = cv.imread('star.jpg',0)
|
||||
ret,thresh = cv.threshold(img,127,255,0)
|
||||
im2,contours,hierarchy = cv.findContours(thresh, 1, 2)
|
||||
contours,hierarchy = cv.findContours(thresh, 1, 2)
|
||||
|
||||
cnt = contours[0]
|
||||
M = cv.moments(cnt)
|
||||
|
||||
@@ -17,7 +17,7 @@ detection and recognition.
|
||||
|
||||
- For better accuracy, use binary images. So before finding contours, apply threshold or canny
|
||||
edge detection.
|
||||
- Since OpenCV 3.2, findContours() no longer modifies the source image but returns a modified image as the first of three return parameters.
|
||||
- Since OpenCV 3.2, findContours() no longer modifies the source image.
|
||||
- In OpenCV, finding contours is like finding white object from black background. So remember,
|
||||
object to be found should be white and background should be black.
|
||||
|
||||
@@ -29,11 +29,11 @@ import cv2 as cv
|
||||
im = cv.imread('test.jpg')
|
||||
imgray = cv.cvtColor(im, cv.COLOR_BGR2GRAY)
|
||||
ret, thresh = cv.threshold(imgray, 127, 255, 0)
|
||||
im2, contours, hierarchy = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, hierarchy = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
@endcode
|
||||
See, there are three arguments in **cv.findContours()** function, first one is source image, second
|
||||
is contour retrieval mode, third is contour approximation method. And it outputs a modified image, the contours and
|
||||
hierarchy. contours is a Python list of all the contours in the image. Each individual contour is a
|
||||
is contour retrieval mode, third is contour approximation method. And it outputs the contours and hierarchy.
|
||||
Contours is a Python list of all the contours in the image. Each individual contour is a
|
||||
Numpy array of (x,y) coordinates of boundary points of the object.
|
||||
|
||||
@note We will discuss second and third arguments and about hierarchy in details later. Until then,
|
||||
|
||||
@@ -39,7 +39,7 @@ import numpy as np
|
||||
img = cv.imread('star.jpg')
|
||||
img_gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
|
||||
ret,thresh = cv.threshold(img_gray, 127, 255,0)
|
||||
im2,contours,hierarchy = cv.findContours(thresh,2,1)
|
||||
contours,hierarchy = cv.findContours(thresh,2,1)
|
||||
cnt = contours[0]
|
||||
|
||||
hull = cv.convexHull(cnt,returnPoints = False)
|
||||
@@ -93,9 +93,9 @@ img2 = cv.imread('star2.jpg',0)
|
||||
|
||||
ret, thresh = cv.threshold(img1, 127, 255,0)
|
||||
ret, thresh2 = cv.threshold(img2, 127, 255,0)
|
||||
im2,contours,hierarchy = cv.findContours(thresh,2,1)
|
||||
contours,hierarchy = cv.findContours(thresh,2,1)
|
||||
cnt1 = contours[0]
|
||||
im2,contours,hierarchy = cv.findContours(thresh2,2,1)
|
||||
contours,hierarchy = cv.findContours(thresh2,2,1)
|
||||
cnt2 = contours[0]
|
||||
|
||||
ret = cv.matchShapes(cnt1,cnt2,1,0.0)
|
||||
|
||||
@@ -36,7 +36,7 @@ gives us a feature vector containing 64 values. This is the feature vector we us
|
||||
|
||||
Finally, as in the previous case, we start by splitting our big dataset into individual cells. For
|
||||
every digit, 250 cells are reserved for training data and remaining 250 data is reserved for
|
||||
testing. Full code is given below, you also can download it from [here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py):
|
||||
testing. Full code is given below, you also can download it from [here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py):
|
||||
|
||||
@include samples/python/tutorial_code/ml/py_svm_opencv/hogsvm.py
|
||||
|
||||
|
||||
@@ -62,12 +62,11 @@ yum install cmake
|
||||
yum install python-devel numpy
|
||||
yum install gcc gcc-c++
|
||||
@endcode
|
||||
Next we need **GTK** support for GUI features, Camera support (libdc1394, libv4l), Media Support
|
||||
Next we need **GTK** support for GUI features, Camera support (libdc1394, v4l), Media Support
|
||||
(ffmpeg, gstreamer) etc.
|
||||
@code{.sh}
|
||||
yum install gtk2-devel
|
||||
yum install libdc1394-devel
|
||||
yum install libv4l-devel
|
||||
yum install ffmpeg-devel
|
||||
yum install gstreamer-plugins-base-devel
|
||||
@endcode
|
||||
|
||||
@@ -66,12 +66,11 @@ sudo apt-get install python-devel numpy
|
||||
sudo apt-get install gcc gcc-c++
|
||||
```
|
||||
|
||||
Next we need **GTK** support for GUI features, Camera support (libv4l), Media Support
|
||||
Next we need **GTK** support for GUI features, Camera support (v4l), Media Support
|
||||
(ffmpeg, gstreamer) etc.
|
||||
|
||||
```
|
||||
sudo apt-get install gtk2-devel
|
||||
sudo apt-get install libv4l-devel
|
||||
sudo apt-get install ffmpeg-devel
|
||||
sudo apt-get install gstreamer-plugins-base-devel
|
||||
```
|
||||
|
||||
@@ -77,13 +77,13 @@ Source code
|
||||
|
||||
You may also find the source code in the `samples/cpp/tutorial_code/calib3d/camera_calibration/`
|
||||
folder of the OpenCV source library or [download it from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp). The program has a
|
||||
single argument: the name of its configuration file. If none is given then it will try to open the
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp). For the usage of the program, run it with `-h` argument. The program has an
|
||||
essential argument: the name of its configuration file. If none is given then it will try to open the
|
||||
one named "default.xml". [Here's a sample configuration file
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml) in XML format. In the
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml) in XML format. In the
|
||||
configuration file you may choose to use camera as an input, a video file or an image list. If you
|
||||
opt for the last one, you will need to create a configuration file where you enumerate the images to
|
||||
use. Here's [an example of this ](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml).
|
||||
use. Here's [an example of this ](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml).
|
||||
The important part to remember is that the images need to be specified using the absolute path or
|
||||
the relative one from your application's working directory. You may find all this in the samples
|
||||
directory mentioned above.
|
||||
@@ -131,6 +131,8 @@ Explanation
|
||||
Similar images result in similar equations, and similar equations at the calibration step will
|
||||
form an ill-posed problem, so the calibration will fail. For square images the positions of the
|
||||
corners are only approximate. We may improve this by calling the @ref cv::cornerSubPix function.
|
||||
(`winSize` is used to control the side length of the search window. Its default value is 11.
|
||||
`winSzie` may be changed by command line parameter `--winSize=<number>`.)
|
||||
It will produce better calibration result. After this we add a valid inputs result to the
|
||||
*imagePoints* vector to collect all of the equations into a single container. Finally, for
|
||||
visualization feedback purposes we will draw the found points on the input image using @ref
|
||||
@@ -170,7 +172,7 @@ of the calibration variables we'll create these variables here and pass on both
|
||||
calibration and saving function. Again, I'll not show the saving part as that has little in common
|
||||
with the calibration. Explore the source file in order to find out how and what:
|
||||
@snippet samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp run_and_save
|
||||
We do the calibration with the help of the @ref cv::calibrateCamera function. It has the following
|
||||
We do the calibration with the help of the @ref cv::calibrateCameraRO function. It has the following
|
||||
parameters:
|
||||
|
||||
- The object points. This is a vector of *Point3f* vector that for each input image describes how
|
||||
@@ -184,13 +186,33 @@ parameters:
|
||||
@code{.cpp}
|
||||
vector<vector<Point3f> > objectPoints(1);
|
||||
calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern);
|
||||
objectPoints[0][s.boardSize.width - 1].x = objectPoints[0][0].x + grid_width;
|
||||
newObjPoints = objectPoints[0];
|
||||
|
||||
objectPoints.resize(imagePoints.size(),objectPoints[0]);
|
||||
@endcode
|
||||
@note If your calibration board is inaccurate, unmeasured, roughly planar targets (Checkerboard
|
||||
patterns on paper using off-the-shelf printers are the most convenient calibration targets and
|
||||
most of them are not accurate enough.), a method from @cite strobl2011iccv can be utilized to
|
||||
dramatically improve the accuracies of the estimated camera intrinsic parameters. This new
|
||||
calibration method will be called if command line parameter `-d=<number>` is provided. In the
|
||||
above code snippet, `grid_width` is actually the value set by `-d=<number>`. It's the measured
|
||||
distance between top-left (0, 0, 0) and top-right (s.squareSize*(s.boardSize.width-1), 0, 0)
|
||||
corners of the pattern grid points. It should be measured precisely with rulers or vernier calipers.
|
||||
After calibration, newObjPoints will be updated with refined 3D coordinates of object points.
|
||||
- The image points. This is a vector of *Point2f* vector which for each input image contains
|
||||
coordinates of the important points (corners for chessboard and centers of the circles for the
|
||||
circle pattern). We have already collected this from @ref cv::findChessboardCorners or @ref
|
||||
cv::findCirclesGrid function. We just need to pass it on.
|
||||
- The size of the image acquired from the camera, video file or the images.
|
||||
- The index of the object point to be fixed. We set it to -1 to request standard calibration method.
|
||||
If the new object-releasing method to be used, set it to the index of the top-right corner point
|
||||
of the calibration board grid. See cv::calibrateCameraRO for detailed explanation.
|
||||
@code{.cpp}
|
||||
int iFixedPoint = -1;
|
||||
if (release_object)
|
||||
iFixedPoint = s.boardSize.width - 1;
|
||||
@endcode
|
||||
- The camera matrix. If we used the fixed aspect ratio option we need to set \f$f_x\f$:
|
||||
@snippet samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp fixed_aspect
|
||||
- The distortion coefficient matrix. Initialize with zero.
|
||||
@@ -202,11 +224,15 @@ parameters:
|
||||
coordinate space). The 7-th and 8-th parameters are the output vector of matrices containing in
|
||||
the i-th position the rotation and translation vector for the i-th object point to the i-th
|
||||
image point.
|
||||
- The updated output vector of calibration pattern points. This parameter is ignored with standard
|
||||
calibration method.
|
||||
- The final argument is the flag. You need to specify here options like fix the aspect ratio for
|
||||
the focal length, assume zero tangential distortion or to fix the principal point.
|
||||
the focal length, assume zero tangential distortion or to fix the principal point. Here we use
|
||||
CALIB_USE_LU to get faster calibration speed.
|
||||
@code{.cpp}
|
||||
double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix,
|
||||
distCoeffs, rvecs, tvecs, s.flag|CV_CALIB_FIX_K4|CV_CALIB_FIX_K5);
|
||||
rms = calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint,
|
||||
cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints,
|
||||
s.flag | CALIB_USE_LU);
|
||||
@endcode
|
||||
- The function returns the average re-projection error. This number gives a good estimation of
|
||||
precision of the found parameters. This should be as close to zero as possible. Given the
|
||||
|
||||
@@ -13,7 +13,7 @@ Although we get most of our images in a 2D format they do come from a 3D world.
|
||||
|
||||
- @subpage tutorial_camera_calibration
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
*Compatibility:* \> OpenCV 4.0
|
||||
|
||||
*Author:* Bernát Gábor
|
||||
|
||||
|
||||
@@ -33,19 +33,19 @@ Source Code
|
||||
|
||||
@add_toggle_cpp
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/AddingImages/AddingImages.cpp).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/AddingImages/AddingImages.cpp).
|
||||
@include cpp/tutorial_code/core/AddingImages/AddingImages.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/AddingImages/AddingImages.java).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/AddingImages/AddingImages.java).
|
||||
@include java/tutorial_code/core/AddingImages/AddingImages.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
Download the source code from
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/AddingImages/adding_images.py).
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/AddingImages/adding_images.py).
|
||||
@include python/tutorial_code/core/AddingImages/adding_images.py
|
||||
@end_toggle
|
||||
|
||||
@@ -69,7 +69,7 @@ We need two source images (\f$f_{0}(x)\f$ and \f$f_{1}(x)\f$). So, we load them
|
||||
@snippet python/tutorial_code/core/AddingImages/adding_images.py load
|
||||
@end_toggle
|
||||
|
||||
We used the following images: [LinuxLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/LinuxLogo.jpg) and [WindowsLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/WindowsLogo.jpg)
|
||||
We used the following images: [LinuxLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/LinuxLogo.jpg) and [WindowsLogo.jpg](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/WindowsLogo.jpg)
|
||||
|
||||
@warning Since we are *adding* *src1* and *src2*, they both have to be of the same size
|
||||
(width and height) and type.
|
||||
|
||||
@@ -58,7 +58,7 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp
|
||||
@@ -66,7 +66,7 @@ Code
|
||||
|
||||
@add_toggle_java
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/BasicLinearTransformsDemo.java
|
||||
@@ -74,7 +74,7 @@ Code
|
||||
|
||||
@add_toggle_python
|
||||
- **Downloadable code**: Click
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py)
|
||||
|
||||
- The following code performs the operation \f$g(i,j) = \alpha \cdot f(i,j) + \beta\f$ :
|
||||
@include samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py
|
||||
@@ -284,15 +284,15 @@ and are not intended to be used as a replacement of a raster graphics editor!**
|
||||
### Code
|
||||
|
||||
@add_toggle_cpp
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp).
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp).
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/3.4/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/ChangingContrastBrightnessImageDemo.java).
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/java/tutorial_code/ImgProc/changing_contrast_brightness_image/ChangingContrastBrightnessImageDemo.java).
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/3.4/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.py).
|
||||
Code for the tutorial is [here](https://github.com/opencv/opencv/blob/master/samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.py).
|
||||
@end_toggle
|
||||
|
||||
Code for the gamma correction:
|
||||
|
||||
@@ -19,7 +19,7 @@ Source code
|
||||
|
||||
@add_toggle_cpp
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp) or
|
||||
find it in the
|
||||
`samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp` of the
|
||||
OpenCV source code library.
|
||||
@@ -27,7 +27,7 @@ OpenCV source code library.
|
||||
|
||||
@add_toggle_java
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java) or
|
||||
find it in the
|
||||
`samples/java/tutorial_code/core/discrete_fourier_transform/DiscreteFourierTransform.java` of the
|
||||
OpenCV source code library.
|
||||
@@ -35,7 +35,7 @@ OpenCV source code library.
|
||||
|
||||
@add_toggle_python
|
||||
You can [download this from here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py) or
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py) or
|
||||
find it in the
|
||||
`samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py` of the
|
||||
OpenCV source code library.
|
||||
@@ -222,7 +222,7 @@ An application idea would be to determine the geometrical orientation present in
|
||||
example, let us find out if a text is horizontal or not? Looking at some text you'll notice that the
|
||||
text lines sort of form also horizontal lines and the letters form sort of vertical lines. These two
|
||||
main components of a text snippet may be also seen in case of the Fourier transform. Let us use
|
||||
[this horizontal ](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/imageTextN.png) and [this rotated](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/data/imageTextR.png)
|
||||
[this horizontal ](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/imageTextN.png) and [this rotated](https://raw.githubusercontent.com/opencv/opencv/master/samples/data/imageTextR.png)
|
||||
image about a text.
|
||||
|
||||
In case of the horizontal text:
|
||||
|
||||
@@ -2,7 +2,7 @@ File Input and Output using XML and YAML files {#tutorial_file_input_output_with
|
||||
==============================================
|
||||
|
||||
@prev_tutorial{tutorial_discrete_fourier_transform}
|
||||
@next_tutorial{tutorial_interoperability_with_OpenCV_1}
|
||||
@next_tutorial{tutorial_how_to_use_OpenCV_parallel_for_}
|
||||
|
||||
Goal
|
||||
----
|
||||
@@ -19,7 +19,7 @@ Source code
|
||||
-----------
|
||||
|
||||
You can [download this from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp) or find it in the
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp) or find it in the
|
||||
`samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp` of the OpenCV source code
|
||||
library.
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ three major ways of going through an image pixel by pixel. To make things a litt
|
||||
will make the scanning for each image using all of these methods, and print out how long it took.
|
||||
|
||||
You can download the full source code [here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp) or look it up in
|
||||
](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp) or look it up in
|
||||
the samples directory of OpenCV at the cpp tutorial code for the core section. Its basic usage is:
|
||||
@code{.bash}
|
||||
how_to_scan_images imageName.jpg intValueToReduce [G]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_}
|
||||
==================================================================
|
||||
|
||||
@prev_tutorial{tutorial_interoperability_with_OpenCV_1}
|
||||
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
|
||||
|
||||
Goal
|
||||
----
|
||||
@@ -9,7 +9,7 @@ Goal
|
||||
The goal of this tutorial is to show you how to use the OpenCV `parallel_for_` framework to easily
|
||||
parallelize your code. To illustrate the concept, we will write a program to draw a Mandelbrot set
|
||||
exploiting almost all the CPU load available.
|
||||
The full tutorial code is [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
The full tutorial code is [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
If you want more information about multithreading, you will have to refer to a reference book or course as this tutorial is intended
|
||||
to remain simple.
|
||||
|
||||
@@ -177,7 +177,7 @@ C++ 11 standard allows to simplify the parallel implementation by get rid of the
|
||||
Results
|
||||
-----------
|
||||
|
||||
You can find the full tutorial code [here](https://github.com/opencv/opencv/blob/3.4/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
You can find the full tutorial code [here](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp).
|
||||
The performance of the parallel implementation depends of the type of CPU you have. For instance, on 4 cores / 8 threads
|
||||
CPU, you can expect a speed-up of around 6.9X. There are many factors to explain why we do not achieve a speed-up of almost 8X.
|
||||
Main reasons should be mostly due to:
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,143 +0,0 @@
|
||||
Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
|
||||
==============================
|
||||
|
||||
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
|
||||
@next_tutorial{tutorial_how_to_use_OpenCV_parallel_for_}
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
For the OpenCV developer team it's important to constantly improve the library. We are constantly
|
||||
thinking about methods that will ease your work process, while still maintain the libraries
|
||||
flexibility. The new C++ interface is a development of us that serves this goal. Nevertheless,
|
||||
backward compatibility remains important. We do not want to break your code written for earlier
|
||||
version of the OpenCV library. Therefore, we made sure that we add some functions that deal with
|
||||
this. In the following you'll learn:
|
||||
|
||||
- What changed with the version 2 of OpenCV in the way you use the library compared to its first
|
||||
version
|
||||
- How to add some Gaussian noise to an image
|
||||
- What are lookup tables and why use them?
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
When making the switch you first need to learn some about the new data structure for images:
|
||||
@ref tutorial_mat_the_basic_image_container, this replaces the old *CvMat* and *IplImage* ones. Switching to the new
|
||||
functions is easier. You just need to remember a couple of new things.
|
||||
|
||||
OpenCV 2 received reorganization. No longer are all the functions crammed into a single library. We
|
||||
have many modules, each of them containing data structures and functions relevant to certain tasks.
|
||||
This way you do not need to ship a large library if you use just a subset of OpenCV. This means that
|
||||
you should also include only those headers you will use. For example:
|
||||
@code{.cpp}
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
@endcode
|
||||
All the OpenCV related stuff is put into the *cv* namespace to avoid name conflicts with other
|
||||
libraries data structures and functions. Therefore, either you need to prepend the *cv::* keyword
|
||||
before everything that comes from OpenCV or after the includes, you just add a directive to use
|
||||
this:
|
||||
@code{.cpp}
|
||||
using namespace cv; // The new C++ interface API is inside this namespace. Import it.
|
||||
@endcode
|
||||
Because the functions are already in a namespace there is no need for them to contain the *cv*
|
||||
prefix in their name. As such all the new C++ compatible functions don't have this and they follow
|
||||
the camel case naming rule. This means the first letter is small (unless it's a name, like Canny)
|
||||
and the subsequent words start with a capital letter (like *copyMakeBorder*).
|
||||
|
||||
Now, remember that you need to link to your application all the modules you use, and in case you are
|
||||
on Windows using the *DLL* system you will need to add, again, to the path all the binaries. For
|
||||
more in-depth information if you're on Windows read @ref tutorial_windows_visual_studio_opencv and for
|
||||
Linux an example usage is explained in @ref tutorial_linux_eclipse.
|
||||
|
||||
Now for converting the *Mat* object you can use either the *IplImage* or the *CvMat* operators.
|
||||
While in the C interface you used to work with pointers here it's no longer the case. In the C++
|
||||
interface we have mostly *Mat* objects. These objects may be freely converted to both *IplImage* and
|
||||
*CvMat* with simple assignment. For example:
|
||||
@code{.cpp}
|
||||
Mat I;
|
||||
IplImage pI = I;
|
||||
CvMat mI = I;
|
||||
@endcode
|
||||
Now if you want pointers the conversion gets just a little more complicated. The compilers can no
|
||||
longer automatically determinate what you want and as you need to explicitly specify your goal. This
|
||||
is to call the *IplImage* and *CvMat* operators and then get their pointers. For getting the pointer
|
||||
we use the & sign:
|
||||
@code{.cpp}
|
||||
Mat I;
|
||||
IplImage* pI = &I.operator IplImage();
|
||||
CvMat* mI = &I.operator CvMat();
|
||||
@endcode
|
||||
One of the biggest complaints of the C interface is that it leaves all the memory management to you.
|
||||
You need to figure out when it is safe to release your unused objects and make sure you do so before
|
||||
the program finishes or you could have troublesome memory leaks. To work around this issue in OpenCV
|
||||
there is introduced a sort of smart pointer. This will automatically release the object when it's no
|
||||
longer in use. To use this declare the pointers as a specialization of the *Ptr* :
|
||||
@code{.cpp}
|
||||
Ptr<IplImage> piI = &I.operator IplImage();
|
||||
@endcode
|
||||
Converting from the C data structures to the *Mat* is done by passing these inside its constructor.
|
||||
For example:
|
||||
@code{.cpp}
|
||||
Mat K(piL), L;
|
||||
L = Mat(pI);
|
||||
@endcode
|
||||
|
||||
A case study
|
||||
------------
|
||||
|
||||
Now that you have the basics done [here's](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
an example that mixes the usage of the C interface with the C++ one. You will also find it in the
|
||||
sample directory of the OpenCV source code library at the
|
||||
`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp` .
|
||||
To further help on seeing the difference the programs supports two modes: one mixed C and C++ and
|
||||
one pure C++. If you define the *DEMO_MIXED_API_USE* you'll end up using the first. The program
|
||||
separates the color planes, does some modifications on them and in the end merge them back together.
|
||||
|
||||
@snippet interoperability_with_OpenCV_1.cpp head
|
||||
@snippet interoperability_with_OpenCV_1.cpp start
|
||||
|
||||
Here you can observe that with the new structure we have no pointer problems, although it is
|
||||
possible to use the old functions and in the end just transform the result to a *Mat* object.
|
||||
|
||||
@snippet interoperability_with_OpenCV_1.cpp new
|
||||
|
||||
Because, we want to mess around with the images luma component we first convert from the default BGR
|
||||
to the YUV color space and then split the result up into separate planes. Here the program splits:
|
||||
in the first example it processes each plane using one of the three major image scanning algorithms
|
||||
in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the
|
||||
image some Gaussian noise and then mix together the channels according to some formula.
|
||||
|
||||
The scanning version looks like:
|
||||
|
||||
@snippet interoperability_with_OpenCV_1.cpp scanning
|
||||
|
||||
Here you can observe that we may go through all the pixels of an image in three fashions: an
|
||||
iterator, a C pointer and an individual element access style. You can read a more in-depth
|
||||
description of these in the @ref tutorial_how_to_scan_images tutorial. Converting from the old function
|
||||
names is easy. Just remove the cv prefix and use the new *Mat* data structure. Here's an example of
|
||||
this by using the weighted addition function:
|
||||
|
||||
@snippet interoperability_with_OpenCV_1.cpp noisy
|
||||
|
||||
As you may observe the *planes* variable is of type *Mat*. However, converting from *Mat* to
|
||||
*IplImage* is easy and made automatically with a simple assignment operator.
|
||||
|
||||
@snippet interoperability_with_OpenCV_1.cpp end
|
||||
|
||||
The new *imshow* highgui function accepts both the *Mat* and *IplImage* data structures. Compile and
|
||||
run the program and if the first image below is your input you may get either the first or second as
|
||||
output:
|
||||
|
||||

|
||||
|
||||
You may observe a runtime instance of this on the [YouTube
|
||||
here](https://www.youtube.com/watch?v=qckm-zvo31w) and you can [download the source code from here
|
||||
](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
or find it in the
|
||||
`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp`
|
||||
of the OpenCV source code library.
|
||||
|
||||
@youtube{qckm-zvo31w}
|
||||
@@ -33,7 +33,7 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp`.
|
||||
@include samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp
|
||||
@@ -41,7 +41,7 @@ OpenCV source code libraries sample directory at
|
||||
|
||||
@add_toggle_java
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java`.
|
||||
@include samples/java/tutorial_code/core/mat_mask_operations/MatMaskOperations.java
|
||||
@@ -49,7 +49,7 @@ OpenCV source code libraries sample directory at
|
||||
|
||||
@add_toggle_python
|
||||
You can download this source code from [here
|
||||
](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py) or look in the
|
||||
](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py) or look in the
|
||||
OpenCV source code libraries sample directory at
|
||||
`samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py`.
|
||||
@include samples/python/tutorial_code/core/mat_mask_operations/mat_mask_operations.py
|
||||
|
||||
@@ -150,11 +150,12 @@ If we need to copy the data, this is done using, for example, cv::Mat::copyTo or
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Reference counting 2
|
||||
@end_toggle
|
||||
|
||||
To the contrary with C API where an output image had to be created by the developer, an empty output Mat
|
||||
can be supplied to each function. Each implementation calls Mat::create for a destination matrix.
|
||||
This method allocates data for a matrix if it is empty. If it is not empty and has the correct size
|
||||
and type, the method does nothing. If however, size or type are different from the input arguments, the
|
||||
data is deallocated (and lost) and a new data is allocated. For example:
|
||||
An empty output Mat can be supplied to each function.
|
||||
Each implementation calls Mat::create for a destination matrix.
|
||||
This method allocates data for a matrix if it is empty.
|
||||
If it is not empty and has the correct size and type, the method does nothing.
|
||||
If however, size or type are different from the input arguments, the data is deallocated (and lost) and a new data is allocated.
|
||||
For example:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp Reference counting 3
|
||||
@@ -199,12 +200,6 @@ Selecting a region of interest:
|
||||
@snippet samples/python/tutorial_code/core/mat_operations/mat_operations.py Select ROI
|
||||
@end_toggle
|
||||
|
||||
A conversion from Mat to C API data structures (**C++ only**):
|
||||
|
||||
@snippet samples/cpp/tutorial_code/core/mat_operations/mat_operations.cpp C-API conversion
|
||||
|
||||
Note that there is no data copying here.
|
||||
|
||||
Conversion from color to greyscale:
|
||||
|
||||
@add_toggle_cpp
|
||||
|
||||
@@ -262,7 +262,7 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||

|
||||
|
||||
Most of the samples here have been included in a small console application. You can download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
or in the core section of the cpp samples.
|
||||
|
||||
You can also find a quick video demonstration of this on
|
||||
|
||||
@@ -82,17 +82,6 @@ understanding how to manipulate the images on a pixel level.
|
||||
You will see how to use the @ref cv::FileStorage data structure of OpenCV to write and read
|
||||
data to XML or YAML file format.
|
||||
|
||||
- @subpage tutorial_interoperability_with_OpenCV_1
|
||||
|
||||
*Compatibility:* \> OpenCV 2.0
|
||||
|
||||
*Author:* Bernát Gábor
|
||||
|
||||
Did you used OpenCV before its 2.0 version? Do you wanna know what happened with your library
|
||||
with 2.0? Don't you know how to convert your old OpenCV programs to the new C++ interface?
|
||||
Look here to shed light on all this questions.
|
||||
|
||||
|
||||
- @subpage tutorial_how_to_use_OpenCV_parallel_for_
|
||||
|
||||
*Compatibility:* \>= OpenCV 2.4.3
|
||||
|
||||
@@ -216,7 +216,7 @@ a centric one.
|
||||
@snippet dnn/edge_detection.py Register
|
||||
|
||||
That's it! We've replaced an implemented OpenCV's layer to a custom one.
|
||||
You may find a full script in the [source code](https://github.com/opencv/opencv/tree/3.4/samples/dnn/edge_detection.py).
|
||||
You may find a full script in the [source code](https://github.com/opencv/opencv/tree/master/samples/dnn/edge_detection.py).
|
||||
|
||||
<table border="0">
|
||||
<tr>
|
||||
|
||||
@@ -13,7 +13,7 @@ We will demonstrate results of this example on the following picture.
|
||||
Source Code
|
||||
-----------
|
||||
|
||||
We will be using snippets from the example application, that can be downloaded [here](https://github.com/opencv/opencv/blob/3.4/samples/dnn/classification.cpp).
|
||||
We will be using snippets from the example application, that can be downloaded [here](https://github.com/opencv/opencv/blob/master/samples/dnn/classification.cpp).
|
||||
|
||||
@include dnn/classification.cpp
|
||||
|
||||
@@ -25,7 +25,7 @@ Explanation
|
||||
[bvlc_googlenet.caffemodel](http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel)
|
||||
|
||||
Also you need file with names of [ILSVRC2012](http://image-net.org/challenges/LSVRC/2012/browse-synsets) classes:
|
||||
[classification_classes_ILSVRC2012.txt](https://github.com/opencv/opencv/tree/3.4/samples/dnn/classification_classes_ILSVRC2012.txt).
|
||||
[classification_classes_ILSVRC2012.txt](https://github.com/opencv/opencv/tree/master/samples/dnn/classification_classes_ILSVRC2012.txt).
|
||||
|
||||
Put these files into working dir of this program example.
|
||||
|
||||
|
||||
@@ -68,8 +68,6 @@ MSBuild.exe /m:4 /t:Build /p:Configuration=Release .\\ALL_BUILD.vcxproj
|
||||
## Build OpenCV with Halide backend
|
||||
When you build OpenCV add the following configuration flags:
|
||||
|
||||
- `ENABLE_CXX11` - enable C++11 standard
|
||||
|
||||
- `WITH_HALIDE` - enable Halide linkage
|
||||
|
||||
- `HALIDE_ROOT_DIR` - path to Halide build directory
|
||||
|
||||
@@ -19,8 +19,8 @@ Source Code
|
||||
-----------
|
||||
|
||||
Use a universal sample for object detection models written
|
||||
[in C++](https://github.com/opencv/opencv/blob/3.4/samples/dnn/object_detection.cpp) and
|
||||
[in Python](https://github.com/opencv/opencv/blob/3.4/samples/dnn/object_detection.py) languages
|
||||
[in C++](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.cpp) and
|
||||
[in Python](https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.py) languages
|
||||
|
||||
Usage examples
|
||||
--------------
|
||||
|
||||
@@ -32,7 +32,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_cpp
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/features2D/AKAZE_match.cpp)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/features2D/AKAZE_match.cpp)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/cpp/tutorial_code/features2D/AKAZE_match.cpp
|
||||
@@ -40,7 +40,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_java
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/java/tutorial_code/features2D/akaze_matching/AKAZEMatchDemo.java
|
||||
@@ -48,7 +48,7 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
|
||||
|
||||
@add_toggle_python
|
||||
- **Downloadable code**: Click
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py)
|
||||
[here](https://raw.githubusercontent.com/opencv/opencv/master/samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py)
|
||||
|
||||
- **Code at glance:**
|
||||
@include samples/python/tutorial_code/features2D/akaze_matching/AKAZE_match.py
|
||||
|
||||
@@ -24,19 +24,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_description/SURF_matching_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_description/SURFMatchingDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_description/SURF_matching_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_detection/SURF_detection_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -45,19 +45,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_flann_matcher/SURFFLANNMatchingDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_flann_matcher/SURF_FLANN_matching_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java)
|
||||
@include samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py)
|
||||
@include samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ For detailed explanations about the theory, please refer to a computer vision co
|
||||
* An Invitation to 3-D Vision: From Images to Geometric Models, @cite Ma:2003:IVI
|
||||
* Computer Vision: Algorithms and Applications, @cite RS10
|
||||
|
||||
The tutorial code can be found [here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/features2D/Homography).
|
||||
The images used in this tutorial can be found [here](https://github.com/opencv/opencv/tree/3.4/samples/data) (`left*.jpg`).
|
||||
The tutorial code can be found [here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/Homography).
|
||||
The images used in this tutorial can be found [here](https://github.com/opencv/opencv/tree/master/samples/data) (`left*.jpg`).
|
||||
|
||||
Basic theory {#tutorial_homography_Basic_theory}
|
||||
------------
|
||||
|
||||
@@ -17,19 +17,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/corner_subpixels/cornerSubPix_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp)
|
||||
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java)
|
||||
|
||||
@include samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py)
|
||||
|
||||
@include samples/python/tutorial_code/TrackingMotion/generic_corner_detector/cornerDetector_Demo.py
|
||||
@end_toggle
|
||||
|
||||
@@ -16,19 +16,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/good_features_to_track/goodFeaturesToTrack_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -120,19 +120,19 @@ Code
|
||||
|
||||
@add_toggle_cpp
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp)
|
||||
@include samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java)
|
||||
@include samples/java/tutorial_code/TrackingMotion/harris_detector/CornerHarrisDemo.java
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py)
|
||||
[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py)
|
||||
@include samples/python/tutorial_code/TrackingMotion/harris_detector/cornerHarris_Demo.py
|
||||
@end_toggle
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 173 KiB |
@@ -0,0 +1,411 @@
|
||||
# Porting anisotropic image segmentation on G-API {#tutorial_gapi_anisotropic_segmentation}
|
||||
|
||||
[TOC]
|
||||
|
||||
# Introduction {#gapi_anisotropic_intro}
|
||||
|
||||
In this tutorial you will learn:
|
||||
* How an existing algorithm can be transformed into a G-API
|
||||
computation (graph);
|
||||
* How to inspect and profile G-API graphs;
|
||||
* How to customize graph execution without changing its code.
|
||||
|
||||
This tutorial is based on @ref
|
||||
tutorial_anisotropic_image_segmentation_by_a_gst.
|
||||
|
||||
# Quick start: using OpenCV backend {#gapi_anisotropic_start}
|
||||
|
||||
Before we start, let's review the original algorithm implementation:
|
||||
|
||||
@include cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp
|
||||
|
||||
## Examining calcGST() {#gapi_anisotropic_calcgst}
|
||||
|
||||
The function calcGST() is clearly an image processing pipeline:
|
||||
* It is just a sequence of operations over a number of cv::Mat;
|
||||
* No logic (conditionals) and loops involved in the code;
|
||||
* All functions operate on 2D images (like cv::Sobel, cv::multiply,
|
||||
cv::boxFilter, cv::sqrt, etc).
|
||||
|
||||
Considering the above, calcGST() is a great candidate to start
|
||||
with. In the original code, its prototype is defined like this:
|
||||
|
||||
@snippet cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp calcGST_proto
|
||||
|
||||
With G-API, we can define it as follows:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp calcGST_proto
|
||||
|
||||
It is important to understand that the new G-API based version of
|
||||
calcGST() will just produce a compute graph, in contrast to its
|
||||
original version, which actually calculates the values. This is a
|
||||
principial difference -- G-API based functions like this are used to
|
||||
construct graphs, not to process the actual data.
|
||||
|
||||
Let's start implementing calcGST() with calculation of \f$J\f$
|
||||
matrix. This is how the original code looks like:
|
||||
|
||||
@snippet cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp calcJ_header
|
||||
|
||||
Here we need to declare output objects for every new operation (see
|
||||
img as a result for cv::Mat::convertTo, imgDiffX and others as results for
|
||||
cv::Sobel and cv::multiply).
|
||||
|
||||
The G-API analogue is listed below:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp calcGST_header
|
||||
|
||||
This snippet demonstrates the following syntactic difference between
|
||||
G-API and traditional OpenCV:
|
||||
* All standard G-API functions are by default placed in "cv::gapi"
|
||||
namespace;
|
||||
* G-API operations _return_ its results -- there's no need to pass
|
||||
extra "output" parameters to the functions.
|
||||
|
||||
Note -- this code is also using `auto` -- types of intermediate objects
|
||||
like `img`, `imgDiffX`, and so on are inferred automatically by the
|
||||
C++ compiler. In this example, the types are determined by G-API
|
||||
operation return values which all are cv::GMat.
|
||||
|
||||
G-API standard kernels are trying to follow OpenCV API conventions
|
||||
whenever possible -- so cv::gapi::sobel takes the same arguments as
|
||||
cv::Sobel, cv::gapi::mul follows cv::multiply, and so on (except
|
||||
having a return value).
|
||||
|
||||
The rest of calcGST() function can be implemented the same
|
||||
way trivially. Below is its full source code:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp calcGST
|
||||
|
||||
## Running G-API graph {#gapi_anisotropic_running}
|
||||
|
||||
After calcGST() is defined in G-API language, we can construct a graph
|
||||
based on it and finally run it -- pass input image and obtain
|
||||
result. Before we do it, let's have a look how original code looked
|
||||
like:
|
||||
|
||||
@snippet cpp/tutorial_code/ImgProc/anisotropic_image_segmentation/anisotropic_image_segmentation.cpp main_extra
|
||||
|
||||
G-API-based functions like calcGST() can't be applied to input data
|
||||
directly, since it is a _construction_ code, not the _processing_ code.
|
||||
In order to _run_ computations, a special object of class
|
||||
cv::GComputation needs to be created. This object wraps our G-API code
|
||||
(which is a composition of G-API data and operations) into a callable
|
||||
object, similar to C++11
|
||||
[std::function<>](https://en.cppreference.com/w/cpp/utility/functional/function).
|
||||
|
||||
cv::GComputation class has a number of constructors which can be used
|
||||
to define a graph. Generally, user needs to pass graph boundaries
|
||||
-- _input_ and _output_ objects, on which a GComputation is
|
||||
defined. Then G-API analyzes the call flow from _outputs_ to _inputs_
|
||||
and reconstructs the graph with operations in-between the specified
|
||||
boundaries. This may sound complex, however in fact the code looks
|
||||
like this:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp main
|
||||
|
||||
Note that this code slightly changes from the original one: forming up
|
||||
the resulting image is also a part of the pipeline (done with
|
||||
cv::gapi::addWeighted). Normalization of orientation and coherency
|
||||
images is still done by traditional OpenCV (using cv::normalize) as
|
||||
G-API doesn't provide such kernel at the moment.
|
||||
|
||||
Result of this G-API pipeline bit-exact matches the original one
|
||||
(given the same input image):
|
||||
|
||||

|
||||
|
||||
## G-API initial version: full listing {#gapi_anisotropic_ocv}
|
||||
|
||||
Below is the full listing of the initial anisotropic image
|
||||
segmentation port on G-API:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp full_sample
|
||||
|
||||
# Inspecting the initial version {#gapi_anisotropic_inspect}
|
||||
|
||||
After we have got the initial working version of our algorithm working
|
||||
with G-API, we can use it to inspect and learn how G-API works. This
|
||||
chapter covers two aspects: understanding the graph structure, and
|
||||
memory profiling.
|
||||
|
||||
## Understanding the graph structure {#gapi_anisotropic_inspect_graph}
|
||||
|
||||
G-API stands for "Graph API", but did you mention any graphs in the
|
||||
above example? It was one of the initial design goals -- G-API was
|
||||
designed with expressions in mind to make adoption and porting process
|
||||
more straightforward. People _usually_ don't think in terms of
|
||||
_Nodes_ and _Edges_ when writing ordinary code, and so G-API, while
|
||||
being a Graph API, doesn't force its users to do that.
|
||||
|
||||
However, a graph is still built implicitly when a cv::GComputation
|
||||
object is defined. It may be useful to inspect how the resulting graph
|
||||
looks like to check if it is generated correctly and if it really
|
||||
represents our alrogithm. It is also useful to learn the structure of
|
||||
the graph to see if it has any redundancies.
|
||||
|
||||
G-API allows to dump generated graphs to `.dot` files which then
|
||||
could be visualized with [Graphviz](https://www.graphviz.org/), a
|
||||
popular open graph visualization software.
|
||||
|
||||
<!-- TODO THIS VARIABLE NEEDS TO BE FIXED TO DUMP DIR ASAP! -->
|
||||
|
||||
In order to dump our graph to a `.dot` file, set `GRAPH_DUMP_PATH` to a
|
||||
file name before running the application, e.g.:
|
||||
|
||||
$ GRAPH_DUMP_PATH=segm.dot ./bin/example_tutorial_porting_anisotropic_image_segmentation_gapi
|
||||
|
||||
Now this file can be visalized with a `dot` command like this:
|
||||
|
||||
$ dot segm.dot -Tpng -o segm.png
|
||||
|
||||
or viewed instantly with `xdot` command (please refer to your
|
||||
distribution/operating system documentation on how to install these
|
||||
packages).
|
||||
|
||||

|
||||
|
||||
The above diagram demonstrates a number of interesting aspects of
|
||||
G-API's internal algorithm representation:
|
||||
1. G-API underlying graph is a bipartite graph: it consists of
|
||||
_Operation_ and _Data_ nodes such that a _Data_ node can only be
|
||||
connected to an _Operation_ node, _Operation_ node can only be
|
||||
connected to a _Data_ node, and nodes of a single kind are never
|
||||
connected directly.
|
||||
2. Graph is directed - every edge in the graph has a direction.
|
||||
3. Graph "begins" and "ends" with a _Data_ kind of nodes.
|
||||
4. A _Data_ node can have only a single writer and multiple readers.
|
||||
5. An _Operation_ node may have multiple inputs, though every input
|
||||
must have an unique _port number_ (among inputs).
|
||||
6. An _Operation_ node may have multiple outputs, and every output
|
||||
must have an unique _port number_ (among outputs).
|
||||
|
||||
## Measuring memory footprint {#gapi_anisotropic_memory_ocv}
|
||||
|
||||
Let's measure and compare memory footprint of the algorithm in its two
|
||||
versions: G-API-based and OpenCV-based. At the moment, G-API version
|
||||
is also OpenCV-based since it fallbacks to OpenCV functions inside.
|
||||
|
||||
On GNU/Linux, application memory footprint can be profiled with
|
||||
[Valgrind](http://valgrind.org/). On Debian/Ubuntu systems it can be
|
||||
installed like this (assuming you have administrator priveleges):
|
||||
|
||||
$ sudo apt-get install valgrind massif-visualizer
|
||||
|
||||
Once installed, we can collect memory profiles easily for our two
|
||||
algorithm versions:
|
||||
|
||||
$ valgrind --tool=massif --massif-out-file=ocv.out ./bin/example_tutorial_anisotropic_image_segmentation
|
||||
==6101== Massif, a heap profiler
|
||||
==6101== Copyright (C) 2003-2015, and GNU GPL'd, by Nicholas Nethercote
|
||||
==6101== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
|
||||
==6101== Command: ./bin/example_tutorial_anisotropic_image_segmentation
|
||||
==6101==
|
||||
==6101==
|
||||
$ valgrind --tool=massif --massif-out-file=gapi.out ./bin/example_tutorial_porting_anisotropic_image_segmentation_gapi
|
||||
==6117== Massif, a heap profiler
|
||||
==6117== Copyright (C) 2003-2015, and GNU GPL'd, by Nicholas Nethercote
|
||||
==6117== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
|
||||
==6117== Command: ./bin/example_tutorial_porting_anisotropic_image_segmentation_gapi
|
||||
==6117==
|
||||
==6117==
|
||||
|
||||
Once done, we can inspect the collected profiles with
|
||||
[Massif Visualizer](@https://github.com/KDE/massif-visualizer)
|
||||
(installed in the above step).
|
||||
|
||||
Below is the visualized memory profile of the original OpenCV version
|
||||
of the algorithm:
|
||||
|
||||

|
||||
|
||||
We see that memory is allocated as the application
|
||||
executes, reaching its peak in the calcGST() function; then the
|
||||
footprint drops as calcGST() completes its execution and all temporary
|
||||
buffers are freed. Massif reports us peak memory consumption of 7.6 MiB.
|
||||
|
||||
Now let's have a look on the profile of G-API version:
|
||||
|
||||

|
||||
|
||||
Once G-API computation is created and its execution starts, G-API
|
||||
allocates all required memory at once and then the memory profile
|
||||
remains flat until the termination of the program. Massif reports us
|
||||
peak memory consumption of 10.6 MiB.
|
||||
|
||||
A reader may ask a right question at this point -- is G-API that bad?
|
||||
What is the reason in using it than?
|
||||
|
||||
Hopefully, it is not. The reason why we see here an increased memory
|
||||
consumption is because the default naive OpenCV-based backend is used to
|
||||
execute this graph. This backend serves mostly for quick prototyping
|
||||
and debugging algorithms before offload/further optimization.
|
||||
|
||||
This backend doesn't utilize any complex memory mamagement strategies yet
|
||||
since it is not its point at the moment. In the following chapter,
|
||||
we'll learn about Fluid backend and see how the same G-API code can
|
||||
run in a completely different model (and the footprint shrinked to a
|
||||
number of kilobytes).
|
||||
|
||||
# Backends and kernels {#gapi_anisotropic_backends}
|
||||
|
||||
This chapter covers how a G-API computation can be executed in a
|
||||
special way -- e.g. offloaded to another device, or scheduled with a
|
||||
special intelligence. G-API is designed to make its graphs portable --
|
||||
it means that once a graph is defined in G-API terms, no changes
|
||||
should be required in it if we want to run it on CPU or on GPU or on
|
||||
both devices at once. [G-API High-level overview](@ref gapi_hld) and
|
||||
[G-API Kernel API](@ref gapi_kernel_api) shed more light on technical
|
||||
details which make it possible. In this chapter, we will utilize G-API
|
||||
Fluid backend to make our graph cache-efficient on CPU.
|
||||
|
||||
G-API defines _backend_ as the lower-level entity which knows how to
|
||||
run kernels. Backends may have (and, in fact, do have) different
|
||||
_Kernel APIs_ which are used to program and integrate kernels for that
|
||||
backends. In this context, _kernel_ is an implementaion of an
|
||||
_operation_, which is defined on the top API level (see
|
||||
G_TYPED_KERNEL() macro).
|
||||
|
||||
Backend is a thing which is aware of device & platform specifics, and
|
||||
which executes its kernels with keeping that specifics in mind. For
|
||||
example, there may be [Halide](http://halide-lang.org/) backend which
|
||||
allows to write (implement) G-API operations in Halide language and
|
||||
then generate functional Halide code for portions of G-API graph which
|
||||
map well there.
|
||||
|
||||
## Running a graph with a Fluid backend {#gapi_anisotropic_fluid}
|
||||
|
||||
OpenCV 4.0 is bundled with two G-API backends -- the default "OpenCV"
|
||||
which we just used, and a special "Fluid" backend.
|
||||
|
||||
Fluid backend reorganizes the execution to save memory and to achieve
|
||||
near-perfect cache locality, implementing so-called "streaming" model
|
||||
of execution.
|
||||
|
||||
In order to start using Fluid kernels, we need first to include
|
||||
appropriate header files (which are not included by default):
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi_fluid.cpp fluid_includes
|
||||
|
||||
Once these headers are included, we can form up a new _kernel package_
|
||||
and specify it to G-API:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi_fluid.cpp kernel_pkg
|
||||
|
||||
In G-API, kernels (or operation implementations) are objects. Kernels are
|
||||
organized into collections, or _kernel packages_, represented by class
|
||||
cv::gapi::GKernelPackage. The main purpose of a kernel package is to
|
||||
capture which kernels we would like to use in our graph, and pass it
|
||||
as a _graph compilation option_:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi_fluid.cpp kernel_pkg_use
|
||||
|
||||
Traditional OpenCV is logically divided into modules, whith every
|
||||
module providing a set of functions. In G-API, there are also
|
||||
"modules" which are represented as kernel packages provided by a
|
||||
particular backend. In this example, we pass Fluid kernel packages to
|
||||
G-API to utilize appropriate Fluid functions in our graph.
|
||||
|
||||
Kernel packages are combinable -- in the above example, we take "Core"
|
||||
and "ImgProc" Fluid kernel packages and combine it into a single
|
||||
one. See documentation reference on cv::gapi::combine and
|
||||
cv::unite_policy on package combination options.
|
||||
|
||||
If no kernel packages are specified in options, G-API is using
|
||||
_default_ package which consists of default OpenCV implementations and
|
||||
thus G-API graphs are executed via OpenCV functions by default. OpenCV
|
||||
backend provides broader functional coverage than any other
|
||||
backend. If a kernel package is specified, like in this example, then
|
||||
it is being combined with the _default_ one with
|
||||
cv::unite_policy::REPLACE. It means that user-specified
|
||||
implementations will replace default implementations in case of
|
||||
conflict.
|
||||
|
||||
Kernel packages may contain a mix of kernels, in particular, multiple
|
||||
implementations of the same kernel. For example, a single kernel
|
||||
package may contain both OpenCV and Fluid implementations of kernel
|
||||
"Filter2D". In this case, the implementation selection preference can
|
||||
be specified with a special compilation parameter cv::gapi::lookup_order.
|
||||
|
||||
<!-- FIXME Document this process better as a part of regular -->
|
||||
<!-- documentation, not a tutorial kind of thing -->
|
||||
|
||||
## Troubleshooting and customization {#gapi_anisotropic_trouble}
|
||||
|
||||
After the above modifications, (in OpenCV 4.0) the app should crash
|
||||
with a message like this:
|
||||
|
||||
```
|
||||
$ ./bin/example_tutorial_porting_anisotropic_image_segmentation_gapi_fluid
|
||||
terminate called after throwing an instance of 'std::logic_error'
|
||||
what(): .../modules/gapi/src/backends/fluid/gfluidimgproc.cpp:436: Assertion kernelSize.width == 3 && kernelSize.height == 3 in function run failed
|
||||
|
||||
Aborted (core dumped)
|
||||
```
|
||||
|
||||
Fluid backend has a number of limitations in OpenCV 4.0 (see this
|
||||
[wiki page](https://github.com/opencv/opencv/wiki/Graph-API) for a
|
||||
more up-to-date status). In particular, the Box filter used in this
|
||||
sample supports only static 3x3 kernel size.
|
||||
|
||||
We can overcome this problem easily by avoiding G-API using Fluid
|
||||
version of Box filter kernel in this sample. It can be done by
|
||||
removing the appropriate kernel from the kernel package we've just
|
||||
created:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi_fluid.cpp kernel_hotfix
|
||||
|
||||
Now this kernel package doesn't have _any_ implementation of Box
|
||||
filter kernel interface (specified as a template parameter). As
|
||||
described above, G-API will fall-back to OpenCV to run this kernel
|
||||
now. The resulting code with this change now looks like:
|
||||
|
||||
@snippet cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi_fluid.cpp kernel_pkg_proper
|
||||
|
||||
Let's examine the memory profile for this sample after we switched to
|
||||
Fluid backend. Now it looks like this:
|
||||
|
||||

|
||||
|
||||
Now the tool reports 3.8MiB -- and we just changed a few lines in our
|
||||
code, without modifying the graph itself! It is a ~2.8X improvement of
|
||||
the previous G-API result, and 2X improvement of the original OpenCV
|
||||
version.
|
||||
|
||||
Let's also examine how the internal representation of the graph now
|
||||
looks like. Dumping the graph into `.dot` would result into a
|
||||
visualization like this:
|
||||
|
||||

|
||||
|
||||
This graph doesn't differ structually from its previous version (in
|
||||
terms of operations and data objects), though a changed layout (on the
|
||||
left side of the dump) is easily noticeable.
|
||||
|
||||
The visualization reflects how G-API deals with mixed graphs, also
|
||||
called _heterogeneous_ graphs. The majority of operations in this
|
||||
graph are implemented with Fluid backend, but Box filters are executed
|
||||
by the OpenCV backend. One can easily see that the graph is partioned
|
||||
(with rectangles). G-API groups connected operations based on their
|
||||
affinity, forming _subgraphs_ (or _islands_ in G-API terminology), and
|
||||
our top-level graph becomes a composition of multiple smaller
|
||||
subgraphs. Every backend determines how its subgraph (island) is
|
||||
executed, so Fluid backend optimizes out memory where possible, and
|
||||
six intermediate buffers accessed by OpenCV Box filters are allocated
|
||||
fully and can't be optimized out.
|
||||
|
||||
<!-- TODO: add a chapter on custom kernels -->
|
||||
<!-- TODO: make a full-fluid pipeline -->
|
||||
<!-- TODO: talk about parallelism when it is available -->
|
||||
|
||||
# Conclusion {#gapi_tutor_conclusion}
|
||||
|
||||
This tutorial demonstrates what G-API is and what its key design
|
||||
concepts are, how an algorithm can be ported to G-API, and
|
||||
how to utilize graph model benefits after that.
|
||||
|
||||
In OpenCV 4.0, G-API is still in its inception stage -- it is more a
|
||||
foundation for all future work, though ready for use even now.
|
||||
|
||||
Further, this tutorial will be extended with new chapters on custom
|
||||
kernels programming, parallelism, and more.
|
||||
@@ -0,0 +1,17 @@
|
||||
# Graph API (gapi module) {#tutorial_table_of_content_gapi}
|
||||
|
||||
In this section you will learn about graph-based image processing and
|
||||
how G-API module can be used for that.
|
||||
|
||||
- @subpage tutorial_gapi_anisotropic_segmentation
|
||||
|
||||
*Languages:* C++
|
||||
|
||||
*Compatibility:* \> OpenCV 4.0
|
||||
|
||||
*Author:* Dmitry Matveev
|
||||
|
||||
This is an end-to-end tutorial where an existing sample algorithm
|
||||
is ported on G-API, covering the basic intuition behind this
|
||||
transition process, and examining benefits which a graph model
|
||||
brings there.
|
||||
@@ -1,3 +1,4 @@
|
||||
@cond CUDA_MODULES
|
||||
Similarity check (PNSR and SSIM) on the GPU {#tutorial_gpu_basics_similarity}
|
||||
===========================================
|
||||
@todo update this tutorial
|
||||
@@ -24,7 +25,7 @@ The source code
|
||||
|
||||
You may also find the source code and the video file in the
|
||||
`samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity` directory of the OpenCV
|
||||
source library or download it from [here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp).
|
||||
source library or download it from [here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp).
|
||||
The full source code is quite long (due to the controlling of the application via the command line
|
||||
arguments and performance measurement). Therefore, to avoid cluttering up these sections with those
|
||||
you'll find here only the functions itself.
|
||||
@@ -204,3 +205,4 @@ It may be just the improvement needed for your application to work. You may obse
|
||||
instance of this on the [YouTube here](https://www.youtube.com/watch?v=3_ESXmFlnvY).
|
||||
|
||||
@youtube{3_ESXmFlnvY}
|
||||
@endcond
|
||||
|
||||