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

Ubuntu 22.04 Build not Recognizing Viz Module #239

Open
CharlieRusso001 opened this issue Aug 28, 2024 · 9 comments
Open

Ubuntu 22.04 Build not Recognizing Viz Module #239

CharlieRusso001 opened this issue Aug 28, 2024 · 9 comments

Comments

@CharlieRusso001
Copy link

Description:
When compiling the viz module from OpenCV is not recognized.

Command:

# replace this line with the command(s) you used

make -j$(nproc)

Console output:


/home/charl/scald/mapping/Kimera-VIO/src/frontend/RgbdCamera.cpp: In function ‘void VIO::convertToPcl(const cv::Mat&, const cv::Mat&, const Intrinsics&, const T&, cv::Mat*, cv::Mat*)’:
/home/charl/scald/mapping/Kimera-VIO/src/frontend/RgbdCamera.cpp:53:48: error: ‘viz’ is not a member of ‘cv’
   53 |       cv::Mat(img_rows, img_cols, CV_8UC3, cv::viz::Color::red());

Please give also the following information:

  • Kimera-Vio branch, tag or commit used: The most recent
  • GTSAM version used:
  • OpenGV version used:
  • OpenCV version used: type opencv_version 4.6.0
  • Operating system and version (e.g. Ubuntu 16.04 or Windows 10): Ubuntu 22.04
  • Did you change the source code? (yes / no): no

Is there any way to fix this build issue

@limshoonkit
Copy link

limshoonkit commented Sep 9, 2024

Did you build your opencv from source?

  1. If so you may need to enable the -DWITH_VTK=On option when building it.
    You can check your opencv version and lib by adding the following lines in CMakeLists.txt
message(STATUS "OpenCV Include: ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV Libs: ${OpenCV_LIBRARIES}")
  1. Following are the options I used to compile it.
find_package(OpenCV 4.10 REQUIRED 
            COMPONENTS 
            viz core imgproc highgui features2d calib3d rgbd video)
  1. In some include folder, camera.h for instance, you may have to add the following header file
#include <opencv2/viz.hpp>

Happy debugging!

@uni-paul-taylor2
Copy link

uni-paul-taylor2 commented Jan 15, 2025

I installed opencv using apt packages, following guidance from the Dockerfile and I have the same issue on Ubuntu 22.04 as well :(

All the other dependencies install and Kimera-VIO itself has been the area of issue

Also, yes, the console output with the error line is the exact same on my end and the opencv version on my end is 4.5.4

@uni-paul-taylor2
Copy link

Downgrading to Ubuntu 20.04 seems to work, using the exact same steps to attempt to build Kimera-VIO in 22.04, reproducible from this commit

@Aurunima
Copy link

Hello,
{Kimera-VIO: latest version on Ubuntu 22.04}
I faced a similar issue with rgbd and viz not being recognised.
Thus, I built opencv from source with -DWITH_VTK=On and still didn't get viz.
Then, I built opencv from source with opencv_contrib and got rgbd to work.
cmake -DWITH_VTK=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ../opencv
viz still doesn't work.
Any inputs on this would be helpful.

@d3276605
Copy link

d3276605 commented Feb 15, 2025

Found a fix-

First, you will need to build opencv with the command "DWITH_VTK=On"

cmake -DWITH_VTK=On ..
make make -j4

Then add the following includes to the top of each file
src/frontend/RgbdCamera.cpp
include/kimera-vio/mesh/MeshOptimization.h

#include <opencv2/viz/viz3d.hpp>
#include <opencv2/viz/types.hpp>

And also, it looks like the current tests/testTracker.cpp file also has an error. Replace the file with the following
https://gist.github.com/d3276605/bf93a74e667c2fd9ec78b4c352c8831f

@AnachronicNomad
Copy link

Can confirm this behavior occurs on multiple aarch64 platforms. Tested with all dependencies built (correctly) from source.

@AnachronicNomad
Copy link

Also needs to have #include <vector> included in include/kimera-vio/utils/UtilsNumerical.h

@AnachronicNomad
Copy link

Headers for cv::viz::* need to be added to tests/testOpticalFlowPredictor.cpp as well.

@AnachronicNomad
Copy link

@d3276605 I was able to successfully build the library and install after applying the above fixes, and disabling the tests with a cmake -D option, (specifically, I turned off tests using the ccmake TUI.

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

6 participants