Comments (5)
`#include
#include
#include
#include
#include<opencv2/core/core.hpp>
#include<System.h>
#include<time.h>
using namespace std;
// From http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/
int main(int argc, char **argv)
{
string vocabPath = "ORBvoc.txt";
string settingsPath = "webcam.yaml";
if (argc == 1)
{
}
else if (argc == 2)
{
vocabPath = argv[1];
}
else if (argc == 3)
{
vocabPath = argv[1];
settingsPath = argv[2];
}
else
{
cerr << endl << "Usage: mono_webcam.exe path_to_vocabulary path_to_settings" << endl;
return 1;
}
// Create SLAM system. It initializes all system threads and gets ready to process frames.
ORB_SLAM3::System SLAM(vocabPath, settingsPath,ORB_SLAM3::System::MONOCULAR,true);
cout << endl << "-------" << endl;
cout << "Start processing sequence ..." << endl;
cv::VideoCapture cap(0);
// From http://stackoverflow.com/questions/19555121/how-to-get-current-timestamp-in-milliseconds-since-1970-just-the-way-java-gets
__int64 now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
// Main loop
cv::Mat im;
cv::Mat Tcw;
while (true)
{
cap.read(im);
if (im.empty())
continue;
__int64 curNow = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
// Pass the image to the SLAM system
Tcw = SLAM.TrackMonocular(im, curNow / 1000.0);
/* This can write each image with its position to a file if you want
if (!Tcw.empty())
{
cv::Mat Rwc = Tcw.rowRange(0, 3).colRange(0, 3).t();
cv::Mat twc = -Rwc*Tcw.rowRange(0, 3).col(3);
std::ostringstream stream;
//stream << "imgs/" << Rwc.at<float>(0, 0) << " " << Rwc.at<float>(0, 1) << " " << Rwc.at<float>(0, 2) << " " << twc.at<float>(0) << " " <<
// Rwc.at<float>(1, 0) << " " << Rwc.at<float>(1, 1) << " " << Rwc.at<float>(1, 2) << " " << twc.at<float>(1) << " " <<
//Rwc.at<float>(2, 0) << " " << Rwc.at<float>(2, 1) << " " << Rwc.at<float>(2, 2) << " " << twc.at<float>(2) << ".jpg";
stream << "imgs/" << curNow << ".jpg";
string fileName = stream.str();
cv::imwrite(fileName, im);
}
*/
// This will make a third window with the color images, you need to click on this then press any key to quit
cv::imshow("Image", im);
if (cv::waitKey(1) >= 0)
break;
}
// Stop all threads
SLAM.Shutdown();
cap.release();
// Save camera trajectory
SLAM.SaveKeyFrameTrajectoryTUM("KeyFrameTrajectory.txt");
return 0;
}
`
here are my codes, why goes wrong? @richard-elvira @jmm-montiel @jjgr3496 @jdtardos
from orb_slam3.
Hi,
Could you provide us the calibration file you are using along the error message you are getting?
from orb_slam3.
%YAML:1.0
#--------------------------------------------------------------------------------------------
Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------
Camera calibration and distortion parameters (OpenCV)
Camera.fx: 458.654
Camera.fy: 457.296
Camera.cx: 367.215
Camera.cy: 248.375
Camera.k1: -0.28340811
Camera.k2: 0.07395907
Camera.p1: 0.00019359
Camera.p2: 1.76187114e-05
Camera frames per second
Camera.fps: 20.0
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
did you mean the yml file?
There is no error message output, the program jumps directly out of the "WAITING FOR IMAGES" window.
I try to track the error, found that the problem may be in Tracking.cc, when getting the mCurrentFrame, the Frame function failed to execute correctly, it exited directly, and did not run into the Frame function.
@jjgr3496
from orb_slam3.
Thank you for posting the calibration file (the .yaml file). The error you are getting is likely caused because you need to add one of the following lines to your calibration file, depending of wich kind of camera you are using:
Camera.type: "PinHole" #For a pinhole camera
or
Camera.type: "KannalaBrandt8" #For a fisheye camera using the KannalaBrand camera model
from orb_slam3.
it works! thank you! @jjgr3496
from orb_slam3.
Related Issues (20)
- error in Tracking::PreintegrateIMU() function HOT 1
- question about the variable avgA in class IMU::Preintegrated HOT 1
- Distance issue displayed during orbslam3 positioning HOT 1
- Merging maps when recently lost or recolalization has been recently
- Dose Stereo-image can reconstruct dense point cloud? HOT 1
- trajectory
- Empty IMU measurements vector!!! HOT 2
- Empty IMU measurements vector!!!
- Issue trying to compile and install ORB_SLAM3 HOT 1
- .
- Segmentation Fault issue during runtime - Eigen::internal::cast_impl
- Segmentation fault on SaveTrajectoryTUM in rgbd_inertial_realsense_D435i
- Segmentation fault on RGB node with D435i camera
- error in building ORB-SLAM3 due to sophus
- The bug in the code within the Optimizer::FullInertialBA function
- make[2]: *** [CMakeFiles/ORB_SLAM3.dir/build.make:554: ../lib/libORB_SLAM3.so] Error 1 make[1]: *** [CMakeFiles/Makefile2:711: CMakeFiles/ORB_SLAM3.dir/all] Error 2 HOT 1
- Linking error in building HOT 4
- Where are examples executables? HOT 1
- Can you tell me how to test the RGBD dataset in ETH3D using orbslam3, thank you
- What are the differences between orb extractor source code between 1,2, and 3 version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orb_slam3.