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

RTABMAP Windows C++ example #205

Closed
ahsteven opened this issue Jun 7, 2017 · 7 comments
Closed

RTABMAP Windows C++ example #205

ahsteven opened this issue Jun 7, 2017 · 7 comments

Comments

@ahsteven
Copy link

ahsteven commented Jun 7, 2017

I installed RTABMAP with the windows binaries and am trying to run Loop closure C++ example at the bottom of the tutorials page. I am able to build the project successfully in Visual Studio 2015 however when I run it with the sample images provided I get an exception at the line:

rtabmap::CameraImages camera(path);

Unhandled exception at 0x00007FFCADE09E08 in example.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x00000041986FBF60.

Then I saw that camera is just a wrapper for cv::imread so I then tried reading the images in by the filenames manually.

Then I get a read access violation exception while executing:

parameters.insert(rtabmap::ParametersPair(rtabmap::Parameters::kRGBDEnabled(), "false"));

Is it because I am missing a .lib file?

When I generated the VS project with cmake the library linker additional dependencies did not turn out good, see screenshot below:

vslinker

I did not think that this loop closure example used g20 and some other dependencies anyway so I removed them. Any idea on why these .lib linker dependencies got loaded like this by cmake?

So after removing these I just have the rtabmap .lib files and teh opencv lib files as shown below
image

It is with these settings that I get the exceptions I mention above. the 32.lib linker files look suspicious.

What is the easiest way to run a c++ rtabmap example on Windows? Thanks for any help.

@matlabbe
Copy link
Member

matlabbe commented Jun 7, 2017

Make sure you executed cmake in a Win64 terminal. Also, what is the output after the original cmake (when build folder is empty)?

$ cmake -G"Visual Studio 14 2015 Win64" ..

OpenCV should also been built the same way in a Win64 terminal, if you don't use the binaries.

cheers,
Mathieu

@ahsteven
Copy link
Author

ahsteven commented Jun 7, 2017 via email

@matlabbe
Copy link
Member

matlabbe commented Jun 8, 2017

Hi,

there is my cmake status on Windows 10 / Visual Studio 2015:

C:\workspace\rtabmap\build>cmake -G"Visual Studio 14 2015 Win64" ..
-- The C compiler identification is MSVC 19.0.23918.0
-- The CXX compiler identification is MSVC 19.0.23918.0
-- Check for working C compiler using: Visual Studio 14 2015 Win64
-- Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found eigen: C:/Program Files/Eigen/include/eigen3
-- Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
-- Found Flann: C:/Program Files/flann/lib/flann_cpp_s.lib
-- Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
-- Found qhull: C:/Program Files/qhull/lib/qhullstatic.lib
-- Found PCL_COMMON: C:/Program Files/PCL/lib/pcl_common_release.lib
-- Found PCL_OCTREE: C:/Program Files/PCL/lib/pcl_octree_release.lib
-- Found PCL_IO: C:/Program Files/PCL/lib/pcl_io_release.lib
-- Found PCL_KDTREE: C:/Program Files/PCL/lib/pcl_kdtree_release.lib
-- Found PCL_SEARCH: C:/Program Files/PCL/lib/pcl_search_release.lib
-- Found PCL_SAMPLE_CONSENSUS: C:/Program Files/PCL/lib/pcl_sample_consensus_release.lib
-- Found PCL_FILTERS: C:/Program Files/PCL/lib/pcl_filters_release.lib
-- Found PCL_2D: C:/Program Files/PCL/include/pcl-1.8
-- Found PCL_GEOMETRY: C:/Program Files/PCL/include/pcl-1.8
-- Found PCL_FEATURES: C:/Program Files/PCL/lib/pcl_features_release.lib
-- Found PCL_ML: C:/Program Files/PCL/lib/pcl_ml_release.lib
-- Found PCL_SEGMENTATION: C:/Program Files/PCL/lib/pcl_segmentation_release.lib
-- Found PCL_VISUALIZATION: C:/Program Files/PCL/lib/pcl_visualization_release.lib
-- Found PCL_SURFACE: C:/Program Files/PCL/lib/pcl_surface_release.lib
-- Found PCL_REGISTRATION: C:/Program Files/PCL/lib/pcl_registration_release.lib
-- Found PCL_KEYPOINTS: C:/Program Files/PCL/lib/pcl_keypoints_release.lib
-- Found PCL_TRACKING: C:/Program Files/PCL/lib/pcl_tracking_release.lib
-- Found PCL_RECOGNITION: C:/Program Files/PCL/lib/pcl_recognition_release.lib
-- Found PCL_STEREO: C:/Program Files/PCL/lib/pcl_stereo_release.lib
-- Found PCL_OUTOFCORE: C:/Program Files/PCL/lib/pcl_outofcore_release.lib
-- Found PCL_PEOPLE: C:/Program Files/PCL/lib/pcl_people_release.lib
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: /openmp
-- Found OpenMP
-- Found OpenCV: C:/Program Files (x86)/ZED SDK/dependencies/opencv_3.1.0/include;C:/Program Files (x86)/ZED SDK/dependencies/opencv_3.1.0/include/opencv
-- Found PCL: C:/Program Files/PCL/include/pcl-1.8;C:/Program Files/Eigen/include/eigen3;C:/boost_1_61_0;C:/Program Files/OpenNI2/Include;C:/Program Files (x86)/Intel/RSSDK/include;C:/Program Files/VTK/include/vtk-6.3;C:/Program Files/flann/include;C:/Program Files/qhull/include
-- Found ZLIB: C:/Program Files/zlib/include
-- Found freenect2: C:/workspace/libfreenect2/build/install/include
-- Found OpenNI2: C:/Program Files/OpenNI2/Include
-- Found CSPARSE: C:/Program Files/g2o/include/EXTERNAL/csparse
-- Found g2o: C:/Program Files/g2o/include;C:/Program Files/g2o/include/EXTERNAL/csparse
-- GTSAM include directory:  C:/Program Files/GTSAM/CMake/../include;C:/Program Files/GTSAM/include/gtsam/3rdparty/Eigen/
-- Found FlyCapture2: C:/Program Files/Point Grey Research/FlyCapture2/include;C:/Program Files/Point Grey Research/Triclops Stereo Vision SDK/include
-- Found cvsba: C:/Program Files/cvsba/include
-- Found ZED sdk: C:\Program Files (x86)\ZED SDK\include
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0 (found version "8.0")
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/include
-- Found RealSense: C:/workspace/librealsense/include
-- Found octomap: C:/Program Files/octomap-distribution/include
-- Found CPUTSDF: C:/Program Files/cpu_tsdf/include
-- --------------------------------------------
-- Info :
--   Version : 0.12.5
--   CMAKE_INSTALL_PREFIX = C:/Program Files/RTABMap
--   CMAKE_BUILD_TYPE =
--   CMAKE_INSTALL_LIBDIR = lib
--   BUILD_APP =            ON
--   BUILD_TOOLS =          ON
--   BUILD_EXAMPLES =       ON
--   CMAKE_CXX_FLAGS =  /DWIN32 /D_WINDOWS /W3 /GR /EHsc  /openmp
--   With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = YES (License: Non commercial)
--   With Freenect             = NO (libfreenect not found)
--   With OpenNI2              = YES (License: Apache v2)
--   With Freenect2            = YES (License: Apache v2 and/or GPLv2)
--   With dc1394               = NO (dc1394 not found)
--   With FlyCapture2/Triclops = YES
--   With TORO                 = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
--   With g2o                  = YES (License: BSD)
--   With GTSAM                = YES (License: BSD)
--   With VERTIGO              = YES (License: GPLv3)
--   With cvsba                = YES (License: GPLv2)
--   With ZED                  = YES (With CUDA)
--   With RealSense            = YES (License: Apache-2)
--   With RealSenseSlam        = NO (WITH_REALSENSE_SLAM=OFF)
--   With OCTOMAP              = YES (License: BSD)
--   With CPUTSDF              = YES (License: BSD)
--   With Qt5                  = YES (License: Open Source or Commercial)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/workspace/rtabmap/build

C:\workspace\rtabmap\build>cmake --version
cmake version 3.3.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Then testing the C++ loop closure example built by default (rtabmap-bow_mapping.exe):

C:\workspace\rtabmap\bin>rtabmap-bow_mapping.exe data/samples

Processing images... from directory "data/samples"
 #1 ptime(0.212420s) STM(1) WM(0) hyp(0) value(0.00)
 #2 ptime(0.037060s) STM(2) WM(0) hyp(0) value(0.00)
 #3 ptime(0.039333s) STM(3) WM(0) hyp(0) value(0.00)
 #4 ptime(0.028221s) STM(4) WM(0) hyp(0) value(0.00)
 #5 ptime(0.027663s) STM(5) WM(0) hyp(0) value(0.00)
 #6 ptime(0.029803s) STM(6) WM(0) hyp(0) value(0.00)
 #7 ptime(0.041403s) STM(7) WM(0) hyp(0) value(0.00)
 #8 ptime(0.029140s) STM(8) WM(0) hyp(0) value(0.00)
 #9 ptime(0.026811s) STM(9) WM(0) hyp(0) value(0.00)
 #10 ptime(0.028112s) STM(10) WM(0) hyp(0) value(0.00)
 #11 ptime(0.029394s) STM(10) WM(1) hyp(1) value(0.00)
 #12 ptime(0.042664s) STM(10) WM(2) hyp(1) value(0.00)
 #13 ptime(0.030348s) STM(10) WM(3) hyp(1) value(0.00)
 #14 ptime(0.041404s) STM(10) WM(4) hyp(2) value(0.00)
 #15 ptime(0.043788s) STM(10) WM(5) hyp(5) value(0.00)
 #16 ptime(0.027905s) STM(10) WM(6) hyp(0) value(0.00)
 #17 ptime(0.028283s) STM(10) WM(7) hyp(0) value(0.00)
 #18 ptime(0.028261s) STM(10) WM(8) hyp(0) value(0.00)
 #19 ptime(0.028510s) STM(10) WM(9) hyp(0) value(0.00)
 #20 ptime(0.043865s) STM(10) WM(10) hyp(5) value(0.00)
 #21 ptime(0.029427s) STM(10) WM(11) hyp(1) value(0.00)
 #22 ptime(0.042447s) STM(10) WM(12) hyp(5) value(0.00)
 #23 ptime(0.028039s) STM(10) WM(13) hyp(4) value(0.00)
 #24 ptime(0.027994s) STM(10) WM(14) hyp(6) value(0.00)
 #25 ptime(0.027949s) STM(10) WM(15) hyp(0) value(0.00)
 #26 ptime(0.035269s) STM(10) WM(16) hyp(11) value(0.00)
 #27 ptime(0.038687s) STM(10) WM(17) hyp(11) value(0.00)
 #28 ptime(0.039652s) STM(10) WM(18) hyp(7) value(0.00)
 #29 ptime(0.043627s) STM(10) WM(19) hyp(15) value(0.00)
 #30 ptime(0.045455s) STM(10) WM(20) hyp(12) value(0.00)
 #31 ptime(0.038969s) STM(10) WM(21) hyp(1) value(0.00)
 #32 ptime(0.037878s) STM(10) WM(22) hyp(4) value(0.00)
 #33 ptime(0.041689s) STM(10) WM(23) hyp(2) value(0.00)
 #34 ptime(0.049338s) STM(10) WM(24) hyp(1) value(0.00)
 #35 ptime(0.044474s) STM(10) WM(25) hyp(14) value(0.00)
 #36 ptime(0.048785s) STM(10) WM(26) hyp(7) value(0.00)
 #37 ptime(0.032092s) STM(10) WM(27) hyp(15) value(0.00)
 #38 ptime(0.038900s) STM(10) WM(28) hyp(14) value(0.00)
 #39 ptime(0.039281s) STM(10) WM(29) hyp(13) value(0.00)
 #40 ptime(0.034810s) STM(10) WM(30) hyp(0) value(0.00)
 #41 ptime(0.040739s) STM(10) WM(31) hyp(2) value(0.13) *LOOP 41->2*
 #42 ptime(0.029568s) STM(10) WM(32) hyp(3) value(0.17) *LOOP 42->3*
 #43 ptime(0.039620s) STM(10) WM(33) hyp(4) value(0.21) *LOOP 43->4*
 #44 ptime(0.037922s) STM(10) WM(34) hyp(4) value(0.22) *LOOP 44->4*
 #45 ptime(0.039963s) STM(10) WM(35) hyp(6) value(0.25) *LOOP 45->6*
 #46 ptime(0.027503s) STM(10) WM(36) hyp(0) value(0.00)
 #47 ptime(0.038336s) STM(10) WM(37) hyp(7) value(0.27) *LOOP 47->7*
 #48 ptime(0.030060s) STM(10) WM(38) hyp(9) value(0.29) *LOOP 48->9*
 #49 ptime(0.042762s) STM(10) WM(39) hyp(10) value(0.30) *LOOP 49->10*
 #50 ptime(0.039354s) STM(10) WM(40) hyp(11) value(0.32) *LOOP 50->11*
 #51 ptime(0.040921s) STM(10) WM(41) hyp(11) value(0.40) *LOOP 51->11*
 #52 ptime(0.030265s) STM(10) WM(42) hyp(13) value(0.46) *LOOP 52->13*
 #53 ptime(0.030925s) STM(10) WM(43) hyp(14) value(0.52) *LOOP 53->14*
 #54 ptime(0.034514s) STM(10) WM(44) hyp(14) value(0.60) *LOOP 54->14*
 #55 ptime(0.040315s) STM(10) WM(45) hyp(15) value(0.59) *LOOP 55->15*
 #56 ptime(0.022376s) STM(10) WM(46) hyp(0) value(0.00)
 #57 ptime(0.036058s) STM(10) WM(47) hyp(0) value(0.00)
 #58 ptime(0.023427s) STM(10) WM(48) hyp(0) value(0.00)
 #59 ptime(0.027829s) STM(10) WM(49) hyp(0) value(0.00)
 #60 ptime(0.031508s) STM(10) WM(50) hyp(15) value(0.43) *LOOP 60->15*
 #61 ptime(0.032047s) STM(10) WM(51) hyp(21) value(0.37) *LOOP 61->21*
 #62 ptime(0.035494s) STM(10) WM(52) hyp(22) value(0.37) *LOOP 62->22*
 #63 ptime(0.033199s) STM(10) WM(53) hyp(23) value(0.43) *LOOP 63->23*
 #64 ptime(0.029322s) STM(10) WM(54) hyp(24) value(0.55) *LOOP 64->24*
 #65 ptime(0.033770s) STM(10) WM(55) hyp(0) value(0.00)
 #66 ptime(0.034588s) STM(10) WM(56) hyp(26) value(0.49) *LOOP 66->26*
 #67 ptime(0.044351s) STM(10) WM(57) hyp(27) value(0.48) *LOOP 67->27*
 #68 ptime(0.049305s) STM(10) WM(58) hyp(28) value(0.48) *LOOP 68->28*
 #69 ptime(0.038375s) STM(10) WM(59) hyp(30) value(0.49) *LOOP 69->30*
 #70 ptime(0.038834s) STM(10) WM(60) hyp(31) value(0.47) *LOOP 70->31*
 #71 ptime(0.037154s) STM(10) WM(61) hyp(32) value(0.45) *LOOP 71->32*
 #72 ptime(0.042587s) STM(10) WM(62) hyp(33) value(0.48) *LOOP 72->33*
 #73 ptime(0.047081s) STM(10) WM(63) hyp(34) value(0.44) *LOOP 73->34*
 #74 ptime(0.048294s) STM(10) WM(64) hyp(35) value(0.45) *LOOP 74->35*
 #75 ptime(0.034725s) STM(10) WM(65) hyp(36) value(0.52) *LOOP 75->36*
 #76 ptime(0.042964s) STM(10) WM(66) hyp(37) value(0.68) *LOOP 76->37*
 #77 ptime(0.037979s) STM(10) WM(67) hyp(38) value(0.79) *LOOP 77->38*
 #78 ptime(0.054263s) STM(10) WM(68) hyp(39) value(0.83) *LOOP 78->39*
 #79 ptime(0.027939s) STM(10) WM(69) hyp(39) value(0.82) *LOOP 79->39*
 #80 ptime(0.023227s) STM(10) WM(70) hyp(0) value(0.00)
 #81 ptime(0.035671s) STM(10) WM(71) hyp(41) value(0.78) *LOOP 81->41*
 #82 ptime(0.032199s) STM(10) WM(72) hyp(42) value(0.77) *LOOP 82->42*
 #83 ptime(0.037945s) STM(10) WM(73) hyp(3) value(0.79) *LOOP 83->3*
 #84 ptime(0.044736s) STM(10) WM(74) hyp(4) value(0.77) *LOOP 84->4*
Processing images completed. Loop closures found = 37
Generated graph "Graph.dot", viewable with Graphiz using "neato -Tpdf Graph.dot -o out.pdf"
Saving Long-Term Memory to "rtabmap.db"...

The OpenCV version is the one from ZED sdk, but it should be okay with the standard OpenCV binaries.

cheers,
Mathieu

@ahsteven
Copy link
Author

ahsteven commented Jun 8, 2017 via email

@ahsteven
Copy link
Author

ahsteven commented Jun 8, 2017 via email

@matlabbe matlabbe closed this as completed Jul 4, 2017
@frischzenger
Copy link

onecore\net\netprofiles\service\src\nsp\dll\namespaceserviceprovider.cpp(550)\nlansp_c.dll!00007FFB15FCD93D: (caller: 00007FFB3F24ACF6) LogHr(72) tid(793c) 8007277C
'RTABMap.exe' (Win32): Unloaded 'C:\Windows\System32\msftedit.dll'
The thread 0x8574 has exited with code 0 (0x0).
The thread 0x87dc has exited with code 0 (0x0).
The thread 0x79e8 has exited with code 0 (0x0).
The thread 0x7cc8 has exited with code 0 (0x0).
The thread 0x5f48 has exited with code 0 (0x0).
Exception thrown at 0x00007FFB3E7EFDEC in RTABMap.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000483CE7E898.
Unhandled exception at 0x00007FFB3E7EFDEC in RTABMap.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000483CE7E898.

i 've also meet this problem, i have try it on vs2019, but crashed

@frischzenger
Copy link

frischzenger commented May 12, 2023

after read 3 pair of rgb/depth images, it crashes,
it reports:
OpenCV(3.4.11) Error: Assertion failed (res != 0) in cv::Mat::elemSize, file D:\AllLibs\opencv-3.4.11\build\install\include\opencv2/core/mat.inl.hpp, line 955

but release mode is fine

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