Skip to content

Commit

Permalink
several fixes as recommended by raulmur#337 (comment) and zhenzhenxia…
Browse files Browse the repository at this point in the history
…ng/orb_slam_2_ros-1@1e6a52a, and additionally added yaml for basic SLAM test on miniworld images
  • Loading branch information
balisujohn committed Mar 21, 2021
1 parent f2e6f51 commit e828af8
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Examples/Monocular/TUM2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500

#Viewer.ViewpointX: 0
#Viewer.ViewpointY: -0.7
#Viewer.ViewpointZ: -1.8
#Viewer.ViewpointF: 500
61 changes: 61 additions & 0 deletions Examples/Monocular/miniworld1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
%YAML:1.0

#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------

# Camera calibration and distortion parameters (OpenCV)
Camera.fx: 520.908620
Camera.fy: 521.007327
Camera.cx: 325.141442
Camera.cy: 249.701764

Camera.k1: 0.231222
Camera.k2: -0.784899
Camera.p1: -0.003257
Camera.p2: -0.000105
Camera.k3: 0.917205

# Camera frames per second
Camera.fps: .5

# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 1

#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000

# ORB Extractor: Scale factor between levels in the scale pyramid
ORBextractor.scaleFactor: 1.2

# ORB Extractor: Number of levels in the scale pyramid
ORBextractor.nLevels: 8

# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7

#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize:2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500
#Viewer.ViewpointX: 0
#Viewer.ViewpointY: -0.7
#Viewer.ViewpointZ: -1.8
#Viewer.ViewpointF: 500
2 changes: 2 additions & 0 deletions include/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include<thread>
#include<opencv2/core/core.hpp>

#include <unistd.h>

#include "Tracking.h"
#include "FrameDrawer.h"
#include "MapDrawer.h"
Expand Down
5 changes: 4 additions & 1 deletion src/Initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,13 @@ int Initializer::CheckRT(const cv::Mat &R, const cv::Mat &t, const vector<cv::Ke

vCosParallax.push_back(cosParallax);
vP3D[vMatches12[i].first] = cv::Point3f(p3dC1.at<float>(0),p3dC1.at<float>(1),p3dC1.at<float>(2));
nGood++;


if(cosParallax<0.99998)
{
vbGood[vMatches12[i].first]=true;
nGood++;
}
}

if(nGood>0)
Expand Down
2 changes: 1 addition & 1 deletion src/ORBmatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int ORBmatcher::SearchForInitialization(Frame &F1, Frame &F2, vector<cv::Point2f
float rot = F1.mvKeysUn[i1].angle-F2.mvKeysUn[bestIdx2].angle;
if(rot<0.0)
rot+=360.0f;
int bin = round(rot*factor);
int bin = round(rot/(360.0f*factor));
if(bin==HISTO_LENGTH)
bin=0;
assert(bin>=0 && bin<HISTO_LENGTH);
Expand Down

0 comments on commit e828af8

Please sign in to comment.