how to build fovis library under windows

So, you want to build and use Fovis library (which can estimate 3D motion of RGB-D camera or stereo pairs) under Windows?

Quick and dirty how-to compile it:

Create empty root folder for your build – for example name it fovis_win.

Install Prerequirements:
1) Download Eigen and install it.
2) Download cmake-gui and install it.
3) Download cygwin (with patch utility) and install it.
4) Download missing headers for windows from and extract them at your root folder into msinttypes subfolder (so both include files would be located at fovis_win/msinttypes). You cannot build fovis without it.
5) For building examples (for examples only, so you can skip it) you need OpenNI install it to default path (c:\program files\openni). Also you would need freenect. You should build it at the root folder, so you will get all libraries and include under fovis_win/frenect/..
6) Download fovis and extract it at the root folder (all files would be located at fovis_win/libfovis).
7) Download archive with patch for fovis – libfovis.patch – and extract it in the folder fovis_win.

(update 02.09.2013 patch with minor fix for compilation with Visual Studio 2012 – libfovis_VS2012.patch)

Run cygwin and type:
cd path-to-fovis_win/libfovis
patch -p1<../libfovis.patch After that you can create build directory for cmake - fovis_win/libfovis/build. run cmake-gui && press configure & generate. It will create Visual Studio project files under build directory. NOTE:
Default search paths from CMakefiles:
Openni library – c:/program files/Openni.
freenect library – ../freenect/
msinttypes headers- ../msinttypes/
If CMake can’t find something using this path – you should set appropriate path via cmake-gui.

Brief patch overview:
– added export definitions for class/functions for windows target
– fixed minor issues for includes/defines for windows target
– added aligned memory operation for windows target
– tictoc.hpp – added support for windows timing routines
– examples – fixed floor->std::round, working with signal for windows target


Skip to comment form

    • Keiny on August 25, 2013 at 5:20 pm
    • Reply

    Hi, I followed your instructions but when I try to compile libfovis, there are some C2719 error related to __declspec(align(’16’)). I’m on windows 7 x64 with visual studio 2010, how can I solve them?

    1. Hi,

      Did you get any errors when you invoke patch?
      Could you let me know full path to fovis’s folder I will reproduce it on my workstation and check it.

    • Keiny on August 27, 2013 at 5:02 am
    • Reply


    No patch errors ( )
    the path is C:\cygwin64\home\User\fovis_win\libfovis ( )

    Here the log errors with warning enabled:
    and with warning disabled:
    to download the files click on the name of the txt, near the size of the file.

    Same results putting fovis_win folder under c:\cygwin64\. Maybe it could be a problem related the version of visual studio. Do you use visual studio 2012?

    Thank you for your answer.

    1. You was right – this issue is occured with Visual Studio 2012 (I have checked with professional version from MS subscriptions).

      But it can be yeasily fixed – just add sign of reference to function’s args of type Eigen:Vector2d

      void refineFeatureMatch(PyramidLevel* ref_level,
      PyramidLevel* target_level,
      Eigen::Vector2d &ref_uv,
      Eigen::Vector2d &init_target_uv,

      void refineFeatureMatch(PyramidLevel* ref_level,
      PyramidLevel* target_level,
      Eigen::Vector2d &ref_uv,
      Eigen::Vector2d &init_target_uv,

      void rectify(Eigen::Vector2d &xy_in, Eigen::Vector2d * out) {

      Thank you for your comment,
      I will add fix to patch.

        • Keiny on August 30, 2013 at 3:54 am
        • Reply

        Ok, perfect now it compile. Do you know if it’s possibile to try the example of openni and libfreenect, without going to change the driver every time. I tried the example of libfreenect after a bit of seconds there’s a runtime exception, it seems in libusb. Have you tried to run it?
        Thank you for your effort

        1. The only way for switch drivers for device I am familiar with – is to choose manually in windows’s device manager before start of apps.
          Probably it can be done via bat-script or in directly via source code of sample but I do not need such functionality.

          As I remember, when I played with fovis lib I prefer to use openni version and it works fine (compiled with VS 2010 and 2008).

          I think in Monday I will get access to kinect and test freenect samples

        2. Yep, you right, freenect’s sample doesn’t work out of the box.

            • Keiny on September 2, 2013 at 11:43 pm

            Ok, never mind, I can use openni.
            Thank you very much.

  1. Hi, im also getting errors when trying to cmake Fovis on msvc10

    => ive tried all the steps and the responses but the patch file doesnt seem to be recognized.

    What did i do?
    I followed all the steps and put the files in exactly the same place as Keiny (according to his screenshot, its under cygwin)
    Also in my terminal window, i made exactly the same path, and use the same commands.
    However, the command patch -p1<../libfovis.patch was not found.
    I have pasted that patch file in all possible directories (from fovis_win to libfovis and several others) but still it does not find it.

    Can you help me?

      • Fraser on March 19, 2014 at 4:23 pm
      • Reply

      The instructions say to put the patch file above the root directory, but this wont work with the command -p1<../libfovis.patch of course.

      Either change the command to p1<../../libfovis.patch or move the patch file into the root folder

      1. Thank you for comment. Fixed 🙂

Leave a Reply

Your email address will not be published.