Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding calib3d module from sources #154

Open
sebinho opened this issue Oct 21, 2024 · 3 comments
Open

Adding calib3d module from sources #154

sebinho opened this issue Oct 21, 2024 · 3 comments

Comments

@sebinho
Copy link

sebinho commented Oct 21, 2024

Hi All,

I am trying to recompile opencv-mobile by adding some missing modules. The module I need is calib3d so I added changed the following lines in options.txt:

-DBUILD_opencv_calib3d=ON
-DBUILD_opencv_flann=ON

But when I compile it with the recommended call

cmake -DCMAKE_INSTALL_PREFIX=install   -DCMAKE_BUILD_TYPE=Debug   `cat ../options.txt`   -DBUILD_opencv_world=OFF ..
make -j8

I get the following compilation error:

[ 76%] Linking CXX static library ../../lib/libopencv_highgui.a
[ 76%] Built target opencv_highgui
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp: In member function ‘virtual void cv::FlannBasedMatcher::add(cv::InputArrayOfArrays)’:
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1061:22: error: ‘const class cv::_InputArray’ has no member named ‘isUMatVector’; did you mean ‘isMatVector’?
 1061 |     if( _descriptors.isUMatVector() )
      |                      ^~~~~~~~~~~~
      |                      isMatVector
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1063:21: error: ‘UMat’ was not declared in this scope; did you mean ‘Mat’?
 1063 |         std::vector<UMat> descriptors;
      |                     ^~~~
      |                     Mat
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1063:25: error: template argument 1 is invalid
 1063 |         std::vector<UMat> descriptors;
      |                         ^
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1063:25: error: template argument 2 is invalid
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1064:22: error: ‘const class cv::_InputArray’ has no member named ‘getUMatVector’; did you mean ‘getMatVector’?
 1064 |         _descriptors.getUMatVector( descriptors );
      |                      ^~~~~~~~~~~~~
      |                      getMatVector
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1066:44: error: request for member ‘size’ in ‘descriptors’, which is of non-class type ‘int’
 1066 |         for( size_t i = 0; i < descriptors.size(); i++ )
      |                                            ^~~~
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1068:42: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
 1068 |             addedDescCount += descriptors[i].rows;
      |                                          ^
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1071:27: error: ‘const class cv::_InputArray’ has no member named ‘isUMat’; did you mean ‘isMat’?
 1071 |     else if( _descriptors.isUMat() )
      |                           ^~~~~~
      |                           isMat
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1073:40: error: ‘const class cv::_InputArray’ has no member named ‘getUMat’; did you mean ‘getMat’?
 1073 |         addedDescCount += _descriptors.getUMat().rows;
      |                                        ^~~~~~~
      |                                        getMat
In file included from /home/zed/repos/opencv-mobile-4.10.0/modules/core/include/opencv2/core.hpp:53,
                 from /home/zed/repos/opencv-mobile-4.10.0/modules/features2d/include/opencv2/features2d.hpp:47,
                 from /home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/precomp.hpp:46,
                 from /home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:42:
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1090:33: error: ‘const class cv::_InputArray’ has no member named ‘isUMat’; did you mean ‘isMat’?
 1090 |         CV_Assert( _descriptors.isUMat() || _descriptors.isUMatVector() || _descriptors.isMat() || _descriptors.isMatVector() );
      |                                 ^~~~~~
/home/zed/repos/opencv-mobile-4.10.0/modules/core/include/opencv2/core/base.hpp:342:38: note: in definition of macro ‘CV_Assert’
  342 | #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
      |                                      ^~~~
/home/zed/repos/opencv-mobile-4.10.0/modules/features2d/src/matchers.cpp:1090:58: error: ‘const class cv::_InputArray’ has no member named ‘isUMatVector’; did you mean ‘isMatVector’?
 1090 |         CV_Assert( _descriptors.isUMat() || _descriptors.isUMatVector() || _descriptors.isMat() || _descriptors.isMatVector() );
      |                                                          ^~~~~~~~~~~~
/home/zed/repos/opencv-mobile-4.10.0/modules/core/include/opencv2/core/base.hpp:342:38: note: in definition of macro ‘CV_Assert’
  342 | #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
      |                                      ^~~~
make[2]: *** [modules/features2d/CMakeFiles/opencv_features2d.dir/build.make:370: modules/features2d/CMakeFiles/opencv_features2d.dir/src/matchers.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 76%] Linking CXX static library ../../lib/libopencv_photo.a
[ 76%] Built target opencv_photo
make[1]: *** [CMakeFiles/Makefile2:742: modules/features2d/CMakeFiles/opencv_features2d.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Any idea on how to get pass these errors? When I don't try to add calib3d it does compile without errors.
Thanks for your help

@TorstenK91
Copy link

Pushing this, since I'm running into the same issue and this is quite an important issue for us.
Any help would be appreciated!

@sebinho
Copy link
Author

sebinho commented Nov 12, 2024

@TorstenK91, eventually I did not have time to spend trying to make calib3d compile with opencv-mobile, so I ended up compiling the official opencv repo but for Android. The compiled library is bigger, but that is acceptable for what I am doing.
Good luck

@Venkat-11235
Copy link

Ran into a similar issue, for ios builds with -DBUILD_opencv_calib3d=ON -DBUILD_opencv_flann=ON and -DWITH_OPENCL=ON got the error: use of undeclared identifier 'ocl'. Any inputs on dependencies related to OPENCL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants