OpenCV 3.1 with XIMEA support

OpenCV 3 is amazing for accessing XIMEA cameras. However, there’s still the lack of a pre-built library of OpenCV 3, especially 3.1, with XIMEA support. Here, I provide you a pre-built package of OpenCV 3.1 built with XIMEA for Python 2.7  and Python 3.5 for Windows machines.

Please note: I compiled OpenCV using Visual Studio Community Edition 2015 (i.e. VS14). Further, it is compiled for 64bit machines.

anki-xyz_OpenCV_3-1_with_XIMEA_x64

Use the cv2.pyd for Python 2.7.x and cv2.cp35-win_amd64.pyd for Python 3.5.x.

Here’s the file list:

  • cv2.cp35-win_amd64.pyd
  • cv2.pyd
  • opencv_calib3d310.dll
  • opencv_core310.dll
  • opencv_features2d310.dll
  • opencv_ffmpeg310_64.dll
  • opencv_flann310.dll
  • opencv_highgui310.dll
  • opencv_imgcodecs310.dll
  • opencv_imgproc310.dll
  • opencv_ml310.dll
  • opencv_objdetect310.dll
  • opencv_photo310.dll
  • opencv_shape310.dll
  • opencv_stitching310.dll
  • opencv_superres310.dll
  • opencv_video310.dll
  • opencv_videoio310.dll
  • opencv_videostab310.dll

Again, cv2.pyd or the cv2.cp35-win_amd64.pyd for Python 2.7.x or Python 3.5.x, respectively, and all of the dll files except opencv_ffmpeg310_64.dll go to INSTALL_FOLDER/Lib/site-packages, the ffmpeg dll directly to the INSTALL_FOLDER.

Please note, that you properly need the XIMEA XiAPI for proper function! I needed to download the XiAPI Beta Package (thanks to the XIMEA support) even for building OpenCV 3.1. If you’d like to build it yourself with XIMEA support, please note that you have to change some files.

And here is the full building information:

General configuration for OpenCV 3.1.0 =====================================
  Version control:               unknown

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.0
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:          comctl32 gdi32 ole32 setupapi ws2_32 vfw32 xiapi64
    3rdparty dependencies:       zlib libjpeg libwebp libpng libtiff libjasper IlmImf

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab python2 python3
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       YES
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/Users/anki/opencv31/opencv/sources/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/Users/anki/opencv31/opencv/sources/3rdparty/include/opencl/1.2
    Use AMDFFT:                  NO
    Use AMDBLAS:                 NO

  Python 2:
    Interpreter:                 C:/Python27/python.exe (ver 2.7.11)
    Libraries:                   C:/Python27/libs/python27.lib (ver 2.7.11)
    numpy:                       C:/Python27/lib/site-packages/numpy/core/include (ver 1.10.4)
    packages path:               C:/Python27/Lib/site-packages

  Python 3:
    Interpreter:                 C:/Users/anki/Anaconda3/python.exe (ver 3.5.1)
    Libraries:                   C:/Users/anki/Anaconda3/libs/python35.lib (ver 3.5.1)
    numpy:                       C:/Users/anki/Anaconda3/lib/site-packages/numpy/core/include (ver 1.10.4)
    packages path:               C:/Users/anki/Anaconda3/Lib/site-packages

  Python (for build):            C:/Python27/python.exe

  Java:
    ant:                         NO
    JNI:                         C:/Program Files/Java/jdk1.8.0_25/include C:/Program Files/Java/jdk1.8.0_25/include/win32 C:/Program Files/Java/jdk1.8.0_25/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:
    mex:                         C:/MATLAB/R2014a/bin/mex.bat
    Compiler/generator:          Not working (bindings will not be generated)

  Documentation:
    Doxygen:                     NO
    PlantUML:                    NO

  Tests and samples:
    Tests:                       YES
    Performance tests:           YES
    C/C++ Examples:              NO

  Install path:                  C:/Users/anki/opencv31/for_Py35/install

  cvconfig.h is in:              C:/Users/anki/opencv31/for_Py35
-----------------------------------------------------------------

 

  • Ed

    If I copy cv2.pyd into the site-packages library, I’m returned with the following:

    “ImportError: DLL load failed: The specified module could not be found.”

    Any ideas?

    • If you copied all the dlls included in the zip file, then ensure that the ximea api folder (and the dlls in that folder) are accessible through your path variable. Otherwise, just copy these dlls into a random path folder. All the best, Anki

      • Ed

        Thanks for the reply!

        I’ve added the ximea api folder (XIMEA/API) to the path as well as ensured that the dll files from your package have also been included, but I’m still getting the same error. I’ve attached a shot to show that the XIMEA API has been provided, let me know if this is what you mean. https://uploads.disquscdn.com/images/dc954e35d8ed62378b4355638709978d60b2fd8a3273736dbb0e5d5815f8d8cc.png

        • Hey, I actually meant that you include it to your systems path folder (use for example your Windows CMD shell). And, ensure that you’re running the correct version of Python. It must be 64 bit. If the error still persists, check the dependency walker: http://www.dependencywalker.com/

          • Dan Munoz

            Do you have a version of this for linux?

          • Sorry, no. I’m running stuff on a Windows machine. But Linux should be straight forward in contrast to Windows machines. You just mirror the github opencv page and then run make with some extra commands to include XIMEA package. Or use just cmake as well. Compiling on *nix platforms should be way easier. I’ll try to get a collegue of mine sharing this with you.

          • Dan Munoz

            Thank you. I appreciate your willingness to help. Please let me know if your colleague can share…

          • Florain

            I get the same error than Ed.
            Copyed the dlls as decribed above.
            With opencv3.0 (http://anki.xyz/ximea-opencv-3/) it works perfectly. but not with 3.1.
            any suggestion?

          • hi, I can run OpenCV 3.1 with that perfectly. Are you running with Python 2.7? Maybe it is the wrong compiler version,… I have to check this at some point. I’m working normally with Python 3.5 and it’s working smoothly. It’s on my to do list, though.

  • Florain

    Dear Anki,

    I also tried
    to build opencv myself. But however which python distribution I use, I always get
    the error message: “LNK1104: cannot open file ‘python27_d.lib’” when building
    with visual studio.

    how did you
    get around this?

    • Hi Florain, I never got this issue. But I am assuming that the _d.lib extension is indicating that you maybe don’t build RELEASE but rather DEBUG. Switch to release and it should work. Ensure that you specify the correct paths when you’re preparing stuff with CMAKE.