{"id":2523,"date":"2018-02-15T21:31:28","date_gmt":"2018-02-15T12:31:28","guid":{"rendered":"http:\/\/daily.belltail.jp\/?p=2523"},"modified":"2018-06-07T14:39:19","modified_gmt":"2018-06-07T05:39:19","slug":"opencv%e3%83%93%e3%83%ab%e3%83%89%e6%99%82%e3%81%abcmake%e3%81%8c%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9fpython%e3%81%ae%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%82%92%e3%81%86%e3%81%be%e3%81%8f","status":"publish","type":"post","link":"https:\/\/daily.belltail.jp\/?p=2523","title":{"rendered":"OpenCV\u91ce\u826f\u30d3\u30eb\u30c9\u6642\u306bCMake\u304c\u6307\u5b9a\u3057\u305fPython\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u3046\u307e\u304f\u898b\u3064\u3051\u3066\u304f\u308c\u306a\u3044\u6642\u306f"},"content":{"rendered":"<p>OpenCV\u3092Python\u30b5\u30dd\u30fc\u30c8\u8fbc\u307f\u3067\u30d3\u30eb\u30c9\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nPython\u5074\u3078\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u9732\u51fa\u3059\u308b\u305f\u3081\u306e\u30d8\u30c3\u30c0\u306a\u3069\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u306ePython\u95a2\u9023\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u308c\u3070\u3001\u3042\u3068\u306f\u30b7\u30f3\u30d7\u30eb\u306bCMake\u3092\u5b9f\u884c\u3059\u308c\u3070\u3088\u3044\u3053\u3068\u304c\u307b\u3068\u3093\u3069\u3067\u3059\u3002<br \/>\n\uff08\u305d\u306e\u3084\u308a\u65b9\u306f\u30cd\u30c3\u30c8\u306b\u305f\u304f\u3055\u3093\u307e\u3068\u307e\u3063\u3066\u3044\u308b\u306e\u3067\u4ed6\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\uff09<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n% sudo apt-get install python2.7-dev python3.4-dev #\u306a\u3069\u306a\u3069\u3002\r\n% cd \/path\/to\/opencv\/source\/root\r\n% mkdir build; cd build\r\n% cmake -DBUILD_opencv_python2=ON -DBUILD_opencv_python3=ON ..\r\n<\/pre>\n<p>\u4e00\u65b9\u3067\u3001root\u304c\u306a\u3044\u306a\u3069\u306e\u72b6\u6cc1\u3067python2.7-dev\u306a\u3069\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30b7\u30b9\u30c6\u30e0\u306b\u306a\u3044\u5834\u5408\u306f\u3001\u4f8b\u3048\u3070pyenv\u3092\u4f7f\u3063\u3066\u4e00\u6642\u7684\u306bpython\u3092\u30e6\u30fc\u30b6\u74b0\u5883\u306b\u5165\u308c\u305d\u306e\u30d1\u30b9\u3092\u53c2\u7167\u3055\u305b\u308b\u3053\u3068\u3067\u3001Python\u5bfe\u5fdc\u3053\u307f\u3067\u30d3\u30eb\u30c9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\uff08\u30d3\u30eb\u30c9\u304c\u304a\u308f\u3063\u305f\u3089\u4e00\u6642\u7684\u306b\u5165\u308c\u305fPython\u74b0\u5883\u306f\u6d88\u3057\u3066OK\u3067\u3059\uff09<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n% pyenv install miniconda2-latest\r\n% pyenv install miniconda3-latest\r\n% cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$HOME \\\r\n        -DBUILD_opencv_python2=ON \\\r\n        -DPYTHON2_EXECUTABLE=`pyenv local miniconda2-latest; pyenv which python` \\\r\n        -DPYTHON2_INCLUDE_DIR=`pyenv local miniconda2-latest; python -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())'` \\\r\n        -DPYTHON2_NUMPY_INCLUDE_DIRS=`pyenv local miniconda2-latest; python -c 'import numpy; print(numpy.get_include())'` \\\r\n        -DPYTHON2_LIBRARIES=`find $PYENV_ROOT\/versions\/miniconda2-latest\/lib -name 'libpython*.so'` \\\r\n        -DBUILD_opencv_python3=ON \\\r\n        -DPYTHON3_EXECUTABLE=`pyenv local miniconda3-latest; pyenv which python` \\\r\n        -DPYTHON3_INCLUDE_DIR=`pyenv local miniconda3-latest; python -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())'` \\\r\n        -DPYTHON3_NUMPY_INCLUDE_DIRS=`pyenv local miniconda3-latest; python -c 'import numpy; print(numpy.get_include())'` \\\r\n        -DPYTHON3_LIBRARIES=`find $PYENV_ROOT\/versions\/miniconda3-latest\/lib -name 'libpython*.so'` \\\r\n        ..\r\n<\/pre>\n<p>\u3053\u306e\u3068\u304d\u3001CMake\u3092\u8d70\u3089\u305b\u305f\u3068\u304d\u306e\u5e8f\u76e4\u306b\u3053\u3093\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u305f\u308a\uff08PythonLibs\u3092\u898b\u3064\u3051\u3089\u308c\u3066\u306a\u304b\u3063\u305f\u308a\u3001\u610f\u56f3\u3057\u305f\u306e\u3068\u9055\u3046\u3082\u306e\u3092\u898b\u3064\u3051\u306b\u884c\u3063\u3066\u308b\uff09\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n -- Found PythonInterp: \/home\/xxxx\/.pyenv\/versions\/miniconda2-latest\/bin\/python (found suitable version &quot;2.7.14&quot;, minimum required is &quot;2.7&quot;)\r\n -- Found PythonLibs: \/usr\/lib\/x86_64-linux-gnu\/libpython2.7.so (found suitable exact version &quot;2.7.14&quot;)\r\n -- Found PythonInterp: \/home\/xxxx\/.pyenv\/versions\/miniconda3-latest\/bin\/python (found suitable version &quot;3.6.3&quot;, minimum required is &quot;3.4&quot;)\r\n -- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (found suitable exact version &quot;3.6.3&quot;)\r\n<\/pre>\n<p>CMake\u306e\u6700\u5f8c\u306e\u7d50\u679c\u8868\u793a\u306e\u3068\u304d\u306b\u3053\u3093\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u305f\u308a\uff08Libraries\u304cNO\uff09\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n --   Python 2:\r\n --     Interpreter:                 \/home\/xxxx\/.pyenv\/versions\/miniconda2-latest\/bin\/python (ver 2.7.14)\r\n --     Libraries:                   NO\r\n --     numpy:                       \/home\/xxxx\/.pyenv\/versions\/miniconda2-latest\/lib\/python2.7\/site-packages\/numpy\/core\/include (ver 1.14.0)\r\n --     packages path:               lib\/python2.7\/site-packages\r\n --\r\n --   Python 3:\r\n --     Interpreter:                 \/home\/xxxx\/.pyenv\/versions\/miniconda3-latest\/bin\/python (ver 3.6.3)\r\n --     Libraries:                   NO\r\n --     numpy:                       \/home\/xxxx\/.pyenv\/versions\/miniconda3-latest\/lib\/python3.6\/site-packages\/numpy\/core\/include (ver 1.14.0)\r\n --     packages path:               lib\/python3.6\/site-packages\r\n<\/pre>\n<p>\u6b63\u3057\u304f\u6307\u5b9a\u3057\u305f\u306f\u305a\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30d1\u30b9\u3092CMake\u304c\u3069\u3046\u3082\u8a8d\u8b58\u3057\u3066\u304f\u308c\u306a\u3044\u69d8\u5b50\u306e\u3068\u304d\u306f\u3001CMake\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u7591\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n% cmake --version\r\ncmake version 2.8.12.2\r\n<\/pre>\n<p>2.8\u7cfb\u3067\u306f\u3001\u3046\u307e\u304fPython\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u307f\u3064\u3051\u3066\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3088\u3046\u3067\u3059\u3002<br \/>\nOpenCV\u306e\u63d0\u4f9b\u3059\u308bCMakeLists.txt\u306ecmake_minimum_required\u306f\uff08Linux\u3067\u3042\u308c\u3070\uff092.8\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u7279\u306b\u6012\u3089\u308c\u308b\u3053\u3068\u306a\u304f\u9032\u3093\u3067\u3057\u307e\u3046\u3001\u3068\u3044\u3046\u306e\u304c\u7f60\u3067\u3057\u305f\uff08\u4eca\u56de\u53d6\u308a\u4e0a\u3052\u305f\u304b\u306a\u308a\u9650\u5b9a\u7684\u306a\u30b7\u30c1\u30e5\u30a8\u30fc\u30b7\u30e7\u30f3\u4ee5\u5916\u3067\u306f\u305d\u308c\u3067\u554f\u984c\u306a\u304f\u52d5\u304f\u305f\u3081\u3067\u3059\uff09\u3002<br \/>\n\u3088\u308a\u65b0\u3057\u3044CMake 3.5\u306a\u3069\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u7279\u306bUbuntu14.04\u3092\u307e\u3060\u4f7f\u3063\u3066\u3044\u305f\u308a\u3057\u305f\u5834\u5408\u306f\u3001\u6a19\u6e96\u3067apt-get\u3057\u305f\u3082\u306e\u306f2.8\u307e\u3067\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u91ce\u826f\u30d3\u30eb\u30c9\u3059\u308b\u306a\u308a\u3001PPA\u306b\u3059\u308b\u306a\u308a\u3001\u65b0\u3057\u3044Ubuntu\u306b\u4e57\u308a\u63db\u3048\u308b\u306a\u308a\u3059\u308b\u3068\u3044\u3044\u3067\u3059\u3002<\/p>\n<p>\u81ea\u5206\u7528\u30e1\u30e2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenCV\u3092Python\u30b5\u30dd\u30fc\u30c8\u8fbc\u307f\u3067\u30d3\u30eb\u30c9\u3057\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 Python\u5074\u3078\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u9732\u51fa\u3059\u308b\u305f\u3081\u306e\u30d8\u30c3\u30c0\u306a\u3069\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u306ePython\u95a2\u9023\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u308c\u3070\u3001\u3042\u3068\u306f\u30b7\u30f3\u30d7\u30eb\u306bCMake\u3092\u5b9f\u884c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31,7,17,49,38],"class_list":["post-2523","post","type-post","status-publish","format-standard","hentry","category-1","tag-computer-vision","tag-linux","tag-opencv","tag-49","tag-38"],"_links":{"self":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts\/2523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2523"}],"version-history":[{"count":8,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts\/2523\/revisions"}],"predecessor-version":[{"id":2535,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts\/2523\/revisions\/2535"}],"wp:attachment":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}