Compiling OpenMVS

981 views
Skip to first unread message

Brian Loudon

unread,
Nov 16, 2015, 8:57:25 AM11/16/15
to ope...@googlegroups.com
Hi, I was wondering if you could give me some advice on first time compiling. I'm not great at custom usage of cmake-gui and I am really tearing my hair out trying to get Ceres to compile in order to then use it with OpenMVS.

I have failed to build Ceres 1.11.0 from the source download, mainly as I can't get Glog to compile and be included in cmake.

 so... I have had to use the windows wrapper I found here;
https://github.com/tbennun/ceres-windows

with ceres 1.10. which I managed to compile fine. Though that windows wrapper does not seem to contain any cmakelist files...


I am trying to then run cmake-gui on the OpenMVS files and again I have  GLOG_INCLUDE_DIR problems;

CMake Error at D:/OpenMVS/ceres-windows-master/ceres-solver/build/CeresConfig.cmake:85 (MESSAGE):
Failed to find Ceres - Missing required Ceres dependency: Glog, please set
GLOG_INCLUDE_DIR.
Call Stack (most recent call first):
D:/OpenMVS/ceres-windows-master/ceres-solver/build/CeresConfig.cmake:188 (CERES_REPORT_NOT_FOUND)
build/Modules/FindCERES.cmake:31 (include)
libs/MVS/CMakeLists.txt:15 (FIND_PACKAGE)

I am really out of ideas at this point as I have entered the GLOG_INCLUDE_DIR and I can't see what can be wrong,

any hints or suggestions would be gratefully received, getting a bit hopeless here,

Really keen to try out the capabilities of OpenMVS

Many thanks,

Brian

cDc

unread,
Nov 16, 2015, 1:44:53 PM11/16/15
to openMVS, brianj...@gmail.com
Hi Brian,

In order to compile CERES, you only need Eigen (the other dependencies are optional). Do not use any wrapper, just download CERES source-code, run cmake and configure it to not build tests and examples, and select miniglog (replacement for GLog, already included in CERES). Build and install, and that's it.

http://ceres-solver.org/building.html#windows

Hope this helps!

Brian Loudon

unread,
Nov 16, 2015, 2:29:21 PM11/16/15
to cDc, openMVS
thanks so much for replying! Much appreciated, it's been a frustrating day,

The problem I get when compiling with miniglog is;

CMake Error at D:/OpenMVS/ceres-solver-1.11.0/bld/CeresConfig.cmake:88 (message):
Failed to find Ceres - Ceres include directory:
D:/OpenMVS/ceres-solver-1.11.0/include does not include miniglog, but Ceres
was compiled with MINIGLOG enabled (in place of Glog).

Call Stack (most recent call first):
D:/OpenMVS/ceres-solver-1.11.0/bld/CeresConfig.cmake:226 (ceres_report_not_found)

build/Modules/FindCERES.cmake:31 (include)
libs/MVS/CMakeLists.txt:15 (FIND_PACKAGE)

When trying to configure OpenMVS with;

CERES_DIR     D:/OpenMVS/ceres-solver-1.11.0/bld

CERES_INCLUDE_DIR     D:/OpenMVS/ceres-solver-1.11.0/include/ceres

Many thanks again,

Brian

cDc

unread,
Nov 16, 2015, 3:19:12 PM11/16/15
to openMVS, brianj...@gmail.com
I do not know why it is not working for you. Please try copy by hand the miniglog header and put it so that cmake finds it.


On Monday, November 16, 2015 at 11:29:21 AM UTC-8, Brian Loudon wrote:
thanks so much for replying! Much appreciated, it's been a frustrating day,

The problem I get when compiling with miniglog is;

CMake Error at D:/OpenMVS/ceres-solver-1.11.0/bld/CeresConfig.cmake:88 (message):
Failed to find Ceres - Ceres include directory:
D:/OpenMVS/ceres-solver-1.11.0/include does not include miniglog, but Ceres
was compiled with MINIGLOG enabled (in place of Glog).
Call Stack (most recent call first):
D:/OpenMVS/ceres-solver-1.11.0/bld/CeresConfig.cmake:226 (ceres_report_not_found)
build/Modules/FindCERES.cmake:31 (include)
libs/MVS/CMakeLists.txt:15 (FIND_PACKAGE)

When trying to configure OpenMVS with;

CERES_DIR     D:/OpenMVS/ceres-solver-1.11.0/bld

CERES_INCLUDE_DIR     D:/OpenMVS/ceres-solver-1.11.0/include/ceres

Many thanks again,

Brian

Brian Loudon

unread,
Nov 16, 2015, 4:35:21 PM11/16/15
to cDc, openMVS
Thanks, I've tried that, and now I've tried it with Ceres1.10  I really can't think of any other permutation of this. It's so frustrating as it's just this silly wee header file that is blocking everything! Think I have to give in for today.

cotire 1.7.4 loaded.

Boost version: 1.59.0

Found the following Boost libraries:

iostreams

program_options

system

serialization

Eigen 3.2.7 found (include: D:/OpenMVS/eigen)

OpenCV ARCH: x64

OpenCV RUNTIME: vc10

OpenCV STATIC: ON

Found OpenCV 2.4.11 in D:/OpenMVS/opencv/build/x64/vc10/staticlib

OpenCV 2.4.11 found (include: D:/OpenMVS/opencv/build/include;D:/OpenMVS/opencv/build/include/opencv;D:/OpenMVS/opencv/build/include)

CGAL found (include: D:/OpenMVS/CGAL-4.7/build/include;D:/OpenMVS/CGAL-4.7/include)

VCG found (include: D:/OpenMVS/vcglib)

Found required Ceres dependency: Eigen version 3.2.7 in D:/OpenMVS/eigen

CMake Error at D:/OpenMVS/ceres_solver-1.10/bld/CeresConfig.cmake:85 (MESSAGE):
Failed to find Ceres - Ceres install include directory:
D:/OpenMVS/ceres_solver-1.10/include does not include miniglog, but Ceres


was compiled with MINIGLOG enabled (in place of Glog).
Call Stack (most recent call first):

D:/OpenMVS/ceres_solver-1.10/bld/CeresConfig.cmake:166 (CERES_REPORT_NOT_FOUND)


build/Modules/FindCERES.cmake:31 (include)
libs/MVS/CMakeLists.txt:15 (FIND_PACKAGE)

Configuring incomplete, errors occurred!

See also "D:/OpenMVS/bld/CMakeFiles/CMakeOutput.log".

See also "D:/OpenMVS/bld/CMakeFiles/CMakeError.log".




Thanks for your help in any case,


cheers,


Brian


Brian Loudon

unread,
Nov 17, 2015, 6:34:17 PM11/17/15
to cDc, openMVS
success!

moved miniglog folder copy to D:\OpenMVS\ceres_solver-1.10\include\ceres\internal

was under    D:\OpenMVS\ceres_solver-1.10\include\internal\ceres

I have generated the solution file without OpenMVG support for the moment as something odd happened with the cmake files there too, so I'll keep that build completely separated for the moment.

Unfortunately the solution did not compile, a lot of errors mainly in ..\libs\common\types.inl  ,  ..\libs\common\util.inl and cuda.h    I am compiling in MSVC 2010 as an x64 build, should I compile it as win32?


Can I ask is it possible to set OPTDENSE::fOptimAngle  from the config file or "dense-config-file"  , I'm just trying out some data with the OpenMVS_Sample package I downloaded. Got some great results on one openmvg scene, just trying something else. From looking at the code fOptimAngle defaults to 12 degrees, is this correct? Can it be changed?


Thanks again!

cheers,

Brian

cDc

unread,
Nov 17, 2015, 7:01:43 PM11/17/15
to openMVS, brianj...@gmail.com
Hmm, it should compile on both x64 and x32, and also on VC2010+, but I never test it. I use VS2015 x64 (that means with C++11 support). So some of the non C++11 code must give you problems. You either try to fix it (or wait for a fix from me when I will find time), or use VC2015. Sorry for that, but I work on this project only in my free time, so most of the time I spend earning my money on different projects.


cDc

unread,
Nov 17, 2015, 7:19:01 PM11/17/15
to openMVS
I forgot to answer your second question. In order to set OPTDENSE::fOptimAngle (or any variable in OPTDENSE) you only have to enable the configuration file using "--dense-config-file Dense.ini". If it doesn't exist it will be created, if it exists, it loads the parameters that it contains.

brianj...@gmail.com

unread,
Nov 19, 2015, 12:54:24 PM11/19/15
to openMVS
That's great thanks, just trying that now to experiment with settings, looking to see what angle between views I can get away with.

I have tried again to compile with MSVC 2015 Community and have compiled libraries Common, IO and Math (.lib) , however MVS.lib throws an error on compile when it tries to link into the CGAL libraries, autolink.h (in CGAL dependency) can't find the CGAL libraries. I compiled those as dlls, should they be static libs? I think there may be something odd with my Boost install for this to happen.

Sorry, that's my last question.. Apologies again for such low-level compiling questions.

many thanks,

Brian

cDc

unread,
Nov 19, 2015, 7:04:15 PM11/19/15
to openMVS
No problem at all, I'm here to help. However, I can not say what the problem is from the distance. I didn't encounter this problem in my attempt to compile the library, but it sounds like something went wrong at creating the projects. Most probably an include folder that is needed it was not included for some reason. So the simplest solution just added it by hand.

Brian Loudon

unread,
Nov 21, 2015, 3:28:48 PM11/21/15
to openMVS
Just wanted to say thanks, I managed to compile the solution finally!

I still suspect something isn't quite right as DensifyPointCloud failed on my data that worked wth your OpenMVS_Sample package (the model of a Venetian statue I posted in another thread) I think there's something odd with my opencv 3.0 install potentially. It gave me this error message:



Still, this aside I can now experiment with the toolkit and learn from it.

Thanks for the amazing work, I will try to post some images of the reconstructions I process.

cheers,

Brian
Auto Generated Inline Image 1

cDc

unread,
Nov 21, 2015, 9:15:48 PM11/21/15
to openMVS
indeed, strange error. But glad you managed to compile it! Good luck with you next experiments, looking forward to see some nice results!

cDc

unread,
Nov 25, 2015, 12:17:01 PM11/25/15
to openMVS
So on my machine I chose to compile everything with static links. Anything should work as long as you are consistent: you either compile with static or dynamic libraries, but everything the same.

The problem with JPG files not opening is also because you have a conflict of libraries. Im quite sure you are using one version of jpeg library for OpenMVS and an other version comes with OpenCV.

Dan

On Thursday, November 25, 2015 at 9:54:24 AM UTC-8, Brian Loudon wrote:
Hi I'm afraid I had a bit of a false dawn... The exe file couldn't open jpeg files - quite essential - and I'm back in linker hell.

Can I just ask do you compile using static boost libraries for CGAL? and do you make static libraries for CGAL and OpenMVS?

I have been trying to compile without shared libs to make it entirely static, compiling everything with /MT or /MTd

many thanks,

Brian

cDc

unread,
Nov 26, 2015, 12:25:29 PM11/26/15
to openMVS
As far as I know BOOST doesn't link to zlib automatically on windows, you have to set the path to zlib manually.

Here is the script I am using for compiling BOOST.

PS: in the future please reply here, as this discussion could help others as well.


On Wednesday, November 26, 2015 at 9:17:01 AM UTC-8, cDc wrote:
Thanks, I've been compiling with shared libs, so I guess I'm going down a slightly different route here. Everything is fine up until I compile the apps and I get linking errors concerning boost iostreams;

Error    LNK2001    unresolved external symbol "int const boost::iostreams::zlib::best_speed" (?best_speed@zlib@iostreams@boost@@3HB)    DensifyPointCloud    D:\OpenMVS\2015build\apps\DensifyPointCloud\MVS.lib(DepthMap.obj)    1



I found comments on the internet about zlib not being built by default into dynamic boost libs, so I compiled it with boost.build against the zlib sources I have in opencv3. Unfortunately I have the same errors.

Doubting whether I managed to compile iostreams correctly I then looked again at the pre-compiled boost package and they state there that "Starting with 1.49, the zlib and bzip2 libraries have been built in for use with the iostreams library." so that shouldn't be the issue.

boost.teeks99.com

any ideas?

cheers,

Brian
buildVC2015x64.bat.txt

Brian Loudon

unread,
Nov 26, 2015, 4:57:41 PM11/26/15
to cDc, openMVS
Thanks for that! Working through that and compiling zlib and boost has worked and I now have a compiled DensifyPointCloud.exe (just doing one first to start)

On running it however I once again have the jpeg error that I had the last time I compiled successfully.
I've noticed that when I compile IO.lib, I get these warnings;

1>  Generating Code...
1>ImageTIFF.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>ImagePNG.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>ImageJPG.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>ImageEXIF.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>  IO.vcxproj -> D:\OpenMVS\2015build\bin\vc14\x64\Debug\IO.lib

Is this why it can't load a jpeg?

Many thanks, I nearly cried when that compiled there!

Brian

--
You received this message because you are subscribed to a topic in the Google Groups "openMVS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openmvs/Lm7uVVLOotY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openmvs+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openmvs/e81ab14a-f109-4a7a-a159-75e682b8116d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cDc

unread,
Nov 26, 2015, 6:28:01 PM11/26/15
to openMVS
As I said in the previous replies, OpenCV and OpenMVS both use and link to jpg, png, etc. Your error is generated cause you probably are linking OpenCV statically and the jpg version used by OpenCV is different than the version used by OpenMVS. Make sure you use same version.

Brian Loudon

unread,
Nov 26, 2015, 6:48:06 PM11/26/15
to cDc, openMVS
embarrassingly enough, I think I actually had no link at all to jpeglib in IO.lib. I think in cmake-gui I hadn't entered anything for jpeglib and it was not defined, I commented out the #ifdef and got ImageJPG.h included.

DensifyPointCloud now runs up until it does the neighbour selection;

    ASSERT(pointsA.GetSize() == pointsB.GetSize() && pointsA.GetSize() <= score.points);
        const float areaA(ComputeCoveredArea<float, 2, 16, false>((const float*)pointsA.Begin(), pointsA.GetSize(), boundsA.ptr()));
        const float areaB(ComputeCoveredArea<float, 2, 16, false>((const float*)pointsB.Begin(), pointsB.GetSize(), boundsB.ptr()));
        const float area(MINF(areaA, areaB));

calls ComputeCoveredArea()

fails on this assert;

inline TYPE ComputeCoveredArea(const TYPE* values, size_t size, const TYPE* bound, int stride=n) {
    ASSERT(size > 0);

Whilst processing the 10th image out of 13 on the dataset I had run previously with your pre-compiled code.

cheers,

Brian


On 26 November 2015 at 23:28, cDc <cdc.s...@gmail.com> wrote:
As I said in the previous replies, OpenCV and OpenMVS both use and link to jpg, png, etc. Your error is generated cause you probably are linking OpenCV statically and the jpg version used by OpenCV is different than the version used by OpenMVS. Make sure you use same version.

--
You received this message because you are subscribed to a topic in the Google Groups "openMVS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openmvs/Lm7uVVLOotY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openmvs+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages