add roombapy-1.3.1 with accessories
This commit is contained in:
parent
f061ad0e17
commit
9f31552ccd
|
@ -2,7 +2,10 @@
|
|||
* bump simplisafe-python-5.1.0
|
||||
* bump bimmer_connected-0.6.2
|
||||
* add (older) haanna-0.12.3 for a test
|
||||
* remove dev-python/Pillow, we use the one from the main repo
|
||||
* add dev-python/roombapy/roombapy-1.3.1
|
||||
- add scikit-build-0.10.0
|
||||
- apply a temporary hack for opencv-3.4.1 (https://bugs.gentoo.org/699730)
|
||||
- remove dev-python/Pillow, we already use only the one from gentoo main repo
|
||||
|
||||
2019-11-09 again modules from dev tree
|
||||
* bump abodepy-0.16.7
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
DIST roombapy-1.3.1.tar.gz 125411 BLAKE2B ed68f1ac614f8514c46383ed45848a48b9affec2fc2e07532e45e00db7b4420497b3f4f3a0a85b44a297b9129a017fd8c10e4aff5bec02ffba1744c25c3e01a9 SHA512 851292f7b96fdbd54928df769d2e62113109a618bac0004f016077520b05da241c465ee6af7fdbc1172e756beb8b41ef3123cc02e4d151d57bef22ce69cdc9c0
|
||||
EBUILD roombapy-1.3.1.ebuild 1238 BLAKE2B 3a8c0745d8ad7b7c44a86b18d24ed3f2fc7400525a6a1531faf4c78c8f768f0424cd7fa582dcd56a0baadf5759bae436b6d9f8d0d3e01407001329f529dd19bd SHA512 52b3091a2312d9f371efff8370dbe0863dd34b5ad597b4a26d115d24bf4802db068ba1f21ec5cfff311d6bf976c69281cfdbdc2e732bca9a4984dedfe0720143
|
||||
MISC metadata.xml 639 BLAKE2B 0f49226c13428d056f5e0caa5422eeefa19a904ddc65e3878515165931c4b9ff19c0cb067c880a7d9f9ccb52ce34531081f5d3d36e40cf244241ad29f7393fac SHA512 ff4baa24c2d7766239adae4e78ed014894310bfca7492ab84af9c1d3f86165ae50ce49aeb7696ec6ef74cf3e64842d082ff957f767688cfc7ff3ee273515bc81
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer>
|
||||
<email>b@edevau.net</email>
|
||||
<name>Andreas Billmeier</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="opencv">Use opencv for map generation</flag>
|
||||
<flag name="pillow">Use pillow for map generation</flag>
|
||||
<flag name="mqtt">Use paho mqtt client for communication</flag>
|
||||
</use>
|
||||
<herd>python</herd>
|
||||
<upstream>
|
||||
<remote-id type="pypi">roombapy</remote-id>
|
||||
<maintainer status="unknown">
|
||||
<email>nick.waterton@med.ge.com</email>
|
||||
</maintainer>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright 1999-2019 Gentoo Authors Andreas Billmeier b (at) edevau.net
|
||||
# Distributed under the terms of the GNU General Public License v3.0
|
||||
|
||||
EAPI="7"
|
||||
|
||||
PYTHON_COMPAT=( python3_{6,7} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
DESCRIPTION="Python program and library to control Wi-Fi enabled iRobot Roomba vacuum cleaners"
|
||||
HOMEPAGE="https://github.com/pschmitt/roombapy https://pypi.org/project/roombapy/"
|
||||
SRC_URI="https://github.com/pschmitt/roombapy/archive/${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
|
||||
IUSE="test +opencv pillow mqtt"
|
||||
|
||||
RDEPEND=">=dev-python/appdirs-1.4.3[${PYTHON_USEDEP}]
|
||||
>=dev-python/olefile-0.44[${PYTHON_USEDEP}]
|
||||
dev-python/packaging[${PYTHON_USEDEP}]
|
||||
mqtt? ( dev-python/paho-mqtt[${PYTHON_USEDEP}] )
|
||||
>=dev-python/pyparsing-2.2.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/six-1.10.0[${PYTHON_USEDEP}]
|
||||
opencv? ( =media-libs/opencv-3.4.1-r7[${PYTHON_USEDEP}]
|
||||
>=dev-python/numpy-1.12.1[${PYTHON_USEDEP}] )
|
||||
pillow? ( >=dev-python/pillow-4.1.1[${PYTHON_USEDEP}] )"
|
||||
|
||||
DEPEND="${REDEPEND}
|
||||
dev-python/setuptools[${PYTHON_USEDEP}]
|
||||
test? (
|
||||
dev-python/nose[${PYTHON_USEDEP}]
|
||||
dev-python/pytest[${PYTHON_USEDEP}]
|
||||
)"
|
||||
|
||||
python_test() {
|
||||
nosetests --verbose || die
|
||||
py.test -v -v || die
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
DIST scikit-build-0.10.0.tar.gz 132443 BLAKE2B 7e817b1b6d8ea5e663cec59c5ed51b3f58318eedf6587380eb2a1458bac772a5a02a936015027f1200f740884ba33512babb1aadc4cdbb59ea38f46bc36cbb5f SHA512 cbdc59a41c60c162be84b38d207838d5e38898871f2ef02dcb672796f01f7a31645892770172e9891a4dd7aa02a85dd489b6dede4c5f717ab013dd8947d5d314
|
||||
EBUILD scikit-build-0.10.0.ebuild 798 BLAKE2B 84163d44be896106db1795a2056883af7ff93d804f6c3f87494cf6b4b7f65d5624462b2bf0e0d2d75e0e2fb719c50e1bdba41c4a6030c81577b226f112885c3f SHA512 cf4efbc1b99c79c916e5d381ec124faa2df12b48079d2a527a12f0c2d17a98c9605677e28c181630b3b683d09e6510f56acf761bdc0c2ed36f9ceda75bbeb490
|
||||
MISC metadata.xml 482 BLAKE2B 49e1787adb16ea6cd60086b1fdd2655123d089b9a53c8cc4270278f8349415f9d226ff33f7e122f31fd45220732b2b72131b3c417b908cb7864646bf31b3a575 SHA512 cab4f192c3c7415e2402e5f4db90a90b1f8fe7ba7da44ad60ba6eb559747dbe3fa21e459f9e5b0587415ae49ffa70318cf8b8f5a05f94ccdba2bf993bb905cae
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer>
|
||||
<email>b@edevau.net</email>
|
||||
<name>Andreas Billmeier</name>
|
||||
</maintainer>
|
||||
<herd>python</herd>
|
||||
<upstream>
|
||||
<remote-id type="pypi">scikit-build</remote-id>
|
||||
<maintainer status="unknown">
|
||||
<email>scikit-build@googlegroups.com</email>
|
||||
<name>The scikit-build team</name>
|
||||
</maintainer>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright 1999-2019 Gentoo Authors Andreas Billmeier b (at) edevau.net
|
||||
# Distributed under the terms of the GNU General Public License v3.0
|
||||
|
||||
EAPI="7"
|
||||
|
||||
PYTHON_COMPAT=( python3_{6,7} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
DESCRIPTION="Improved build system generator for Python C/C++/Fortran/Cython extensions"
|
||||
HOMEPAGE="https://github.com/scikit-build/scikit-build https://pypi.org/project/scikit-build/"
|
||||
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
|
||||
IUSE="test"
|
||||
|
||||
RDEPEND=">=dev-python/wheel-0.29.0[${PYTHON_USEDEP}]"
|
||||
DEPEND="${REDEPEND}
|
||||
dev-python/setuptools[${PYTHON_USEDEP}]
|
||||
test? (
|
||||
dev-python/nose[${PYTHON_USEDEP}]
|
||||
dev-python/pytest[${PYTHON_USEDEP}]
|
||||
)"
|
||||
|
||||
python_test() {
|
||||
nosetests --verbose || die
|
||||
py.test -v -v || die
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
AUX opencv-2.3.1a-libav-0.7.patch 415 BLAKE2B f3aecdeae8c558edbca610d380a2c0862f2c69f8104b63564d3a07f9494dd474cfeee15438086c6e2abb74821ac482ebdeb896e2aac96d69088f089273cdd7f2 SHA512 b17466470a47876e1a8434367f47ce13ec989bdc35ec707d87188187e08b8ccca6af4c5563f20b3170758582b500323030cff22961a7fbbc6b4843d8bb808f1e
|
||||
AUX opencv-2.4.13-gcc-6.0.patch 1068 BLAKE2B cfbb70e2e3e9909fe8b37705faf51f88e754751e66073a767aa943144827817c2cfe1b84778ed6d3f7774de066a7aba76f070d621806d0f00065d7f6c1768a2e SHA512 b5dced5d0816d7560c827db06000e770de22b0b3a703ab078bf1cdde4202a5bbe223e5021c9d0e99eeb93c7622a89b9fa03e5ae8bd4a8d3b2df12f014b7e5ca9
|
||||
AUX opencv-2.4.13-imgcodecs-refactoring.patch 19899 BLAKE2B 106e5426091f3072b108d9750a6273f5201f77e190cbfba6e3a77da0b3cdfc2f83e276e1ff0506374ea1c4914314e036e921cf9324eb47eebff9f6a474c5f6c9 SHA512 2fae29c7190930f1a2657641d42e0484d4ce6a4562d52cd1522b3b4e9d56468ef7b3d313088270fbb778e5f412f02e149164c38174d95e397e9f2b7d5a1b404b
|
||||
AUX opencv-2.4.2-cflags.patch 742 BLAKE2B 15e523b500028cd5483a9eae16f3a200937876214b0f99d6ce08345f94050e7cc4c76b7c79b4e3ecee64e9a3a6ef7510c2b86ce7eef3608b24e61d3501ccbc16 SHA512 b92c07d8c9c40ad7721e0cca2d79b001f825478a336ad40cb43d02218fcd9e8b94b871575028ca8eaf6616cfce8138c796f32d4cf55d83d5cbe819ec50cf7c82
|
||||
AUX opencv-2.4.3-gcc47.patch 835 BLAKE2B 2e0f71fff77a23c2db9747d8bb7f9301de18acd4821b8223edd1979f2a1c62c86e71c4d4a5b0e3bf0057df81127d207230eb7b3f08507b17397b8370d454b570 SHA512 cc5e3e4c0def0745867403e990abf4b88d7d3edc72867a283403a991fd96f59c4cca6524ca184a52a40c913cd5d9cdfb52e98be71d5060fc4c7aa6b613a2a220
|
||||
AUX opencv-2.4.8-javamagic.patch 1165 BLAKE2B 0f12fd471145e1e303a517e5bc704fb5abc5ac5731fb1eadf08ef61e618bd70f9348c9c7a23296eefeb37826fd6701baaab0fc475ad0c441302b20516cf9bb9a SHA512 fd8a0d33997889c9316c0a4474c836b2528b676cd26bbb0e6ee2262377e45c5a0c465534831bd7fec3c0aa9cb198bc792a53f958b05a5217009314b678076d64
|
||||
AUX opencv-2.4.9-cuda-pkg-config.patch 373 BLAKE2B 389a27607926170c38c69cba955e91e0dfde65a51ee88dd0aec315056ba0f36a303ef2d4b95e226f323e92c59a251b93e9deae5cb3822ad69d257e1cb3cb1f34 SHA512 5b8f931758c6c8edfc3cae35a16d1c8674f17716f13b424ee0510eb313f06ed334b80205262e6bfcce22db235467cad81fddfa96e0cf669972794cc8524f6937
|
||||
AUX opencv-3.0.0-gles.patch 481 BLAKE2B 3eecd8c754abd9fdbfc2878b8b5a8b5ac3c6410342eb0756162ac901fe0903f7e1236bf2cc6e2ec5c7eeb638037f0dfad2b5aa9ebc905c485c4084936daed24e SHA512 37cac226bc39b91a87e4891e1d58169a0c2723240215670ebaecbfaf9b066b571296041fc5140aff7274cc44ca132b6f1b3bd4cf6d6dd23b950cac6eca548ad9
|
||||
AUX opencv-3.3.0-remove-tiny-dnn-autodownload.patch 1138 BLAKE2B 0bf85ca7a0e3759a4de14a844f2929120a47f9c0c212992d078b19cc7a602e157d5233ebc30d7eb6dcfa8c5a9606e3acea15e5a96717842fa80d2d8b3fa3189c SHA512 6824c3fc193491d0d776a7a904d71515309a5b67b0dfa1790bbd402c40b68e813c9fdfc3037a60f31893341ea78553d97470d152e90f34485004e0e50e6d66f6
|
||||
AUX opencv-3.4.0-disable-download.patch 1050 BLAKE2B 6f39f61588d9231cc8d877624538a49654ec8cf63091f8d0251cd01cc14684f2f5264c295a149c4a5754a9336e1ad4d1760cc26471fd85a6f571404f7c8d540d SHA512 95f2043c286a7de33fb4718fc1e2ded1fd943b20a5c4cc0c3d7af84fc317e53e3aa6358a33e4781195f8a80904d6bc615171142cde5d30a83d16045d36f85826
|
||||
AUX opencv-3.4.1-compilation-C-mode.patch 2077 BLAKE2B 78f55e49bd51ac4377a1db37125da6ca1ddfb9d723243eca7ef3df9d6d7b3922329cdd1c5915d480a9264af623c2953b4edaf81fd53afc950dc19cd49f04ea6f SHA512 203a4376728df6aa3dcaab147654139ebfd296a98d83847ac3ab0184dba828cf2ee298fedf7e7c2c64e1e8965237172fa6f1d5c7a4f6be5165a384d21b6875e7
|
||||
AUX opencv-3.4.1-cuda-add-relaxed-constexpr.patch 707 BLAKE2B 743a9c259c59fc4e3017539faef0723e0a80fb9c4bbde94811f32b3e6ae271b3db39fd35487d75078cfbe9e596604c4e37fb5c6c18619ed524c52683219dd8af SHA512 b37ce78495a3bbc439f203d9db81d9bff3e7f980c01ef5187dee537dd9c1025c5163ec3760b48d91a099a2fafb60526c9fe83f7183fc605fb3cc0f5c7a65f6bf
|
||||
AUX opencv-3.4.1-fix-build-with-va.patch 1459 BLAKE2B 20a65a5bef15fab56d277d78f747b883b5a008508c643ae877717dd0c524aa6c2ba398aff7ac8073d3ccfffdcd284223369c15de36214f62730bc62ca582cf71 SHA512 24186689afe73fd3e63d6d43073a88c65bc7cd5c0719701c8a014e5e85e179765e1b2d2adac5fcc3c8490e92aeaf65642f6d0276581d8311470328b55b74d441
|
||||
AUX opencv-3.4.1-fix-on-x86.patch 1256 BLAKE2B 785e718d7cea4bf72b03de5083d065449bad294c6bf5b6e7eb837e4c5f4ead34c1034988303410dba49e8376ca63caaaa209a4bd175d786c75ebfc548b71e271 SHA512 8ebf573e3f02b78b5769eaf828215698073096a1dade9214af0382cfbbe2353307df836a6af8c4e86246ad33fefe1f64a1087d0ff7a6dc7c5f3e231592c20b4c
|
||||
AUX opencv-3.4.1-popcnt.patch 890 BLAKE2B 553352472eaf2a2c97f148f97856a103e8a190970ef8a675d7a9b6fbf1ead0686279a4a5d961e8802164c73177da3f25cef016d40b59044f5c74b63613251512 SHA512 44f35d21c55e68b2125c5eba83c875c02c3822998d973257ab8a7d7e0baaeb5de70386b9294ff62a327732743253c588946eb8c59f87f1629b26e0f594c7b65f
|
||||
AUX opencv-3.4.1-python-lib-suffix-hack.patch 723 BLAKE2B bc4b1c68f2c73b40d20372ce4e3232b2db3b414ce2da16a8d84710fc53902211f17585c7ce6daf2d54025b53c04aa74f0c3eb3a30f26bfbc9af24e246f56b71a SHA512 54d2c8189fc1ff06ee1cacf5f375ea976faf339563ee804085feb0ec1f55cdbe10eea7335a786706b6a6152b6f9145156b3e74ce802c3d15b5a23014b25044b8
|
||||
AUX opencv-3.4.1-python37.patch 452 BLAKE2B c4a2850c17a0f9e01f537df6123e7c4262862ec0cd1dd43f8cebd21d4d6e8903205813b2a200eb6b60efdc43e74b0c9222d0b6bba504bacb84f87cfcf7d80d1a SHA512 c7fac2a6425c4afbef3b3cae5307e6035e3f4ef77ba0006c4dfd3a1cfc15c4648e978cc305ce598ec70c049e2cdc36f5f85cf24a75a4d3f3dc025091993e66e2
|
||||
AUX opencv-3.4.1-remove-git-autodetect.patch 1549 BLAKE2B 0ed44deddea20d5a57dded6a51d40645e5376411d9c055995fdbdbfbf4252817eaa9158925276661e4958f894898122ec273a352491be53511207345a481db52 SHA512 8496677542981c64ba9763f0d494885f71747884ae3e02de0bc8f96c1802356d917dcc7aed84ddfc2af093456c250bf2fafbdd06f7789aae8c720f5a412c07a0
|
||||
DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
|
||||
DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
|
||||
DIST opencv-3.4.1.tar.gz 87051748 BLAKE2B 87c83ab9b3d7fb048263f047aa5d6e95b153e1a28f3e34cc885eff7eb080a2258cfa1aa494cd56b32f1098ab158c17c23fc8464fcbe70642a3a1842f2fd1b4ac SHA512 e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b
|
||||
DIST opencv-3.4.1_contrib.tar.gz 57126844 BLAKE2B 63d9d5cb088371754eb132607789c8f1d4820f3e0e486593d6f64ee8f918ea4362152f050baec16f17904c03a6cdc0abc6e5fb2510308dcbabebe97b29285fbc SHA512 431dfba0f413071d7faa18bc6e6f5e4f015285e2cc730c5dd69b2a4d6aa4250b7e0bcb1814ac6f06f5c76f103aea1f93f72f32aee6bc0cd7ddacdaf1f40075c1
|
||||
DIST tiny-dnn-1.0.0a3.tar.gz 12885646 BLAKE2B 85c0715ab6c692b77522487775e70b0db645528baed1830c83c9f44d2b67a5207e4f7ea1709b35c6a4217d287199549304e9be19f4a5cec9a1183b0b5dccc562 SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b
|
||||
DIST vgg_boostdesc-3.2.0.tar.gz 1867770 BLAKE2B 1fa5b58e73b6fa56ecf8d19af22298f729942ee1369082e173445d09d3de767bf844bad3d2b462efc1199c392f37c88ba49a9996ba8bfd84b4abeba7de94db63 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44
|
||||
EBUILD opencv-3.4.1-r7.ebuild 18994 BLAKE2B 412c30967ddb4a6a45b3d7d2675cf37fded6a998f05415683a31e2f65d8314c05cabf7b7e81aae9d1b058a36de7822614e0c6bf9e0709bfefb14736f162b76b1 SHA512 4069e52e74277f3657c9de54213b10974ec3f753029b547a89815702023266c3e9cf1358feb963ecaf539e983646631a744ffdfcd75e297b4d60c8ab9889209c
|
||||
MISC metadata.xml 2458 BLAKE2B 3102d768cb8308fa243ab9388110312ddf1a2adfd6aa31d8261192530bdb13e222338eb424c2102c12af129494d3025097b79e1cb34770238c8ef90d10b0a535 SHA512 e364a0811b3eab96adc83e800d6fad7ceb51d56b5c78ba1d363af19fe27c17bf644bb99a30e6235a6154971caeec389dcced8ba1cdca9586d8cfead8927617a0
|
|
@ -0,0 +1,10 @@
|
|||
--- OpenCV-2.3.1.orig/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:37.000000000 +0100
|
||||
+++ OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:18.000000000 +0100
|
||||
@@ -104,6 +104,7 @@
|
||||
#endif
|
||||
#if defined(HAVE_LIBAVCODEC_AVCODEC_H)
|
||||
#include <libavcodec/avcodec.h>
|
||||
+ #include <libavutil/mathematics.h>
|
||||
#endif
|
||||
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)
|
||||
#include <libswscale/swscale.h>
|
|
@ -0,0 +1,23 @@
|
|||
From fb598bb76a0431aa3a880ecfa45054c996a070fb Mon Sep 17 00:00:00 2001
|
||||
From: Maksim Shabunin <maksim.shabunin@itseez.com>
|
||||
Date: Fri, 13 May 2016 13:28:09 +0300
|
||||
Subject: [PATCH] Disabled PCH support for gcc >= 6.0.0
|
||||
|
||||
Command line generation routine uses "-isystem" to include headers outside of "<opencv>/modules" folder, but GCC 6 does not work when passed "-isystem /usr/include" option.
|
||||
---
|
||||
cmake/OpenCVPCHSupport.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
|
||||
index 13619daf27e..e6585cae020 100644
|
||||
--- a/cmake/OpenCVPCHSupport.cmake
|
||||
+++ b/cmake/OpenCVPCHSupport.cmake
|
||||
@@ -19,7 +19,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
- IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
|
||||
+ IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
|
@ -0,0 +1,580 @@
|
|||
From 72d29259ca741950527c8cca7fb649030c01f658 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
|
||||
Date: Tue, 15 Aug 2017 22:04:55 +0000
|
||||
Subject: [PATCH] imgcodecs: refactoring, improve code quality
|
||||
|
||||
---
|
||||
modules/core/include/opencv2/core/core.hpp | 3 +
|
||||
modules/core/include/opencv2/core/operations.hpp | 3 +
|
||||
modules/highgui/src/bitstrm.cpp | 2 +
|
||||
modules/highgui/src/bitstrm.hpp | 19 ++--
|
||||
modules/highgui/src/grfmt_bmp.cpp | 13 ++-
|
||||
modules/highgui/src/grfmt_pxm.cpp | 119 +++++++++++++---------
|
||||
modules/highgui/src/loadsave.cpp | 120 +++++++++++++++++++----
|
||||
7 files changed, 207 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp
|
||||
index 6bb295f5c73..86f4eb182b2 100644
|
||||
--- a/modules/core/include/opencv2/core/core.hpp
|
||||
+++ b/modules/core/include/opencv2/core/core.hpp
|
||||
@@ -3248,6 +3248,9 @@ template<typename _Tp, size_t fixed_size=4096/sizeof(_Tp)+8> class AutoBuffer
|
||||
//! returns read-only pointer to the real buffer, stack-allocated or head-allocated
|
||||
operator const _Tp* () const;
|
||||
|
||||
+ //! returns number of allocated elements
|
||||
+ size_t getSize() const;
|
||||
+
|
||||
protected:
|
||||
//! pointer to the real buffer, can point to buf if the buffer is small enough
|
||||
_Tp* ptr;
|
||||
diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp
|
||||
index 1b7484aded2..37fd3d97c7a 100644
|
||||
--- a/modules/core/include/opencv2/core/operations.hpp
|
||||
+++ b/modules/core/include/opencv2/core/operations.hpp
|
||||
@@ -2581,6 +2581,9 @@ template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::op
|
||||
template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
|
||||
{ return ptr; }
|
||||
|
||||
+template<typename _Tp, size_t fixed_size> inline size_t AutoBuffer<_Tp, fixed_size>::getSize() const
|
||||
+{ return size; }
|
||||
+
|
||||
|
||||
/////////////////////////////////// Ptr ////////////////////////////////////////
|
||||
|
||||
diff --git a/modules/highgui/src/bitstrm.cpp b/modules/highgui/src/bitstrm.cpp
|
||||
index dd8bec87cca..67792a27f28 100644
|
||||
--- a/modules/highgui/src/bitstrm.cpp
|
||||
+++ b/modules/highgui/src/bitstrm.cpp
|
||||
@@ -208,6 +208,8 @@ int RLByteStream::getByte()
|
||||
current = m_current;
|
||||
}
|
||||
|
||||
+ CV_Assert(current < m_end);
|
||||
+
|
||||
val = *((uchar*)current);
|
||||
m_current = current + 1;
|
||||
return val;
|
||||
diff --git a/modules/highgui/src/bitstrm.hpp b/modules/highgui/src/bitstrm.hpp
|
||||
index 57956beb539..b22987bc911 100644
|
||||
--- a/modules/highgui/src/bitstrm.hpp
|
||||
+++ b/modules/highgui/src/bitstrm.hpp
|
||||
@@ -48,13 +48,20 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
-enum
|
||||
-{
|
||||
- RBS_THROW_EOS=-123, // <end of stream> exception code
|
||||
- RBS_THROW_FORB=-124, // <forrbidden huffman code> exception code
|
||||
- RBS_HUFF_FORB=2047, // forrbidden huffman code "value"
|
||||
- RBS_BAD_HEADER=-125 // invalid header
|
||||
+#define DECLARE_RBS_EXCEPTION(name) \
|
||||
+class RBS_ ## name ## _Exception : public cv::Exception \
|
||||
+{ \
|
||||
+public: \
|
||||
+ RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
|
||||
+ cv::Exception(code_, err_, func_, file_, line_) \
|
||||
+ {} \
|
||||
};
|
||||
+DECLARE_RBS_EXCEPTION(THROW_EOS)
|
||||
+#define RBS_THROW_EOS RBS_THROW_EOS_Exception(CV_StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
|
||||
+DECLARE_RBS_EXCEPTION(THROW_FORB)
|
||||
+#define RBS_THROW_FORB RBS_THROW_FORB_Exception(CV_StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
|
||||
+DECLARE_RBS_EXCEPTION(BAD_HEADER)
|
||||
+#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(CV_StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
|
||||
|
||||
typedef unsigned long ulong;
|
||||
|
||||
diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp
|
||||
index c8f8218cd3b..026b317467d 100644
|
||||
--- a/modules/highgui/src/grfmt_bmp.cpp
|
||||
+++ b/modules/highgui/src/grfmt_bmp.cpp
|
||||
@@ -115,8 +115,9 @@ bool BmpDecoder::readHeader()
|
||||
|
||||
if( m_bpp <= 8 )
|
||||
{
|
||||
- memset( m_palette, 0, sizeof(m_palette));
|
||||
- m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
|
||||
+ CV_Assert(clrused < 256);
|
||||
+ memset(m_palette, 0, sizeof(m_palette));
|
||||
+ m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
|
||||
iscolor = IsColorPalette( m_palette, m_bpp );
|
||||
}
|
||||
else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
|
||||
@@ -282,7 +283,9 @@ bool BmpDecoder::readData( Mat& img )
|
||||
else if( code > 2 ) // absolute mode
|
||||
{
|
||||
if( data + code*nch > line_end ) goto decode_rle4_bad;
|
||||
- m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
|
||||
+ int sz = (((code + 1)>>1) + 1) & (~1);
|
||||
+ CV_Assert((size_t)sz < _src.getSize());
|
||||
+ m_strm.getBytes(src, sz);
|
||||
if( color )
|
||||
data = FillColorRow4( data, src, code, m_palette );
|
||||
else
|
||||
@@ -371,7 +374,9 @@ decode_rle4_bad: ;
|
||||
|
||||
if( data + code3 > line_end )
|
||||
goto decode_rle8_bad;
|
||||
- m_strm.getBytes( src, (code + 1) & -2 );
|
||||
+ int sz = (code + 1) & (~1);
|
||||
+ CV_Assert((size_t)sz < _src.getSize());
|
||||
+ m_strm.getBytes(src, sz);
|
||||
if( color )
|
||||
data = FillColorRow8( data, src, code, m_palette );
|
||||
else
|
||||
diff --git a/modules/highgui/src/grfmt_pxm.cpp b/modules/highgui/src/grfmt_pxm.cpp
|
||||
index f73bbb1bf6b..e609d165966 100644
|
||||
--- a/modules/highgui/src/grfmt_pxm.cpp
|
||||
+++ b/modules/highgui/src/grfmt_pxm.cpp
|
||||
@@ -43,50 +43,58 @@
|
||||
#include "precomp.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "grfmt_pxm.hpp"
|
||||
+#include <iostream>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
///////////////////////// P?M reader //////////////////////////////
|
||||
|
||||
-static int ReadNumber( RLByteStream& strm, int maxdigits )
|
||||
+static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
|
||||
{
|
||||
int code;
|
||||
- int val = 0;
|
||||
+ int64 val = 0;
|
||||
int digits = 0;
|
||||
|
||||
code = strm.getByte();
|
||||
|
||||
- if( !isdigit(code))
|
||||
+ while (!isdigit(code))
|
||||
{
|
||||
- do
|
||||
+ if (code == '#' )
|
||||
{
|
||||
- if( code == '#' )
|
||||
+ do
|
||||
{
|
||||
- do
|
||||
- {
|
||||
- code = strm.getByte();
|
||||
- }
|
||||
- while( code != '\n' && code != '\r' );
|
||||
+ code = strm.getByte();
|
||||
}
|
||||
-
|
||||
+ while (code != '\n' && code != '\r');
|
||||
code = strm.getByte();
|
||||
-
|
||||
- while( isspace(code))
|
||||
+ }
|
||||
+ else if (isspace(code))
|
||||
+ {
|
||||
+ while (isspace(code))
|
||||
code = strm.getByte();
|
||||
}
|
||||
- while( !isdigit( code ));
|
||||
+ else
|
||||
+ {
|
||||
+#if 1
|
||||
+ CV_Error_(CV_StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
|
||||
+#else
|
||||
+ code = strm.getByte();
|
||||
+#endif
|
||||
+ }
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
- val = val*10 + code - '0';
|
||||
- if( ++digits >= maxdigits ) break;
|
||||
+ val = val*10 + (code - '0');
|
||||
+ CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
|
||||
+ digits++;
|
||||
+ if (maxdigits != 0 && digits >= maxdigits) break;
|
||||
code = strm.getByte();
|
||||
}
|
||||
- while( isdigit(code));
|
||||
+ while (isdigit(code));
|
||||
|
||||
- return val;
|
||||
+ return (int)val;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,13 +127,13 @@ ImageDecoder PxMDecoder::newDecoder() const
|
||||
return new PxMDecoder;
|
||||
}
|
||||
|
||||
-void PxMDecoder::close()
|
||||
+void PxMDecoder::close()
|
||||
{
|
||||
m_strm.close();
|
||||
}
|
||||
|
||||
|
||||
-bool PxMDecoder::readHeader()
|
||||
+bool PxMDecoder::readHeader()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
@@ -155,10 +163,10 @@ bool PxMDecoder::readHeader()
|
||||
m_binary = code >= '4';
|
||||
m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
|
||||
|
||||
- m_width = ReadNumber( m_strm, INT_MAX );
|
||||
- m_height = ReadNumber( m_strm, INT_MAX );
|
||||
+ m_width = ReadNumber(m_strm);
|
||||
+ m_height = ReadNumber(m_strm);
|
||||
|
||||
- m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
|
||||
+ m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
|
||||
if( m_maxval > 65535 )
|
||||
throw RBS_BAD_HEADER;
|
||||
|
||||
@@ -172,8 +180,14 @@ bool PxMDecoder::readHeader()
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
- catch(...)
|
||||
+ catch (const cv::Exception&)
|
||||
{
|
||||
+ throw;
|
||||
+ }
|
||||
+ catch (...)
|
||||
+ {
|
||||
+ std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
|
||||
+ throw;
|
||||
}
|
||||
|
||||
if( !result )
|
||||
@@ -193,27 +207,23 @@ bool PxMDecoder::readData( Mat& img )
|
||||
int step = (int)img.step;
|
||||
PaletteEntry palette[256];
|
||||
bool result = false;
|
||||
- int bit_depth = CV_ELEM_SIZE1(m_type)*8;
|
||||
- int src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
|
||||
+ const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
|
||||
+ const int src_pitch = (m_width*m_bpp*(bit_depth/8) + 7) / 8;
|
||||
+
|
||||
int nch = CV_MAT_CN(m_type);
|
||||
int width3 = m_width*nch;
|
||||
- int i, x, y;
|
||||
|
||||
if( m_offset < 0 || !m_strm.isOpened())
|
||||
return false;
|
||||
|
||||
- AutoBuffer<uchar,1024> _src(src_pitch + 32);
|
||||
- uchar* src = _src;
|
||||
- AutoBuffer<uchar,1024> _gray_palette;
|
||||
- uchar* gray_palette = _gray_palette;
|
||||
+ uchar gray_palette[256] = {0};
|
||||
|
||||
// create LUT for converting colors
|
||||
if( bit_depth == 8 )
|
||||
{
|
||||
- _gray_palette.allocate(m_maxval + 1);
|
||||
- gray_palette = _gray_palette;
|
||||
+ CV_Assert(m_maxval < 256);
|
||||
|
||||
- for( i = 0; i <= m_maxval; i++ )
|
||||
+ for (int i = 0; i <= m_maxval; i++)
|
||||
gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
|
||||
|
||||
FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
|
||||
@@ -227,12 +237,16 @@ bool PxMDecoder::readData( Mat& img )
|
||||
{
|
||||
////////////////////////// 1 BPP /////////////////////////
|
||||
case 1:
|
||||
+ CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
|
||||
if( !m_binary )
|
||||
{
|
||||
- for( y = 0; y < m_height; y++, data += step )
|
||||
+ AutoBuffer<uchar> _src(m_width);
|
||||
+ uchar* src = _src;
|
||||
+
|
||||
+ for (int y = 0; y < m_height; y++, data += step)
|
||||
{
|
||||
- for( x = 0; x < m_width; x++ )
|
||||
- src[x] = ReadNumber( m_strm, 1 ) != 0;
|
||||
+ for (int x = 0; x < m_width; x++)
|
||||
+ src[x] = ReadNumber(m_strm, 1) != 0;
|
||||
|
||||
if( color )
|
||||
FillColorRow8( data, src, m_width, palette );
|
||||
@@ -242,7 +256,10 @@ bool PxMDecoder::readData( Mat& img )
|
||||
}
|
||||
else
|
||||
{
|
||||
- for( y = 0; y < m_height; y++, data += step )
|
||||
+ AutoBuffer<uchar> _src(src_pitch);
|
||||
+ uchar* src = _src;
|
||||
+
|
||||
+ for (int y = 0; y < m_height; y++, data += step)
|
||||
{
|
||||
m_strm.getBytes( src, src_pitch );
|
||||
|
||||
@@ -258,11 +275,15 @@ bool PxMDecoder::readData( Mat& img )
|
||||
////////////////////////// 8 BPP /////////////////////////
|
||||
case 8:
|
||||
case 24:
|
||||
- for( y = 0; y < m_height; y++, data += step )
|
||||
+ {
|
||||
+ AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
|
||||
+ uchar* src = _src;
|
||||
+
|
||||
+ for (int y = 0; y < m_height; y++, data += step)
|
||||
{
|
||||
if( !m_binary )
|
||||
{
|
||||
- for( x = 0; x < width3; x++ )
|
||||
+ for (int x = 0; x < width3; x++)
|
||||
{
|
||||
int code = ReadNumber( m_strm, INT_MAX );
|
||||
if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
|
||||
@@ -277,7 +298,7 @@ bool PxMDecoder::readData( Mat& img )
|
||||
m_strm.getBytes( src, src_pitch );
|
||||
if( bit_depth == 16 && !isBigEndian() )
|
||||
{
|
||||
- for( x = 0; x < width3; x++ )
|
||||
+ for (int x = 0; x < width3; x++)
|
||||
{
|
||||
uchar v = src[x * 2];
|
||||
src[x * 2] = src[x * 2 + 1];
|
||||
@@ -288,7 +309,7 @@ bool PxMDecoder::readData( Mat& img )
|
||||
|
||||
if( img.depth() == CV_8U && bit_depth == 16 )
|
||||
{
|
||||
- for( x = 0; x < width3; x++ )
|
||||
+ for (int x = 0; x < width3; x++)
|
||||
{
|
||||
int v = ((ushort *)src)[x];
|
||||
src[x] = (uchar)(v >> 8);
|
||||
@@ -329,12 +350,19 @@ bool PxMDecoder::readData( Mat& img )
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
+ }
|
||||
default:
|
||||
- assert(0);
|
||||
+ CV_Error(CV_StsError, "m_bpp is not supported");
|
||||
}
|
||||
}
|
||||
- catch(...)
|
||||
+ catch (const cv::Exception&)
|
||||
+ {
|
||||
+ throw;
|
||||
+ }
|
||||
+ catch (...)
|
||||
{
|
||||
+ std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
|
||||
+ throw;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -410,8 +438,9 @@ bool PxMEncoder::write( const Mat& img, const vector<int>& params )
|
||||
char* buffer = _buffer;
|
||||
|
||||
// write header;
|
||||
- sprintf( buffer, "P%c\n%d %d\n%d\n",
|
||||
+ sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
|
||||
'2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
|
||||
+ CV_VERSION,
|
||||
width, height, (1 << depth) - 1 );
|
||||
|
||||
strm.putBytes( buffer, (int)strlen(buffer) );
|
||||
diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp
|
||||
index 81c708acdd4..9b270c900f7 100644
|
||||
--- a/modules/highgui/src/loadsave.cpp
|
||||
+++ b/modules/highgui/src/loadsave.cpp
|
||||
@@ -48,12 +48,32 @@
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
+#include <iostream>
|
||||
+
|
||||
/****************************************************************************************\
|
||||
* Image Codecs *
|
||||
\****************************************************************************************/
|
||||
namespace cv
|
||||
{
|
||||
|
||||
+// TODO Add runtime configuration
|
||||
+#define CV_IO_MAX_IMAGE_PARAMS (50)
|
||||
+#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
|
||||
+#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
|
||||
+#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
|
||||
+
|
||||
+static Size validateInputImageSize(const Size& size)
|
||||
+{
|
||||
+ CV_Assert(size.width > 0);
|
||||
+ CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
|
||||
+ CV_Assert(size.height > 0);
|
||||
+ CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
|
||||
+ uint64 pixels = (uint64)size.width * (uint64)size.height;
|
||||
+ CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+
|
||||
struct ImageCodecInitializer
|
||||
{
|
||||
ImageCodecInitializer()
|
||||
@@ -203,12 +223,26 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
|
||||
if( decoder.empty() )
|
||||
return 0;
|
||||
decoder->setSource(filename);
|
||||
- if( !decoder->readHeader() )
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ // read the header to make sure it succeeds
|
||||
+ if (!decoder->readHeader())
|
||||
+ return 0;
|
||||
+ }
|
||||
+ catch (const cv::Exception& e)
|
||||
+ {
|
||||
+ std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
|
||||
return 0;
|
||||
+ }
|
||||
+ catch (...)
|
||||
+ {
|
||||
+ std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- CvSize size;
|
||||
- size.width = decoder->width();
|
||||
- size.height = decoder->height();
|
||||
+
|
||||
+ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
|
||||
|
||||
int type = decoder->type();
|
||||
if( flags != -1 )
|
||||
@@ -242,7 +276,21 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
|
||||
temp = cvarrToMat(image);
|
||||
}
|
||||
|
||||
- if( !decoder->readData( *data ))
|
||||
+ bool success = false;
|
||||
+ try
|
||||
+ {
|
||||
+ if (decoder->readData(*data))
|
||||
+ success = true;
|
||||
+ }
|
||||
+ catch (const cv::Exception& e)
|
||||
+ {
|
||||
+ std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
|
||||
+ }
|
||||
+ catch (...)
|
||||
+ {
|
||||
+ std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
|
||||
+ }
|
||||
+ if (!success)
|
||||
{
|
||||
cvReleaseImage( &image );
|
||||
cvReleaseMat( &matrix );
|
||||
@@ -288,6 +336,7 @@ static bool imwrite_( const string& filename, const Mat& image,
|
||||
}
|
||||
|
||||
encoder->setDestination( filename );
|
||||
+ CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
|
||||
bool code = encoder->write( *pimage, params );
|
||||
|
||||
// CV_Assert( code );
|
||||
@@ -326,16 +375,34 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
|
||||
decoder->setSource(filename);
|
||||
}
|
||||
|
||||
- if( !decoder->readHeader() )
|
||||
+ bool success = false;
|
||||
+ try
|
||||
{
|
||||
- if( !filename.empty() )
|
||||
- remove(filename.c_str());
|
||||
+ if (decoder->readHeader())
|
||||
+ success = true;
|
||||
+ }
|
||||
+ catch (const cv::Exception& e)
|
||||
+ {
|
||||
+ std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
|
||||
+ }
|
||||
+ catch (...)
|
||||
+ {
|
||||
+ std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
|
||||
+ }
|
||||
+ if (!success)
|
||||
+ {
|
||||
+ if (!filename.empty())
|
||||
+ {
|
||||
+ if (0 != remove(filename.c_str()))
|
||||
+ {
|
||||
+ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
|
||||
+ }
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
||||
- CvSize size;
|
||||
- size.width = decoder->width();
|
||||
- size.height = decoder->height();
|
||||
+ // established the required input image size
|
||||
+ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
|
||||
|
||||
int type = decoder->type();
|
||||
if( flags != -1 )
|
||||
@@ -369,11 +436,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
|
||||
temp = cvarrToMat(image);
|
||||
}
|
||||
|
||||
- bool code = decoder->readData( *data );
|
||||
- if( !filename.empty() )
|
||||
- remove(filename.c_str());
|
||||
+ success = false;
|
||||
+ try
|
||||
+ {
|
||||
+ if (decoder->readData(*data))
|
||||
+ success = true;
|
||||
+ }
|
||||
+ catch (const cv::Exception& e)
|
||||
+ {
|
||||
+ std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
|
||||
+ }
|
||||
+ catch (...)
|
||||
+ {
|
||||
+ std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
|
||||
+ }
|
||||
|
||||
- if( !code )
|
||||
+ if (!filename.empty())
|
||||
+ {
|
||||
+ if (0 != remove(filename.c_str()))
|
||||
+ {
|
||||
+ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!success)
|
||||
{
|
||||
cvReleaseImage( &image );
|
||||
cvReleaseMat( &matrix );
|
||||
@@ -490,7 +576,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
|
||||
if( _params )
|
||||
{
|
||||
for( ; _params[i] > 0; i += 2 )
|
||||
- ;
|
||||
+ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
|
||||
}
|
||||
return cv::imwrite_(filename, cv::cvarrToMat(arr),
|
||||
i > 0 ? cv::vector<int>(_params, _params+i) : cv::vector<int>(),
|
||||
@@ -521,7 +607,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
|
||||
if( _params )
|
||||
{
|
||||
for( ; _params[i] > 0; i += 2 )
|
||||
- ;
|
||||
+ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
|
||||
}
|
||||
cv::Mat img = cv::cvarrToMat(arr);
|
||||
if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )
|
|
@ -0,0 +1,21 @@
|
|||
diff -ruN OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake
|
||||
--- OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake 2012-06-29 00:55:15.000000000 +0200
|
||||
+++ OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake 2012-07-16 23:51:24.244907235 +0200
|
||||
@@ -110,17 +110,6 @@
|
||||
endif()
|
||||
|
||||
# Other optimizations
|
||||
- if(ENABLE_OMIT_FRAME_POINTER)
|
||||
- add_extra_compiler_option(-fomit-frame-pointer)
|
||||
- else()
|
||||
- add_extra_compiler_option(-fno-omit-frame-pointer)
|
||||
- endif()
|
||||
- if(ENABLE_FAST_MATH)
|
||||
- add_extra_compiler_option(-ffast-math)
|
||||
- endif()
|
||||
- if(ENABLE_POWERPC)
|
||||
- add_extra_compiler_option("-mcpu=G3 -mtune=G5")
|
||||
- endif()
|
||||
if(ENABLE_SSE)
|
||||
add_extra_compiler_option(-msse)
|
||||
endif()
|
|
@ -0,0 +1,22 @@
|
|||
diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp
|
||||
--- OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp 2012-10-12 00:55:12.000000000 +0200
|
||||
+++ OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp 2012-11-05 21:37:40.000000000 +0100
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "grfmt_tiff.hpp"
|
||||
+#include "unistd.h"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h OpenCV-2.4.3/modules/highgui/src/window_QT.h
|
||||
--- OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h 2012-10-18 00:55:38.000000000 +0200
|
||||
+++ OpenCV-2.4.3/modules/highgui/src/window_QT.h 2012-11-05 21:38:41.000000000 +0100
|
||||
@@ -41,6 +41,7 @@
|
||||
#define __OPENCV_HIGHGUI_QT_H__
|
||||
|
||||
#include "precomp.hpp"
|
||||
+#include "unistd.h"
|
||||
|
||||
#if defined( HAVE_QT_OPENGL )
|
||||
#include <QtOpenGL>
|
|
@ -0,0 +1,32 @@
|
|||
diff -ruN opencv-2.4.8.orig/CMakeLists.txt opencv-2.4.8/CMakeLists.txt
|
||||
--- opencv-2.4.8.orig/CMakeLists.txt 2013-12-27 18:09:18.000000000 +0100
|
||||
+++ opencv-2.4.8/CMakeLists.txt 2014-01-24 22:06:12.000000000 +0100
|
||||
@@ -164,6 +164,7 @@
|
||||
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 )
|
||||
+OCV_OPTION(WITH_JAVA "Include Java support" ON)
|
||||
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
@@ -449,6 +450,8 @@
|
||||
include(cmake/OpenCVDetectPython.cmake)
|
||||
|
||||
# --- Java Support ---
|
||||
+if(WITH_JAVA)
|
||||
+
|
||||
include(cmake/OpenCVDetectApacheAnt.cmake)
|
||||
if(ANDROID)
|
||||
include(cmake/OpenCVDetectAndroidSDK.cmake)
|
||||
@@ -466,6 +469,11 @@
|
||||
SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
|
||||
endif()
|
||||
|
||||
+else()
|
||||
+ SET(ANT_EXECUTABLE "")
|
||||
+ SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
|
||||
+endif()
|
||||
+
|
||||
# --- OpenCL ---
|
||||
if(WITH_OPENCL)
|
||||
include(cmake/OpenCVDetectOpenCL.cmake)
|
|
@ -0,0 +1,12 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -528,6 +528,9 @@
|
||||
if(HAVE_CUFFT)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
+ foreach(p ${CUDA_LIBS_PATH})
|
||||
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})
|
||||
+ endforeach()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
|
@ -0,0 +1,14 @@
|
|||
Index: opencv-2.4.11/modules/highgui/src/window_QT.cpp
|
||||
===================================================================
|
||||
--- opencv-2.4.11.orig/modules/highgui/src/window_QT.cpp
|
||||
+++ opencv-2.4.11/modules/highgui/src/window_QT.cpp
|
||||
@@ -3118,7 +3118,9 @@ void OpenGlViewPort::updateGl()
|
||||
|
||||
void OpenGlViewPort::initializeGL()
|
||||
{
|
||||
+#ifdef GL_PERSPECTIVE_CORRECTION_HINT
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void OpenGlViewPort::resizeGL(int w, int h)
|
|
@ -0,0 +1,27 @@
|
|||
diff -purN a/modules/dnn_modern/CMakeLists.txt b/modules/dnn_modern/CMakeLists.txt
|
||||
--- a/modules/dnn_modern/CMakeLists.txt 2017-07-31 15:58:38.000000000 +0100
|
||||
+++ b/modules/dnn_modern/CMakeLists.txt 2018-01-15 17:15:15.202454388 +0000
|
||||
@@ -15,23 +15,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CU
|
||||
# MODULE REQUIREMENTS
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
-set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
|
||||
-set(TINY_DNN_CPP_ROOT "${TINY_DNN_CPP_PATH}/tiny-dnn-1.0.0a3")
|
||||
-ocv_download(FILENAME "v1.0.0a3.tar.gz"
|
||||
- HASH "adb1c512e09ca2c7a6faef36f9c53e59"
|
||||
- URL
|
||||
- "${OPENCV_TINY_DNN_URL}"
|
||||
- "$ENV{OPENCV_TINY_DNN_URL}"
|
||||
- "https://github.com/tiny-dnn/tiny-dnn/archive/"
|
||||
- DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
|
||||
- STATUS TINY_DNN_DOWNLOAD_SUCCESS
|
||||
- ID "tiny-dnn"
|
||||
- UNPACK RELATIVE_URL)
|
||||
-
|
||||
-if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
|
||||
- message(STATUS "Failed to download tiny-dnn sources")
|
||||
-endif()
|
||||
-
|
||||
find_package(TinyDNN QUIET)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
|
@ -0,0 +1,29 @@
|
|||
--- a/CMakeLists.txt 2018-05-13 20:47:11.635871328 +0200
|
||||
+++ b/CMakeLists.txt 2018-05-13 20:47:49.289872617 +0200
|
||||
@@ -187,6 +187,7 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
|
||||
+OCV_OPTION(ENABLE_DOWNLOAD "Enable download during configure" ON)
|
||||
|
||||
# 3rd party libs
|
||||
OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE)
|
||||
|
||||
--- a/cmake/OpenCVDownload.cmake 2018-05-13 21:22:14.966943336 +0200
|
||||
+++ b/cmake/OpenCVDownload.cmake 2018-05-13 21:23:15.959945424 +0200
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
function(ocv_download)
|
||||
+ if(ENABLE_DOWNLOAD)
|
||||
cmake_parse_arguments(DL "UNPACK;RELATIVE_URL" "FILENAME;HASH;DESTINATION_DIR;ID;STATUS" "URL" ${ARGN})
|
||||
|
||||
macro(ocv_download_log)
|
||||
@@ -236,4 +237,7 @@
|
||||
if(OCV_DOWNLOAD_HASH_NAME)
|
||||
set(${OCV_DOWNLOAD_HASH_NAME} "${DL_HASH}" CACHE INTERNAL "")
|
||||
endif()
|
||||
+ else()
|
||||
+ message( "Download was disabled during configure phase by ENABLE_DOWNLOAD=OFF" )
|
||||
+ endif()
|
||||
endfunction()
|
|
@ -0,0 +1,56 @@
|
|||
From 549b5df22520b60b91dd77096434d79425b31ac2 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.alekhin@intel.com>
|
||||
Date: Mon, 28 May 2018 18:07:23 +0300
|
||||
Subject: [PATCH] build: workaround issues with C compilation mode
|
||||
|
||||
- cvdef.h + cvRound (double only)
|
||||
- highgui_c.h
|
||||
---
|
||||
modules/core/include/opencv2/core/cvdef.h | 8 +++++++-
|
||||
modules/highgui/include/opencv2/highgui/highgui_c.h | 2 ++
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h
|
||||
index a87ced09d78..4ab72b34cc1 100644
|
||||
--- a/modules/core/include/opencv2/core/cvdef.h
|
||||
+++ b/modules/core/include/opencv2/core/cvdef.h
|
||||
@@ -480,7 +480,7 @@ Cv64suf;
|
||||
// Integer types portatibility
|
||||
#ifdef OPENCV_STDINT_HEADER
|
||||
#include OPENCV_STDINT_HEADER
|
||||
-#else
|
||||
+#elif defined(__cplusplus)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
|
||||
namespace cv {
|
||||
typedef signed char int8_t;
|
||||
@@ -517,9 +517,15 @@ typedef ::int64_t int64_t;
|
||||
typedef ::uint64_t uint64_t;
|
||||
}
|
||||
#endif
|
||||
+#else // pure C
|
||||
+#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
+#ifndef __cplusplus
|
||||
+#include "opencv2/core/fast_math.hpp" // define cvRound(double)
|
||||
+#endif
|
||||
+
|
||||
#endif // OPENCV_CORE_CVDEF_H
|
||||
diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h
|
||||
index 1eb414a76ca..35413139c79 100644
|
||||
--- a/modules/highgui/include/opencv2/highgui/highgui_c.h
|
||||
+++ b/modules/highgui/include/opencv2/highgui/highgui_c.h
|
||||
@@ -135,8 +135,10 @@ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOS
|
||||
CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
|
||||
CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
|
||||
|
||||
+#ifdef __cplusplus // FIXIT remove in OpenCV 4.0
|
||||
/* Get window image rectangle coordinates, width and height */
|
||||
CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
|
||||
+#endif
|
||||
|
||||
/* display image within window (highgui windows remember their content) */
|
||||
CVAPI(void) cvShowImage( const char* name, const CvArr* image );
|
|
@ -0,0 +1,14 @@
|
|||
diff -Naur a/cmake/FindCUDA.cmake b/cmake/FindCUDA.cmake
|
||||
--- a/cmake/FindCUDA.cmake 2018-05-26 12:57:45.698858052 +0100
|
||||
+++ b/cmake/FindCUDA.cmake 2018-05-26 16:49:01.196390803 +0100
|
||||
@@ -447,8 +447,8 @@
|
||||
# Parse HOST_COMPILATION mode.
|
||||
option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
|
||||
|
||||
-# Extra user settable flags
|
||||
-set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
|
||||
+ #Extra user settable flags
|
||||
+set(CUDA_NVCC_FLAGS "--expt-relaxed-constexpr;" CACHE STRING "Semi-colon delimit multiple arguments.")
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
|
|
@ -0,0 +1,26 @@
|
|||
From 20f5fa8e3e880bc8b2e5156e9f25f7fb756ed8e4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
|
||||
Date: Wed, 28 Feb 2018 19:21:31 +0000
|
||||
Subject: [PATCH] Fix build with VA
|
||||
|
||||
This commit readd ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}
|
||||
that was missed in commit 2200e13c7193e0fe9db4b9f7c4bee3a7ef043909
|
||||
|
||||
diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
|
||||
- ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
|
||||
+ ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
|
||||
---
|
||||
samples/va_intel/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
|
||||
index af51dd32061..04f2ea5fd40 100644
|
||||
--- a/samples/va_intel/CMakeLists.txt
|
||||
+++ b/samples/va_intel/CMakeLists.txt
|
||||
@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
|
||||
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||
foreach(sample_filename ${all_samples})
|
||||
ocv_define_sample(tgt ${sample_filename} va_intel)
|
||||
- ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
|
||||
+ ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
|
||||
endforeach()
|
|
@ -0,0 +1,27 @@
|
|||
From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.alekhin@intel.com>
|
||||
Date: Mon, 9 Apr 2018 18:25:51 +0300
|
||||
Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds
|
||||
|
||||
replaced to safe binary compatible 'rep; nop' asm instruction
|
||||
---
|
||||
modules/core/src/parallel_impl.cpp | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp
|
||||
index 78d9eb63694..bc64fce7a81 100644
|
||||
--- a/modules/core/src/parallel_impl.cpp
|
||||
+++ b/modules/core/src/parallel_impl.cpp
|
||||
@@ -49,7 +49,11 @@ DECLARE_CV_YIELD
|
||||
DECLARE_CV_PAUSE
|
||||
#endif
|
||||
#ifndef CV_PAUSE
|
||||
-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
|
||||
+# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
|
||||
+# if !defined(__SSE__)
|
||||
+ static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
|
||||
+# define _mm_pause cv_non_sse_mm_pause
|
||||
+# endif
|
||||
# define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
|
||||
# elif defined __GNUC__ && defined __aarch64__
|
||||
# define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)
|
|
@ -0,0 +1,30 @@
|
|||
From a2d6fc7ac040c6ef94a36515f9ea24428f8f1ecc Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.alekhin@intel.com>
|
||||
Date: Tue, 24 Apr 2018 12:40:25 +0300
|
||||
Subject: [PATCH] cmake: fix popcnt detection
|
||||
|
||||
via GCC/Clang __POPCNT__ define
|
||||
---
|
||||
cmake/checks/cpu_popcnt.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/checks/cpu_popcnt.cpp b/cmake/checks/cpu_popcnt.cpp
|
||||
index 16e5575108b..44c7deda053 100644
|
||||
--- a/cmake/checks/cpu_popcnt.cpp
|
||||
+++ b/cmake/checks/cpu_popcnt.cpp
|
||||
@@ -4,12 +4,14 @@
|
||||
# define CV_POPCNT_U64 _mm_popcnt_u64
|
||||
# endif
|
||||
# define CV_POPCNT_U32 _mm_popcnt_u32
|
||||
-#else
|
||||
+#elif defined(__POPCNT__)
|
||||
# include <popcntintrin.h>
|
||||
# if defined(__x86_64__)
|
||||
# define CV_POPCNT_U64 __builtin_popcountll
|
||||
# endif
|
||||
# define CV_POPCNT_U32 __builtin_popcount
|
||||
+#else
|
||||
+# error "__POPCNT__ is not defined by compiler"
|
||||
#endif
|
||||
|
||||
int main()
|
|
@ -0,0 +1,13 @@
|
|||
--- a/cmake/OpenCVDetectPython.cmake 2018-05-31 09:14:42.998873104 +0200
|
||||
+++ b/cmake/OpenCVDetectPython.cmake 2018-05-31 09:26:08.444914001 +0200
|
||||
@@ -140,8 +140,8 @@
|
||||
else() #debian based assumed, install to the dist-packages.
|
||||
set(_packages_path "python${_version_major_minor}/dist-packages")
|
||||
endif()
|
||||
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
|
||||
- set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
|
||||
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIBPY_SUFFIX}/${${packages_path}}")
|
||||
+ set(_packages_path "lib${LIBPY_SUFFIX}/${_packages_path}")
|
||||
else()
|
||||
set(_packages_path "lib/${_packages_path}")
|
||||
endif()
|
|
@ -0,0 +1,12 @@
|
|||
diff -urN a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp
|
||||
--- a/modules/python/src2/cv2.cpp 2018-02-23 11:38:33.000000000 +0300
|
||||
+++ b/modules/python/src2/cv2.cpp 2019-08-10 22:28:03.337071791 +0300
|
||||
@@ -886,7 +886,7 @@
|
||||
(void)name;
|
||||
if(!obj || obj == Py_None)
|
||||
return true;
|
||||
- char* str = PyString_AsString(obj);
|
||||
+ const char* str = PyString_AsString(obj);
|
||||
if(!str)
|
||||
return false;
|
||||
value = String(str);
|
|
@ -0,0 +1,42 @@
|
|||
--- a/CMakeLists.txt 2019-01-10 19:29:06.831367707 +0100
|
||||
+++ b/CMakeLists.txt 2019-01-10 19:30:11.125364384 +0100
|
||||
@@ -522,23 +522,23 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Autodetect if we are in a GIT repository
|
||||
# ----------------------------------------------------------------------------
|
||||
-find_host_package(Git QUIET)
|
||||
+# find_host_package(Git QUIET)
|
||||
|
||||
-if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
|
||||
- execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
|
||||
- WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
|
||||
- OUTPUT_VARIABLE OPENCV_VCSVERSION
|
||||
- RESULT_VARIABLE GIT_RESULT
|
||||
- ERROR_QUIET
|
||||
- OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
- )
|
||||
- if(NOT GIT_RESULT EQUAL 0)
|
||||
- set(OPENCV_VCSVERSION "unknown")
|
||||
- endif()
|
||||
-elseif(NOT DEFINED OPENCV_VCSVERSION)
|
||||
- # We don't have git:
|
||||
- set(OPENCV_VCSVERSION "unknown")
|
||||
-endif()
|
||||
+# if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
|
||||
+# execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
|
||||
+# WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
|
||||
+# OUTPUT_VARIABLE OPENCV_VCSVERSION
|
||||
+# RESULT_VARIABLE GIT_RESULT
|
||||
+# ERROR_QUIET
|
||||
+# OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
+# )
|
||||
+# if(NOT GIT_RESULT EQUAL 0)
|
||||
+# set(OPENCV_VCSVERSION "unknown")
|
||||
+# endif()
|
||||
+# elseif(NOT DEFINED OPENCV_VCSVERSION)
|
||||
+# # We don't have git:
|
||||
+# set(OPENCV_VCSVERSION "unknown")
|
||||
+#endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>amynka@gentoo.org</email>
|
||||
<name>Amy Liffey</name>
|
||||
</maintainer>
|
||||
<longdescription>
|
||||
OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real time computer vision.
|
||||
Example applications of the OpenCV library are Human-Computer Interaction (HCI); Object Identification, Segmentation and Recognition;
|
||||
Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Understanding; Structure From Motion (SFM); and Mobile Robotics.
|
||||
</longdescription>
|
||||
<use>
|
||||
<flag name="contrib">Install user contributed scripts from opencv_contrib (Experimental!)</flag>
|
||||
<flag name="cuda">Enable NVIDIA Cuda computations support (Experimental!)</flag>
|
||||
<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
|
||||
<flag name="gdal">Enable support for sci-libs/gdal library</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="gflags">Use Google's C++ argument parsing library</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="glog">Use Google's C++ loggin library</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="contrib_xfeatures2d">Enables xfeatures2d and autodownload of samples in contrib</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="contrib_cvv">CVV module requires Qt5</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.3.0" name="contrib_dnn">DNN module contrib requires tiny dnn</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="contrib_hdf">HDF module requires <pkg>sci-libs/hdf5</pkg></flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="contrib_sfm">SFM module requires eigen, gflags, and glog</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.4.0" name="dnn_samples">Download dnn caffeemodel samples</flag>
|
||||
<flag name="opencl">Add support for OpenCL</flag>
|
||||
<flag restrict=">=media-libs/opencv-3.1.0" name="tesseract">Use Google's OCR Engine</flag>
|
||||
<flag name="testprograms">Build and install programs for testing OpenCV (performance)</flag>
|
||||
<flag name="vtk">Build new 3D visualization module viz based on sci-libs/vtk</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="cpe">cpe:/a:opencv:opencv</remote-id>
|
||||
<remote-id type="sourceforge">opencvlibrary</remote-id>
|
||||
<remote-id type="github">Itseez/opencv_contrib</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
|
@ -0,0 +1,513 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# ###########################################################
|
||||
# This is a temporary hack for https://bugs.gentoo.org/699730
|
||||
# Ebuild will be removed as sonn as it is fixed.
|
||||
# ###########################################################
|
||||
|
||||
EAPI=7
|
||||
|
||||
PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
|
||||
|
||||
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
|
||||
inherit java-pkg-opt-2 java-ant-2 python-r1 toolchain-funcs cmake-multilib
|
||||
|
||||
DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
|
||||
HOMEPAGE="https://opencv.org"
|
||||
TINY_DNN_PV="1.0.0a3"
|
||||
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
|
||||
dnn_samples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
|
||||
contrib? (
|
||||
https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
|
||||
contrib_dnn? (
|
||||
https://github.com/tiny-dnn/tiny-dnn/archive/v${TINY_DNN_PV}.tar.gz -> tiny-dnn-${TINY_DNN_PV}.tar.gz
|
||||
https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz
|
||||
)
|
||||
contrib_xfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
|
||||
)"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0/3.4.1" # subslot = libopencv* soname version
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux"
|
||||
IUSE="contrib contrib_cvv contrib_dnn contrib_hdf contrib_sfm contrib_xfeatures2d cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_ssse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_popcnt cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cuda debug dnn_samples +eigen examples ffmpeg gdal gflags glog gphoto2 gstreamer gtk ieee1394 jpeg lapack libav opencl openexr opengl openmp pch png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
|
||||
# OpenGL needs gtk or Qt installed to activate, otherwise build system
|
||||
# will silently disable it Wwithout the user knowing, which defeats the
|
||||
# purpose of the opengl use flag.
|
||||
REQUIRED_USE="
|
||||
cuda? ( tesseract? ( opencl ) )
|
||||
dnn_samples? ( examples )
|
||||
gflags? ( contrib )
|
||||
glog? ( contrib )
|
||||
contrib_cvv? ( contrib qt5 )
|
||||
contrib_dnn? ( contrib )
|
||||
contrib_hdf? ( contrib )
|
||||
contrib_sfm? ( contrib eigen gflags glog )
|
||||
contrib_xfeatures2d? ( contrib cuda )
|
||||
java? ( python )
|
||||
opengl? ( || ( gtk qt5 ) )
|
||||
python? ( ${PYTHON_REQUIRED_USE} )
|
||||
tesseract? ( contrib )"
|
||||
|
||||
# The following logic is intrinsic in the build system, but we do not enforce
|
||||
# it on the useflags since this just blocks emerging pointlessly:
|
||||
# gtk? ( !qt5 )
|
||||
# openmp? ( !threads )
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2[${MULTILIB_USEDEP}]
|
||||
dev-libs/protobuf:=[${MULTILIB_USEDEP}]
|
||||
sys-libs/zlib[${MULTILIB_USEDEP}]
|
||||
cuda? ( dev-util/nvidia-cuda-toolkit:0= )
|
||||
contrib_hdf? ( sci-libs/hdf5 )
|
||||
ffmpeg? (
|
||||
libav? ( media-video/libav:0=[${MULTILIB_USEDEP}] )
|
||||
!libav? ( media-video/ffmpeg:0=[${MULTILIB_USEDEP}] )
|
||||
)
|
||||
gdal? ( sci-libs/gdal:= )
|
||||
gflags? ( dev-cpp/gflags[${MULTILIB_USEDEP}] )
|
||||
glog? ( dev-cpp/glog[${MULTILIB_USEDEP}] )
|
||||
gphoto2? ( media-libs/libgphoto2[${MULTILIB_USEDEP}] )
|
||||
gstreamer? (
|
||||
media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
|
||||
media-libs/gst-plugins-base:1.0[${MULTILIB_USEDEP}]
|
||||
)
|
||||
gtk? (
|
||||
dev-libs/glib:2[${MULTILIB_USEDEP}]
|
||||
x11-libs/gtk+:2[${MULTILIB_USEDEP}]
|
||||
opengl? ( x11-libs/gtkglext[${MULTILIB_USEDEP}] )
|
||||
)
|
||||
ieee1394? (
|
||||
media-libs/libdc1394[${MULTILIB_USEDEP}]
|
||||
sys-libs/libraw1394[${MULTILIB_USEDEP}]
|
||||
)
|
||||
java? ( >=virtual/jre-1.6:* )
|
||||
jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
|
||||
lapack? ( virtual/lapack )
|
||||
opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
|
||||
openexr? ( media-libs/openexr[${MULTILIB_USEDEP}] )
|
||||
opengl? (
|
||||
virtual/opengl[${MULTILIB_USEDEP}]
|
||||
virtual/glu[${MULTILIB_USEDEP}]
|
||||
)
|
||||
png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
|
||||
python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
|
||||
qt5? (
|
||||
dev-qt/qtgui:5
|
||||
dev-qt/qtwidgets:5
|
||||
dev-qt/qttest:5
|
||||
dev-qt/qtconcurrent:5
|
||||
opengl? ( dev-qt/qtopengl:5 )
|
||||
)
|
||||
tesseract? ( app-text/tesseract[opencl=] )
|
||||
threads? ( dev-cpp/tbb[${MULTILIB_USEDEP}] )
|
||||
tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
|
||||
v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
|
||||
vtk? ( sci-libs/vtk[rendering] )
|
||||
webp? ( media-libs/libwebp[${MULTILIB_USEDEP}] )
|
||||
xine? ( media-libs/xine-lib )"
|
||||
DEPEND="${RDEPEND}
|
||||
virtual/pkgconfig[${MULTILIB_USEDEP}]
|
||||
contrib_dnn? ( dev-libs/cereal )
|
||||
eigen? ( dev-cpp/eigen:3 )
|
||||
java? ( >=virtual/jdk-1.6 )
|
||||
vaapi? ( x11-libs/libva )"
|
||||
|
||||
MULTILIB_WRAPPED_HEADERS=(
|
||||
/usr/include/opencv2/cvconfig.h
|
||||
/usr/include/opencv2/opencv_modules.hpp
|
||||
# [contrib_cvv]
|
||||
/usr/include/opencv2/cvv.hpp
|
||||
/usr/include/opencv2/cvv/call_meta_data.hpp
|
||||
/usr/include/opencv2/cvv/cvv.hpp
|
||||
/usr/include/opencv2/cvv/debug_mode.hpp
|
||||
/usr/include/opencv2/cvv/dmatch.hpp
|
||||
/usr/include/opencv2/cvv/filter.hpp
|
||||
/usr/include/opencv2/cvv/final_show.hpp
|
||||
/usr/include/opencv2/cvv/show_image.hpp
|
||||
# [contrib_hdf]
|
||||
/usr/include/opencv2/hdf.hpp
|
||||
/usr/include/opencv2/hdf/hdf5.hpp
|
||||
# [vtk]
|
||||
/usr/include/opencv2/viz.hpp
|
||||
/usr/include/opencv2/viz/types.hpp
|
||||
/usr/include/opencv2/viz/viz3d.hpp
|
||||
/usr/include/opencv2/viz/vizcore.hpp
|
||||
/usr/include/opencv2/viz/widget_accessor.hpp
|
||||
/usr/include/opencv2/viz/widgets.hpp
|
||||
# [cudev]
|
||||
/usr/include/opencv2/cudaarithm.hpp
|
||||
/usr/include/opencv2/cudabgsegm.hpp
|
||||
/usr/include/opencv2/cudacodec.hpp
|
||||
/usr/include/opencv2/cudafeatures2d.hpp
|
||||
/usr/include/opencv2/cudafilters.hpp
|
||||
/usr/include/opencv2/cudaimgproc.hpp
|
||||
/usr/include/opencv2/cudalegacy.hpp
|
||||
/usr/include/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
|
||||
/usr/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
|
||||
/usr/include/opencv2/cudalegacy/NCV.hpp
|
||||
/usr/include/opencv2/cudalegacy/NCVPyramid.hpp
|
||||
/usr/include/opencv2/cudalegacy/NPP_staging.hpp
|
||||
/usr/include/opencv2/cudaobjdetect.hpp
|
||||
/usr/include/opencv2/cudaoptflow.hpp
|
||||
/usr/include/opencv2/cudastereo.hpp
|
||||
/usr/include/opencv2/cudawarping.hpp
|
||||
/usr/include/opencv2/cudev/block/block.hpp
|
||||
/usr/include/opencv2/cudev/block/detail/reduce.hpp
|
||||
/usr/include/opencv2/cudev/block/detail/reduce_key_val.hpp
|
||||
/usr/include/opencv2/cudev/block/dynamic_smem.hpp
|
||||
/usr/include/opencv2/cudev/block/reduce.hpp
|
||||
/usr/include/opencv2/cudev/block/scan.hpp
|
||||
/usr/include/opencv2/cudev/block/vec_distance.hpp
|
||||
/usr/include/opencv2/cudev/common.hpp
|
||||
/usr/include/opencv2/cudev/expr/binary_func.hpp
|
||||
/usr/include/opencv2/cudev/expr/binary_op.hpp
|
||||
/usr/include/opencv2/cudev/expr/color.hpp
|
||||
/usr/include/opencv2/cudev/expr/deriv.hpp
|
||||
/usr/include/opencv2/cudev/expr/expr.hpp
|
||||
/usr/include/opencv2/cudev/expr/per_element_func.hpp
|
||||
/usr/include/opencv2/cudev/expr/reduction.hpp
|
||||
/usr/include/opencv2/cudev/expr/unary_func.hpp
|
||||
/usr/include/opencv2/cudev/expr/unary_op.hpp
|
||||
/usr/include/opencv2/cudev/expr/warping.hpp
|
||||
/usr/include/opencv2/cudev/functional/color_cvt.hpp
|
||||
/usr/include/opencv2/cudev/functional/detail/color_cvt.hpp
|
||||
/usr/include/opencv2/cudev/functional/functional.hpp
|
||||
/usr/include/opencv2/cudev/functional/tuple_adapter.hpp
|
||||
/usr/include/opencv2/cudev/grid/copy.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/copy.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/histogram.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/integral.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/minmaxloc.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/pyr_down.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/pyr_up.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/reduce.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/reduce_to_column.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/reduce_to_row.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/split_merge.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/transform.hpp
|
||||
/usr/include/opencv2/cudev/grid/detail/transpose.hpp
|
||||
/usr/include/opencv2/cudev/grid/histogram.hpp
|
||||
/usr/include/opencv2/cudev/grid/integral.hpp
|
||||
/usr/include/opencv2/cudev/grid/pyramids.hpp
|
||||
/usr/include/opencv2/cudev/grid/reduce.hpp
|
||||
/usr/include/opencv2/cudev/grid/reduce_to_vec.hpp
|
||||
/usr/include/opencv2/cudev/grid/split_merge.hpp
|
||||
/usr/include/opencv2/cudev/grid/transform.hpp
|
||||
/usr/include/opencv2/cudev/grid/transpose.hpp
|
||||
/usr/include/opencv2/cudev.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/constant.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/deriv.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/detail/gpumat.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/extrapolation.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/glob.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/gpumat.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/interpolation.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/lut.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/mask.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/remap.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/resize.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/texture.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/traits.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/transform.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/warping.hpp
|
||||
/usr/include/opencv2/cudev/ptr2d/zip.hpp
|
||||
/usr/include/opencv2/cudev/util/atomic.hpp
|
||||
/usr/include/opencv2/cudev/util/detail/tuple.hpp
|
||||
/usr/include/opencv2/cudev/util/detail/type_traits.hpp
|
||||
/usr/include/opencv2/cudev/util/limits.hpp
|
||||
/usr/include/opencv2/cudev/util/saturate_cast.hpp
|
||||
/usr/include/opencv2/cudev/util/simd_functions.hpp
|
||||
/usr/include/opencv2/cudev/util/tuple.hpp
|
||||
/usr/include/opencv2/cudev/util/type_traits.hpp
|
||||
/usr/include/opencv2/cudev/util/vec_math.hpp
|
||||
/usr/include/opencv2/cudev/util/vec_traits.hpp
|
||||
/usr/include/opencv2/cudev/warp/detail/reduce.hpp
|
||||
/usr/include/opencv2/cudev/warp/detail/reduce_key_val.hpp
|
||||
/usr/include/opencv2/cudev/warp/reduce.hpp
|
||||
/usr/include/opencv2/cudev/warp/scan.hpp
|
||||
/usr/include/opencv2/cudev/warp/shuffle.hpp
|
||||
/usr/include/opencv2/cudev/warp/warp.hpp
|
||||
)
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-3.0.0-gles.patch"
|
||||
"${FILESDIR}/${PN}-3.4.0-disable-download.patch"
|
||||
"${FILESDIR}/${P}-compilation-C-mode.patch" # https://bugs.gentoo.org/656530
|
||||
"${FILESDIR}/${P}-python-lib-suffix-hack.patch"
|
||||
"${FILESDIR}/${P}-cuda-add-relaxed-constexpr.patch"
|
||||
"${FILESDIR}/${P}-remove-git-autodetect.patch"
|
||||
"${FILESDIR}/${P}-fix-build-with-va.patch" # bug https://bugs.gentoo.org/656576
|
||||
"${FILESDIR}/${P}-popcnt.patch" # https://bugs.gentoo.org/633900
|
||||
"${FILESDIR}/${P}-fix-on-x86.patch" # https://bugs.gentoo.org/682104
|
||||
"${FILESDIR}/${P}-python37.patch" # https://bugs.gentoo.org/691480
|
||||
)
|
||||
|
||||
pkg_pretend() {
|
||||
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
||||
java-pkg-opt-2_pkg_setup
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
cmake-utils_src_prepare
|
||||
|
||||
# remove bundled stuff
|
||||
rm -rf 3rdparty || die "Removing 3rd party components failed"
|
||||
sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
|
||||
-i CMakeLists.txt cmake/*cmake || die
|
||||
|
||||
if use dnn_samples; then
|
||||
mv "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
|
||||
fi
|
||||
|
||||
if use contrib; then
|
||||
cd "${WORKDIR}/${PN}_contrib-${PV}" || die
|
||||
eapply "${FILESDIR}/${PN}-3.3.0-remove-tiny-dnn-autodownload.patch"
|
||||
|
||||
if use contrib_xfeatures2d; then
|
||||
mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
|
||||
fi
|
||||
fi
|
||||
|
||||
java-pkg-opt-2_src_prepare
|
||||
|
||||
# this really belongs in src_prepare() too
|
||||
JAVA_ANT_ENCODING="iso-8859-1"
|
||||
# set encoding so even this cmake build will pick it up.
|
||||
export ANT_OPTS+=" -Dfile.encoding=iso-8859-1"
|
||||
java-ant-2_src_configure
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
# please dont sort here, order is the same as in CMakeLists.txt
|
||||
GLOBALCMAKEARGS=(
|
||||
# Optional 3rd party components
|
||||
# ===================================================
|
||||
-DENABLE_DOWNLOAD=OFF
|
||||
-DWITH_1394=$(usex ieee1394)
|
||||
# -DWITH_AVFOUNDATION=OFF # IOS
|
||||
-DWITH_VTK=$(multilib_native_usex vtk)
|
||||
-DWITH_EIGEN=$(usex eigen)
|
||||
-DWITH_VFW=OFF # Video windows support
|
||||
-DWITH_FFMPEG=$(usex ffmpeg)
|
||||
-DWITH_GSTREAMER=$(usex gstreamer)
|
||||
-DWITH_GSTREAMER_0_10=OFF # Don't want this
|
||||
-DWITH_GTK=$(usex gtk)
|
||||
-DWITH_GTK_2_X=$(usex gtk)
|
||||
-DWITH_IPP=OFF
|
||||
-DWITH_JASPER=OFF
|
||||
-DWITH_JPEG=$(usex jpeg)
|
||||
-DWITH_WEBP=$(usex webp)
|
||||
-DWITH_OPENEXR=$(usex openexr)
|
||||
-DWITH_OPENGL=$(usex opengl)
|
||||
-DWITH_OPENVX=OFF
|
||||
-DWITH_OPENNI=OFF # Not packaged
|
||||
-DWITH_OPENNI2=OFF # Not packaged
|
||||
-DWITH_PNG=$(usex png)
|
||||
-DWITH_GDCM=OFF
|
||||
-DWITH_PVAPI=OFF
|
||||
-DWITH_GIGEAPI=OFF
|
||||
-DWITH_ARAVIS=OFF
|
||||
-DWITH_QT=$(multilib_native_usex qt5 5 OFF)
|
||||
-DWITH_WIN32UI=OFF # Windows only
|
||||
# -DWITH_QUICKTIME=OFF
|
||||
# -DWITH_QTKIT=OFF
|
||||
-DWITH_TBB=$(usex threads)
|
||||
-DWITH_OPENMP=$(usex openmp)
|
||||
-DWITH_CSTRIPES=OFF
|
||||
-DWITH_PTHREADS_PF=ON
|
||||
-DWITH_TIFF=$(usex tiff)
|
||||
-DWITH_UNICAP=OFF # Not packaged
|
||||
-DWITH_V4L=$(usex v4l)
|
||||
-DWITH_LIBV4L=$(usex v4l)
|
||||
-DWITH_DSHOW=ON # direct show supp
|
||||
-DWITH_MSMF=OFF
|
||||
-DWITH_XIMEA=OFF # Windows only
|
||||
-DWITH_XINE=$(multilib_native_usex xine)
|
||||
-DWITH_CLP=OFF
|
||||
-DWITH_OPENCL=$(usex opencl)
|
||||
-DWITH_OPENCL_SVM=OFF
|
||||
-DWITH_OPENCLAMDFFT=$(usex opencl)
|
||||
-DWITH_OPENCLAMDBLAS=$(usex opencl)
|
||||
-DWITH_DIRECTX=OFF
|
||||
-DWITH_INTELPERC=OFF
|
||||
-DWITH_IPP_A=OFF
|
||||
-DWITH_MATLAB=OFF
|
||||
-DWITH_VA=$(usex vaapi)
|
||||
-DWITH_VA_INTEL=$(usex vaapi)
|
||||
-DWITH_GDAL=$(multilib_native_usex gdal)
|
||||
-DWITH_GPHOTO2=$(usex gphoto2)
|
||||
-DWITH_LAPACK=$(multilib_native_usex lapack)
|
||||
-DWITH_ITT=OFF # 3dparty libs itt_notify
|
||||
# ===================================================
|
||||
# CUDA build components: nvidia-cuda-toolkit takes care of GCC version
|
||||
# ===================================================
|
||||
-DWITH_CUDA=$(multilib_native_usex cuda)
|
||||
-DWITH_CUBLAS=$(multilib_native_usex cuda)
|
||||
-DWITH_CUFFT=$(multilib_native_usex cuda)
|
||||
-DWITH_NVCUVID=OFF
|
||||
# -DWITH_NVCUVID=$(usex cuda)
|
||||
-DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "")
|
||||
# ===================================================
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DBUILD_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
|
||||
-DBUILD_ANDROID_EXAMPLES=OFF
|
||||
-DBUILD_opencv_apps=
|
||||
-DBUILD_DOCS=OFF # Doesn't install anyways.
|
||||
-DBUILD_EXAMPLES=$(multilib_native_usex examples)
|
||||
-DBUILD_PERF_TESTS=OFF
|
||||
-DBUILD_TESTS=$(multilib_native_usex testprograms)
|
||||
-DBUILD_WITH_DEBUG_INFO=$(usex debug)
|
||||
# -DBUILD_WITH_STATIC_CRT=OFF
|
||||
-DBUILD_WITH_DYNAMIC_IPP=OFF
|
||||
-DBUILD_FAT_JAVA_LIB=$(multilib_native_usex java)
|
||||
# -DBUILD_ANDROID_SERVICE=OFF
|
||||
-DBUILD_CUDA_STUBS=$(multilib_native_usex cuda)
|
||||
-DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/opencv_contrib-${PV}/modules" "")
|
||||
# ===================================================
|
||||
# OpenCV installation options
|
||||
# ===================================================
|
||||
-DINSTALL_CREATE_DISTRIB=OFF
|
||||
-DINSTALL_C_EXAMPLES=$(multilib_native_usex examples)
|
||||
-DINSTALL_TESTS=$(multilib_native_usex testprograms)
|
||||
-DINSTALL_PYTHON_EXAMPLES=$(multilib_native_usex examples)
|
||||
# -DINSTALL_ANDROID_EXAMPLES=OFF
|
||||
-DINSTALL_TO_MANGLED_PATHS=OFF
|
||||
# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
|
||||
# to set its destination libdir
|
||||
-DLIB_SUFFIX=
|
||||
# ===================================================
|
||||
# OpenCV build options
|
||||
# ===================================================
|
||||
-DENABLE_CCACHE=OFF
|
||||
-DENABLE_PRECOMPILED_HEADERS=$(usex pch)
|
||||
-DENABLE_SOLUTION_FOLDERS=OFF
|
||||
-DENABLE_PROFILING=OFF
|
||||
-DENABLE_COVERAGE=OFF
|
||||
|
||||
-DHAVE_opencv_java=$(multilib_native_usex java YES NO)
|
||||
-DENABLE_NOISY_WARNINGS=OFF
|
||||
-DOPENCV_WARNINGS_ARE_ERRORS=OFF
|
||||
-DENABLE_IMPL_COLLECTION=OFF
|
||||
-DENABLE_INSTRUMENTATION=OFF
|
||||
-DGENERATE_ABI_DESCRIPTOR=OFF
|
||||
-DDOWNLOAD_EXTERNAL_TEST_DATA=OFF
|
||||
# ===================================================
|
||||
# things we want to be hard off or not yet figured out
|
||||
# ===================================================
|
||||
-DBUILD_PACKAGE=OFF
|
||||
# ===================================================
|
||||
# Not building protobuf but update files bug #631418
|
||||
# ===================================================
|
||||
-DBUILD_PROTOBUF=OFF
|
||||
-DPROTOBUF_UPDATE_FILES=ON
|
||||
# ===================================================
|
||||
# things we want to be hard enabled not worth useflag
|
||||
# ===================================================
|
||||
-DCMAKE_SKIP_RPATH=ON
|
||||
-DOPENCV_DOC_INSTALL_PATH=
|
||||
# ==================================================
|
||||
# cpu flags, should solve 633900
|
||||
#===================================================
|
||||
-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
|
||||
-DCPU_DISPATCH=
|
||||
-DENABLE_SSE=$(usex cpu_flags_x86_sse)
|
||||
-DENABLE_SSE2=$(usex cpu_flags_x86_sse2)
|
||||
-DENABLE_SSE3=$(usex cpu_flags_x86_sse3)
|
||||
-DENABLE_SSSE3=$(usex cpu_flags_x86_ssse3)
|
||||
-DENABLE_SSE41=$(usex cpu_flags_x86_sse4_1)
|
||||
-DENABLE_SSE42=$(usex cpu_flags_x86_sse4_2)
|
||||
-DENABLE_POPCNT=$(usex cpu_flags_x86_popcnt)
|
||||
-DENABLE_AVX=$(usex cpu_flags_x86_avx)
|
||||
-DENABLE_AVX2=$(usex cpu_flags_x86_avx2)
|
||||
-DENABLE_FMA3=$(usex cpu_flags_x86_fma3)
|
||||
)
|
||||
|
||||
# ===================================================
|
||||
# OpenCV Contrib Modules
|
||||
# ===================================================
|
||||
if use contrib; then
|
||||
GLOBALCMAKEARGS+=(
|
||||
-DBUILD_opencv_dnn=$(usex contrib_dnn ON OFF)
|
||||
-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
|
||||
-DBUILD_opencv_dnns_easily_fooled=OFF
|
||||
-DBUILD_opencv_xfeatures2d=$(usex contrib_xfeatures2d ON OFF)
|
||||
-DBUILD_opencv_cvv=$(usex contrib_cvv ON OFF)
|
||||
-DBUILD_opencv_hdf=$(multilib_native_usex contrib_hdf ON OFF)
|
||||
-DBUILD_opencv_sfm=$(usex contrib_sfm ON OFF)
|
||||
)
|
||||
|
||||
if multilib_is_native_abi; then
|
||||
GLOBALCMAKEARGS+=(
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=$(usex !tesseract)
|
||||
)
|
||||
else
|
||||
GLOBALCMAKEARGS+=(
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=ON
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
# workaround for bug 413429
|
||||
tc-export CC CXX
|
||||
|
||||
local mycmakeargs=( ${GLOBALCMAKEARGS[@]}
|
||||
-DPYTHON_EXECUTABLE=OFF
|
||||
-DINSTALL_PYTHON_EXAMPLES=OFF
|
||||
)
|
||||
|
||||
cmake-utils_src_configure
|
||||
|
||||
# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
|
||||
# TODO patch ocv_download to copy files into destination dirs
|
||||
if use contrib_dnn; then
|
||||
mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
|
||||
cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
python_module_compile() {
|
||||
local BUILD_DIR=${orig_BUILD_DIR}
|
||||
local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
|
||||
|
||||
# Set all python variables to load the correct Gentoo paths
|
||||
mycmakeargs+=(
|
||||
# python_setup alters PATH and sets this as wrapper
|
||||
# to the correct interpreter we are building for
|
||||
-DPYTHON_DEFAULT_EXECUTABLE=python
|
||||
-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
|
||||
|
||||
# Here's the hack for profile 17.1
|
||||
# -DLIBPY_SUFFIX=64
|
||||
|
||||
)
|
||||
|
||||
# Regenerate cache file. Can't use rebuild_cache as it won't
|
||||
# have the Gentoo specific options.
|
||||
rm -rf CMakeCache.txt || die "rm failed"
|
||||
cmake-utils_src_configure
|
||||
cmake-utils_src_compile
|
||||
cmake-utils_src_install
|
||||
|
||||
# Remove compiled binary so new version compiles
|
||||
# Avoid conflicts with new module builds as build system doesn't
|
||||
# really support it.
|
||||
rm -rf modules/python2 || die "rm failed"
|
||||
}
|
||||
|
||||
multilib_src_install() {
|
||||
cmake-utils_src_install
|
||||
|
||||
# Build and install the python modules for all targets
|
||||
if multilib_is_native_abi && use python; then
|
||||
local orig_BUILD_DIR=${BUILD_DIR}
|
||||
python_foreach_impl python_module_compile
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue