Ask Your Question

Cannot localize using RTABmap

asked 2019-08-12 13:40:35 -0600

EdwardNur gravatar image


I am using stereo_image_proc to create a disparity images and then create a depth map using RTABmap standalone nodelet to create RGBD images:

<node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth">
        <remap from="disparity" to="/stereo/disparity"/>

    <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync" output="screen">
        <remap from="rgb/image" to="/stereo/left/image_rect"/>
        <remap from="depth/image" to="depth"/>
        <remap from="rgb/camera_info" to="stereo/left/camera_info"/>
        <remap from="rgbd_image" to="rgbd_image"/>
        <param name="approx_sync" type="bool" value="false"/>

Then I am feeding the rgbd images to rtabmap in order to create a map (using LiDAR but letting images to be saved in a vocabulary for a future localization) and then trying to localize with the same nodelet as above with previously created map and rgbd images. At some point, I will get this error:

what():  OpenCV(4.1.1-pre) /home/a/opencv-4.1.0/modules/calib3d/src/calibration.cpp:1171: error: (-2:Unspecified error) in function 'void cvFindExtrinsicCameraParams2(const CvMat*, const CvMat*, const CvMat*, const CvMat*, CvMat*, CvMat*, int)'
DLT algorithm needs at least 6 points for pose estimation from 3D-2D point correspondences. (expected: 'count >= 6'), where
    'count' is 5
must be greater than or equal to
    '6' is 6

After this error, I have decided to turn off the loop closure:

<!-- RTAB-Map's parameters -->
            <param name="RGBD/OptimizeMaxError" type="double" value="3"  />
            <param name="RGBD/NeighborLinkRefining" type="string" value="true"/>
            <param name="RGBD/ProximityBySpace"     type="string" value="true"/>
            <param name="RGBD/OptimizeFromGraphEnd" type="string" value="false"/>
            <param name="RGBD/AngularUpdate"        type="string" value="0.05"/>
            <param name="RGBD/LinearUpdate"         type="string" value="0.05"/>
            <param name="Vis/MinInliers"            type="string" value="5"/>
            <param name="Kp/MaxDepth"               type="string" value="4"/>
            <param name="Vis/MaxDepth"              type="string" value="4"/>
            <param name="Rtabmap/TimeThr"           type="string" value="0"/>
            <param name="Rtabmap/DetectionRate"     type="string" value="$(arg rate)" />
            <param name="Mem/RehearsalSimilarity"   type="string" value="0.45"/>
            <param name="Grid/MaxObstacleHeight"    type="string" value="1.7" />
            <param name="Grid/NoiseFilteringRadius" type="string" value="0.05"/>
            <param name="Grid/NoiseFilteringMinNeighbors" type="string" value="5"/>
            <param name="Grid/3D" type="bool" value="false"/>
            <param name="Grid/RayTracing" type="bool" value="true"/>
              <param name="Reg/Force3DoF" type="bool" value="true"/>
              <param name="Stereo/MaxDisparity" type="string" value="200"/>
            <param if="$(arg localization)" name="Reg/Strategy" type="string" value="0"/>
            <param unless="$(arg localization)" name="Reg/Strategy" type="string" value="1"/>
            <param if="$(arg localization)" name="RGBD/CreateOccupancyGrid" type="string" value="false"/>
        <param name="Kp/WordsPerImage" type="string" value="-1"/>

            <!-- Localization mode -->
            <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
            <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>
            <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/> ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-17 09:11:40 -0600

matlabbe gravatar image

updated 2020-04-02 14:10:09 -0600


The error refers to PnP motion estimation, for which in OpenCV4.1 the minimum features should be 6 instead of 5. That calibration function is called from here when iterative PnP is used (Vis/PnPFlags=0). Try withVis/MinInliers set to 6. You can also try another PnP flags with Vis/PnPFlags (0 default), see all possible values for OpenCV4.1 here.

EDITSee issue here:, this has been fixed by this commit.


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-08-12 13:40:35 -0600

Seen: 247 times

Last updated: Apr 02