USE PYTHON 2.7 INSTEAD OF PYTHON 3.4 AND INSTALL OPENCV 3.1
WHY: ref:http://www.pyimagesearch.com/2015/07/27/installing-opencv-3-0-for-both-python-2-7-and-python-3-on-your-raspberry-pi-2/
SOME PYTHON PACKAGES STILL USE 2.7 VERSION
http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/
1. Create a new virtualenv with python parameter point to python2.7. ref:http://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv
|
1 2 3 4 5 6 7 8 9 10 |
teddy@teddy-K43SJ:~$ mkvirtualenv --python=python2.7 opencv_p27 Running virtualenvSA with interpreter /usr/bin/python2.7 New python executable in /home/teddy/.virtualenvs/opencv_p27/bin/python2.7 Also creating executable in /home/teddy/.virtualenvs/opencv_p27/bin/python Installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27/bin/predeactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27/bin/postdeactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27/bin/preactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27/bin/postactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27/bin/get_env_details |
2. Check python version:
|
1 2 3 4 5 |
(opencv_p27) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> quit() |
2.b Just Check python version in another virtualenv (opencv):
|
1 2 3 4 5 6 7 |
(opencv_p27) teddy@teddy-K43SJ:~$ deactivate teddy@teddy-K43SJ:~$ workon opencv (opencv) teddy@teddy-K43SJ:~$ python Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> quit() |
OK. PYTHON VERSION IN ANOTHER VIRTUALENV NOT CHANGED (STILL 3.4)
3. Check pip version:
|
1 2 |
(opencv_p27) teddy@teddy-K43SJ:~$ pip -V pip 8.1.1 from /home/teddy/.virtualenvs/opencv_p27/local/lib/python2.7/site-packages (python 2.7) |
4. Install numpy:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(opencv_p27) teddy@teddy-K43SJ:~$ pip install numpy Collecting numpy /home/teddy/.virtualenvs/opencv_p27/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /home/teddy/.virtualenvs/opencv_p27/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Using cached numpy-1.10.4.tar.gz Building wheels for collected packages: numpy Running setup.py bdist_wheel for numpy ... done Stored in directory: /home/teddy/.cache/pip/wheels/66/f5/d7/f6ddd78b61037fcb51a3e32c9cd276e292343cdd62d5384efd Successfully built numpy Installing collected packages: numpy Successfully installed numpy-1.10.4 |
CHECK numpy VERSION:
|
1 2 3 4 5 6 7 |
(opencv_p27) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> print np.__version__ 1.10.4 |
IMPORTANT: I FOUND AN ERROR ‘The data should normally be NULL! in function allocate’ WHEN TRY TO TEST SIFT Holography Feature Matching (flann.knnMatch). PLS FIX THIS FIRST (SEE SOLUTION IN /media/data/MASTER/opencv/github_list_fish_rec.txt) BEFORE BUILD OPENCV AT STEP #5 BELOW!
5. We already cloned opencv 3.1.0 and opencv_contrib 3.1.0. so now, go to the build and do setup:
|
1 2 3 4 5 6 |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON .. |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
(opencv_p27) teddy@teddy-K43SJ:~/opencv$ mkdir build (opencv_p27) teddy@teddy-K43SJ:~/opencv$ cd build/ (opencv_p27) teddy@teddy-K43SJ:~/opencv/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE \ > -D CMAKE_INSTALL_PREFIX=/usr/local \ > -D INSTALL_C_EXAMPLES=OFF \ > -D INSTALL_PYTHON_EXAMPLES=ON \ > -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ > -D BUILD_EXAMPLES=ON .. -- The CXX compiler identification is GNU 4.8.4 -- The C compiler identification is GNU 4.8.4 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detected version of GNU GCC: 48 (408) -- Performing Test HAVE_CXX_FSIGNED_CHAR -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success -- Performing Test HAVE_C_FSIGNED_CHAR -- Performing Test HAVE_C_FSIGNED_CHAR - Success -- Performing Test HAVE_CXX_W -- Performing Test HAVE_CXX_W - Success -- Performing Test HAVE_C_W -- Performing Test HAVE_C_W - Success -- Performing Test HAVE_CXX_WALL -- Performing Test HAVE_CXX_WALL - Success -- Performing Test HAVE_C_WALL -- Performing Test HAVE_C_WALL - Success -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_C_WERROR_RETURN_TYPE -- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_CXX_WERROR_ADDRESS -- Performing Test HAVE_CXX_WERROR_ADDRESS - Success -- Performing Test HAVE_C_WERROR_ADDRESS -- Performing Test HAVE_C_WERROR_ADDRESS - Success -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_CXX_WFORMAT -- Performing Test HAVE_CXX_WFORMAT - Success -- Performing Test HAVE_C_WFORMAT -- Performing Test HAVE_C_WFORMAT - Success -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_C_WMISSING_DECLARATIONS -- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed -- Performing Test HAVE_C_WMISSING_PROTOTYPES -- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed -- Performing Test HAVE_C_WSTRICT_PROTOTYPES -- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success -- Performing Test HAVE_CXX_WUNDEF -- Performing Test HAVE_CXX_WUNDEF - Success -- Performing Test HAVE_C_WUNDEF -- Performing Test HAVE_C_WUNDEF - Success -- Performing Test HAVE_CXX_WINIT_SELF -- Performing Test HAVE_CXX_WINIT_SELF - Success -- Performing Test HAVE_C_WINIT_SELF -- Performing Test HAVE_C_WINIT_SELF - Success -- Performing Test HAVE_CXX_WPOINTER_ARITH -- Performing Test HAVE_CXX_WPOINTER_ARITH - Success -- Performing Test HAVE_C_WPOINTER_ARITH -- Performing Test HAVE_C_WPOINTER_ARITH - Success -- Performing Test HAVE_CXX_WSHADOW -- Performing Test HAVE_CXX_WSHADOW - Success -- Performing Test HAVE_C_WSHADOW -- Performing Test HAVE_C_WSHADOW - Success -- Performing Test HAVE_CXX_WSIGN_PROMO -- Performing Test HAVE_CXX_WSIGN_PROMO - Success -- Performing Test HAVE_C_WSIGN_PROMO -- Performing Test HAVE_C_WSIGN_PROMO - Failed -- Performing Test HAVE_CXX_WNO_NARROWING -- Performing Test HAVE_CXX_WNO_NARROWING - Success -- Performing Test HAVE_C_WNO_NARROWING -- Performing Test HAVE_C_WNO_NARROWING - Success -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_CXX_WNO_LONG_LONG -- Performing Test HAVE_CXX_WNO_LONG_LONG - Success -- Performing Test HAVE_C_WNO_LONG_LONG -- Performing Test HAVE_C_WNO_LONG_LONG - Success -- Performing Test HAVE_CXX_PTHREAD -- Performing Test HAVE_CXX_PTHREAD - Success -- Performing Test HAVE_C_PTHREAD -- Performing Test HAVE_C_PTHREAD - Success -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success -- Performing Test HAVE_C_FOMIT_FRAME_POINTER -- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success -- Performing Test HAVE_CXX_MSSE -- Performing Test HAVE_CXX_MSSE - Success -- Performing Test HAVE_C_MSSE -- Performing Test HAVE_C_MSSE - Success -- Performing Test HAVE_CXX_MSSE2 -- Performing Test HAVE_CXX_MSSE2 - Success -- Performing Test HAVE_C_MSSE2 -- Performing Test HAVE_C_MSSE2 - Success -- Performing Test HAVE_CXX_MNO_AVX -- Performing Test HAVE_CXX_MNO_AVX - Success -- Performing Test HAVE_C_MNO_AVX -- Performing Test HAVE_C_MNO_AVX - Success -- Performing Test HAVE_CXX_MSSE3 -- Performing Test HAVE_CXX_MSSE3 - Success -- Performing Test HAVE_C_MSSE3 -- Performing Test HAVE_C_MSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSSE3 -- Performing Test HAVE_CXX_MNO_SSSE3 - Success -- Performing Test HAVE_C_MNO_SSSE3 -- Performing Test HAVE_C_MNO_SSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSE4_1 -- Performing Test HAVE_CXX_MNO_SSE4_1 - Success -- Performing Test HAVE_C_MNO_SSE4_1 -- Performing Test HAVE_C_MNO_SSE4_1 - Success -- Performing Test HAVE_CXX_MNO_SSE4_2 -- Performing Test HAVE_CXX_MNO_SSE4_2 - Success -- Performing Test HAVE_C_MNO_SSE4_2 -- Performing Test HAVE_C_MNO_SSE4_2 - Success -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS - Success -- Performing Test HAVE_C_FFUNCTION_SECTIONS -- Performing Test HAVE_C_FFUNCTION_SECTIONS - Success -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed -- Looking for pthread.h -- Looking for pthread.h - found -- Check if the system is big endian -- Searching 16 bit integer -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") -- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.0.3") -- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success -- Performing Test HAVE_C_WNO_SHADOW -- Performing Test HAVE_C_WNO_SHADOW - Success -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success -- Found Jasper: /usr/lib/x86_64-linux-gnu/libjasper.so (found version "1.900.1") -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.50") -- Looking for /usr/include/libpng/png.h -- Looking for /usr/include/libpng/png.h - found -- Looking for semaphore.h -- Looking for semaphore.h - found -- Performing Test HAVE_CXX_WNO_SHADOW -- Performing Test HAVE_CXX_WNO_SHADOW - Success -- Performing Test HAVE_CXX_WNO_UNUSED -- Performing Test HAVE_CXX_WNO_UNUSED - Success -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success -- Performing Test HAVE_CXX_WNO_UNDEF -- Performing Test HAVE_CXX_WNO_UNDEF - Success -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WNO_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success -- Performing Test HAVE_CXX_WNO_SWITCH -- Performing Test HAVE_CXX_WNO_SWITCH - Success -- Performing Test HAVE_CXX_WNO_PARENTHESES -- Performing Test HAVE_CXX_WNO_PARENTHESES - Success -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success -- Performing Test HAVE_CXX_WNO_EXTRA -- Performing Test HAVE_CXX_WNO_EXTRA - Success -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success -- checking for module 'gtk+-3.0' -- package 'gtk+-3.0' not found -- checking for module 'gtk+-2.0' -- found gtk+-2.0, version 2.24.23 -- checking for module 'gthread-2.0' -- found gthread-2.0, version 2.40.2 -- checking for module 'gstreamer-base-1.0' -- package 'gstreamer-base-1.0' not found -- checking for module 'gstreamer-video-1.0' -- package 'gstreamer-video-1.0' not found -- checking for module 'gstreamer-app-1.0' -- package 'gstreamer-app-1.0' not found -- checking for module 'gstreamer-riff-1.0' -- package 'gstreamer-riff-1.0' not found -- checking for module 'gstreamer-pbutils-1.0' -- package 'gstreamer-pbutils-1.0' not found -- checking for module 'gstreamer-base-0.10' -- package 'gstreamer-base-0.10' not found -- checking for module 'gstreamer-video-0.10' -- package 'gstreamer-video-0.10' not found -- checking for module 'gstreamer-app-0.10' -- package 'gstreamer-app-0.10' not found -- checking for module 'gstreamer-riff-0.10' -- package 'gstreamer-riff-0.10' not found -- checking for module 'gstreamer-pbutils-0.10' -- package 'gstreamer-pbutils-0.10' not found -- checking for module 'libdc1394-2' -- package 'libdc1394-2' not found -- checking for module 'libdc1394' -- package 'libdc1394' not found -- checking for module 'libv4l1' -- found libv4l1, version 1.0.1 -- checking for module 'libv4l2' -- found libv4l2, version 1.0.1 -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- checking for module 'libavcodec' -- found libavcodec, version 54.35.0 -- checking for module 'libavformat' -- found libavformat, version 54.20.4 -- checking for module 'libavutil' -- found libavutil, version 52.3.0 -- checking for module 'libswscale' -- found libswscale, version 2.1.1 -- checking for module 'libavresample' -- package 'libavresample' not found -- Looking for libavformat/avformat.h -- Looking for libavformat/avformat.h - found -- Looking for ffmpeg/avformat.h -- Looking for ffmpeg/avformat.h - not found -- checking for module 'libgphoto2' -- package 'libgphoto2' not found -- ICV: Removing previous unpacked package: /home/teddy/opencv/3rdparty/ippicv/unpack -- ICV: Unpacking ippicv_linux_20151201.tgz to /home/teddy/opencv/3rdparty/ippicv/unpack... -- ICV: Package successfully downloaded -- found IPP (ICV version): 9.0.1 [9.0.1] -- at: /home/teddy/opencv/3rdparty/ippicv/unpack/ippicv_lnx -- Found Doxygen: /usr/bin/doxygen (found version "1.8.6") -- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake -- Found PythonInterp: /home/teddy/.virtualenvs/opencv_p27/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable exact version "2.7.6") -- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found suitable exact version "3.4.3") Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named 'numpy' -- Found apache ant 1.9.3: /usr/bin/ant -- Found JNI: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file -- Caffe: NO -- Protobuf: NO -- Glog: NO -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) -- Checking SFM deps... FALSE -- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags -- Tesseract: NO -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED - Success -- Performing Test HAVE_CXX_WNO_SIGN_PROMO -- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) -- Build libprotobuf from sources: -- libprotobuf not found into system -- The protocol buffer compiler not found -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for C++ include unordered_map -- Looking for C++ include unordered_map - found -- Looking for C++ include tr1/unordered_map -- Looking for C++ include tr1/unordered_map - found -- Looking for C++ include unordered_set -- Looking for C++ include unordered_set - found -- Looking for C++ include tr1/unordered_set -- Looking for C++ include tr1/unordered_set - found -- Performing Test HAVE_CXX_WNO_DEPRECATED -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS - Success -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Failed -- Tesseract: NO -- -- General configuration for OpenCV 3.1.0 ===================================== -- Version control: 3.1.0 -- -- Platform: -- Host: Linux 3.19.0-56-generic x86_64 -- CMake: 2.8.12.2 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: RELEASE -- -- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 4.8.4) -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- Precompiled headers: YES -- Extra dependencies: /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so gtk-x11-2.0 gdk-x11-2.0 atk-1.0 gio-2.0 pangoft2-1.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo pango-1.0 fontconfig gobject-2.0 freetype gthread-2.0 glib-2.0 v4l1 v4l2 avcodec avformat avutil swscale dl m pthread rt -- 3rdparty dependencies: libwebp IlmImf libprotobuf -- -- OpenCV modules: -- To be built: core flann imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets java rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python2 -- Disabled: world contrib_world -- Disabled by dependency: - -- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python3 viz cvv hdf matlab sfm -- -- GUI: -- QT: NO -- GTK+ 2.x: YES (ver 2.24.23) -- GThread : YES (ver 2.40.2) -- GtkGlExt: NO -- OpenGL support: NO -- VTK support: NO -- -- Media I/O: -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8) -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver ) -- WEBP: build (ver 0.3.1) -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50) -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3) -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- GDAL: NO -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: NO -- FFMPEG: YES -- codec: YES (ver 54.35.0) -- format: YES (ver 54.20.4) -- util: YES (ver 52.3.0) -- swscale: YES (ver 2.1.1) -- resample: NO -- gentoo-style: YES -- GStreamer: NO -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- OpenNI2: NO -- PvAPI: NO -- GigEVisionSDK: NO -- UniCap: NO -- UniCap ucil: NO -- V4L/V4L2: Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1) -- XIMEA: NO -- Xine: NO -- gPhoto2: NO -- -- Parallel framework: pthreads -- -- Other third-party libraries: -- Use IPP: 9.0.1 [9.0.1] -- at: /home/teddy/opencv/3rdparty/ippicv/unpack/ippicv_lnx -- Use IPP Async: NO -- Use VA: NO -- Use Intel VA-API/OpenCL: NO -- Use Eigen: YES (ver 3.2.0) -- Use Cuda: NO -- Use OpenCL: YES -- Use custom HAL: NO -- -- OpenCL: -- Version: dynamic -- Include path: /home/teddy/opencv/3rdparty/include/opencl/1.2 -- Use AMDFFT: NO -- Use AMDBLAS: NO -- -- Python 2: -- Interpreter: /home/teddy/.virtualenvs/opencv_p27/bin/python2.7 (ver 2.7.6) -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6) -- numpy: /home/teddy/.virtualenvs/opencv_p27/local/lib/python2.7/site-packages/numpy/core/include (ver 1.10.4) -- packages path: lib/python2.7/site-packages -- -- Python 3: -- Interpreter: /usr/bin/python3.4 (ver 3.4.3) -- -- Python (for build): /home/teddy/.virtualenvs/opencv_p27/bin/python2.7 -- -- Java: -- ant: /usr/bin/ant (ver 1.9.3) -- JNI: /usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/include/linux /usr/lib/jvm/java-8-oracle/include -- Java wrappers: YES -- Java tests: YES -- -- Matlab: Matlab not found or implicitly disabled -- -- Documentation: -- Doxygen: /usr/bin/doxygen (ver 1.8.6) -- PlantUML: NO -- -- Tests and samples: -- Tests: YES -- Performance tests: YES -- C/C++ Examples: YES -- -- Install path: /usr/local -- -- cvconfig.h is in: /home/teddy/opencv/build -- ----------------------------------------------------------------- -- -- Configuring done -- Generating done -- Build files have been written to: /home/teddy/opencv/build |
6. Compile opencv:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(opencv_p27) teddy@teddy-K43SJ:~/opencv/build$ make -j4 ... [ 98%] Building CXX object samples/cpp/CMakeFiles/tutorial_video-input-psnr-ssim.dir/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp.o Scanning dependencies of target tutorial_video-write [100%] Building CXX object samples/cpp/CMakeFiles/tutorial_video-write.dir/tutorial_code/HighGUI/video-write/video-write.cpp.o Linking CXX executable ../../bin/cpp-tutorial-pointPolygonTest_demo [100%] Built target tutorial_pointPolygonTest_demo Linking CXX executable ../../bin/cpp-tutorial-video-write [100%] Built target tutorial_video-write Linking CXX executable ../../bin/cpp-tutorial-planar_tracking Linking CXX executable ../../bin/cpp-tutorial-video-input-psnr-ssim [100%] Built target tutorial_planar_tracking [100%] Built target tutorial_video-input-psnr-ssim |
7. Install:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
(opencv_p27) teddy@teddy-K43SJ:~/opencv/build$ sudo make install ... [100%] Built target example_tapi_squares [100%] Built target example_tapi_tvl1_optical_flow [100%] Built target example_tapi_ufacedetect Install the project... -- Install configuration: "RELEASE" -- Up-to-date: /usr/local/share/OpenCV/3rdparty/lib/libippicv.a -- Installing: /usr/local/include/opencv2/cvconfig.h -- Installing: /usr/local/include/opencv2/opencv_modules.hpp -- Installing: /usr/local/lib/pkgconfig/opencv.pc ... -- Installing: /usr/local/share/OpenCV/samples/python/mouse_paint_img.py -- Installing: /usr/local/share/OpenCV/samples/python/adaptive_equal.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/inpaint.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/video_threaded.py |
|
1 |
(opencv_p27) teddy@teddy-K43SJ:~/opencv/build$ sudo ldconfig |
8. If you’ve reached this step without an error, OpenCV should now be installed in /usr/local/lib/python2.7/site-packages
However, our ‘opencv_p27’ virtual environment is located in our home directory — thus to use OpenCV within our cv environment, we first need to sym-link OpenCV into the site-packages directory of the ‘opencv_p27’ virtual environment:
|
1 2 |
(opencv_p27) teddy@teddy-K43SJ:~/opencv/build$ cd ~/.virtualenvs/opencv_p27/lib/python2.7/site-packages/ (opencv_p27) teddy@teddy-K43SJ:~/.virtualenvs/opencv_p27/lib/python2.7/site-packages$ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so |
9. Check the installation opencv version:
|
1 2 3 4 5 6 7 |
(opencv_p27) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.1.0' |