openMVS
openMVS copied to clipboard
problem when openmvs as third party
Describe the bug There isn't error in runing the mvs wiki example. But I try to use openmvs as third party in my project, there are some errors in make processing. I tried to import different head file, it seems to had different build error.
To Reproduce my cmakelist:
cmake_minimum_required(VERSION 3.8)
project(sfm_mvs_test)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Release)
set(OpenMVS_DIR my_install_path)
find_package(OpenMVS REQUIRED)
include_directories(${OpenMVS_INCLUDE_DIRS})
add_definitions(${OpenMVS_DEFINITION})
add_executable(sfm_mvs_test sfm_mvs_test.cpp)
target_link_libraries(sfm_mvs_test
PRIVATE
${OpenMVS_LIBRAIRES})
my sample function:
#include <iostream>
#include <OpenMVS/MVS.h>
using namespace std;
int main(int argc, char **argv){
cout<<"hell sfm!\n";
//openmvs DensifyPointCloud
//openmvs ReconstructMesh
//openmvs RefineMesh
//openmvs TextureMesh
}
Screenshots error import MVS.h
[ 50%] Building CXX object CMakeFiles/sfm_mvs_test.dir/sfm_mvs_test.cpp.o
**no error here just warning**
[100%] Linking CXX executable sfm_mvs_test
/usr/bin/ld: CMakeFiles/sfm_mvs_test.dir/sfm_mvs_test.cpp.o: in function `_GLOBAL__sub_I_main':
sfm_mvs_test.cpp:(.text.startup+0xea): undefined reference to `SEACAVE::ColorType<float>::ONE'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sfm_mvs_test.dir/build.make:97: sfm_mvs_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/sfm_mvs_test.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
error importing OpenMVS/MVS/Common.h
**_too long just get part of it_**
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:784:63: error: expected primary-expression before ‘const’
784 | aabb.Set(Eigen::Map<const POINT_TYPE>(ptMinData), Eigen::Map<const POINT_TYPE>(ptMaxData));
| ^~~~~
In file included from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Types.h:390,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Common.h:176,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/Common.h:42,
from /home/weiyun-chen/Documents/course/MVS_Course/mvs_lib_test/sfm_mvs_test.cpp:2:
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:11: error: qualified-id in declaration before ‘i’
797 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:45: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:11: error: expected ‘;’ before ‘i’
797 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:45: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:11: error: ‘i’ was not declared in this scope
797 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:45: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:11: error: ‘iSize’ was not declared in this scope
797 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:52: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:68: error: request for member ‘size’ in ‘(items)’, which is of non-class type ‘TestArr’ {aka ‘int’}
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:68: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:89: error: expected ‘)’ before ‘;’ token
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ~ ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:3: note: in expansion of macro ‘FOREACH’
797 | FOREACH(i, items)
| ^~~~~~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:797:11: error: ‘i’ was not declared in this scope
797 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:93: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
In file included from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.h:233,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Types.h:2811,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Common.h:176,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/Common.h:42,
from /home/weiyun-chen/Documents/course/MVS_Course/mvs_lib_test/sfm_mvs_test.cpp:2:
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:798:18: error: ‘j’ was not declared in this scope; did you mean ‘jn’?
798 | for (int j=0; j<DIMS; ++j)
| ^
| jn
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:801:13: error: expected ‘;’ before ‘pt’
801 | POINT_TYPE pt;
| ^~~
| ;
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:803:4: error: there are no arguments to ‘pt’ that depend on a template parameter, so a declaration of ‘pt’ must be available [-fpermissive]
803 | pt(j) = static_cast<TYPE>(RAND()%ROUND2INT(ptMaxData[j]));
| ^~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:810:25: error: ‘pt’ was not declared in this scope
810 | tree.Collect(indices, pt, radius);
| ^~
In file included from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Types.h:390,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Common.h:176,
from /home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/Common.h:42,
from /home/weiyun-chen/Documents/course/MVS_Course/mvs_lib_test/sfm_mvs_test.cpp:2:
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:816:11: error: qualified-id in declaration before ‘i’
816 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:45: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:816:11: error: expected ‘;’ before ‘i’
816 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:45: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:816:11: error: ‘iSize’ was not declared in this scope
816 | FOREACH(i, items)
| ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:52: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:68: error: request for member ‘size’ in ‘(items)’, which is of non-class type ‘TestArr’ {aka ‘int’}
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:68: note: in definition of macro ‘FOREACH’
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ^~~~
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/List.h:32:89: error: expected ‘)’ before ‘;’ token
32 | #define FOREACH(var, arr) for (ARR2IDX(arr) var=0, var##Size=(arr).size(); var<var##Size; ++var)
| ~ ^
/home/weiyun-chen/Sources/openMVS/build/install/include/OpenMVS/MVS/../Common/Octree.inl:816:3: note: in expansion of macro ‘FOREACH’
816 | FOREACH(i, items)
| ^~~~~~~
make[2]: *** [CMakeFiles/sfm_mvs_test.dir/build.make:76: CMakeFiles/sfm_mvs_test.dir/sfm_mvs_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/sfm_mvs_test.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Desktop (please complete the following information):
- OS: [ubuntu]
- Version [20.04]
I didn't test much the library like usage and I do not have time right now to look into it. You look like a knowledgeable C++ developer, can you pls help with a fix?