raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.29k stars 4.69k forks source link

OpenCV Error: #431

Open Gasethata opened 6 years ago

Gasethata commented 6 years ago

This is what I get while trying to use the ROS Example running monocular node.

Input sensor was set to: Monocular OpenCV Error: Unknown error code -49 (Input file is empty) in cvOpenFileStorage, file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/src/persistence.cpp, line 4422 terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/src/persistence.cpp:4422: error: (-49) Input file is empty in function cvOpenFileStorage

Aborted (core dumped)

Can someone please help me out on this one. Thanks in advance.

YuehChuan commented 6 years ago

@Gasethata Same Issue! What's is your envionment I'm using raspberry pi3 with ubuntuMATE16.04.3, ROS kinetic, and with OpenCV-3.3.0(newest one) installed I guess is OpenCV version problem. ORB_SLAM2 just support toup to OpenCV-3.2.0

YuehChuan commented 6 years ago

I;m using ros package usb_cam and run mono camera demo with command rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Monocular/head_camera.yaml /camera/image_raw:=/usb_cam/image_raw

YuehChuan commented 6 years ago

relate to https://github.com/HKUST-Aerial-Robotics/VINS-Mono/issues/31

YuehChuan commented 6 years ago

quite wired, i already delete opencv-3.3.0 from /usr/local/lib /usr/local/include then compile everything make sure it is configured with kinetics opencv-3.2.0 using find_package(OpenCV 3.2.0 REQUIRED) , also open GUI for ubnutuMATE still same issue DBoW2, ORB_SLAM2 ros, ORB_SLAM2 dbow2 orb_slam2_ros orb_slam2_build

Gasethata commented 6 years ago

I have managed to solve the problem. The problem was the settings file that contained my camera calibration parameters. Do check it.

But from that being fixed, new problem came.

After running this command: rosrun ORB_SLAM2 Mono /home/vip/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/vip/ORB_SLAM2/Examples/ROS/ORB_SLAM2/SettingsFiles/microsoftWebcam.yaml /camera/image_raw:=/usb_cam/image_raw

I get a black window stating that its "WAITING FOR IMAGES" I think its got something to do with ROS.

Can someone please help me out here.

Gasethata commented 6 years ago

Hi everyone I managed to solve the "WAITING FOR IMAGES" issue. This is what i did:

  1. roscore
  2. roslaunch usb_cam-test.launch (make sure that you are in the .launch file directory)
    • for my case, usb_cam is the topic I'm using.
  3. rosrun ORB_SLAM2 Mono /home/vip/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/vip/ORB_SLAM2/Examples/ROS/ORB_SLAM2/SettingsFiles/microsoftWebcam.yaml /camera/image_raw:=/usb_cam/image_raw
BBlackB commented 6 years ago

Hi @Gasethata, I have the same problem("OpenCV Error"). could you please talk about the details that how you solve the "OpenCV Error" problem? Thanks in advance.

BBlackB commented 6 years ago

I got it. It is wrong style of yaml file that cause the problem. Thanks for all guys!

konnpaku-youmu commented 5 years ago

@BBlackB Yeah, you are right! Thanks!

zivAstra commented 5 years ago

Can you be more specific as to what fixes the yaml problem? Thanks

braineniac commented 5 years ago

If anybody else stumbles upon this problem, this is how you change the yaml file

heshanchuan commented 4 years ago

I fixed same problem. It's all about the YAML grammar. I find there is a blank space before %YAML:1.0 So I delete the blank space.