avisingh599 / mono-vo Goto Github PK
View Code? Open in Web Editor NEWAn OpenCV based implementation of Monocular Visual Odometry
License: MIT License
An OpenCV based implementation of Monocular Visual Odometry
License: MIT License
Hi, I used your same logic in my python code in order to compute relative camera position from pair of images, I am getting about 2-3 degrees of error. Can you please help?
I am running the same code but for different dataset which include images taken from my stereo camera . I don't know how to make poses file and pcalib.txt for my dataset.
Can anybody help me to solve this issue?
Hi @avisingh599 , Awesome tutorial. Helped me a lot.
When I run the executable, it draws a straight line in the trajectory window. For some reason, it does not consider the rotation. I have not made any changes to the code apart from adapting to opencv 2.4.8, i.e. using findFundamentalMat and SVD for finding R and t.
You can see the screenshot on dropbox:
https://www.dropbox.com/s/fr83n7stibsamcx/Screenshot%20from%202016-03-23%2016%3A39%3A06.png?dl=0
Thanks
Ankit
I am so sorry to trouble you, as I found a problem in your code,when you try to calculate R and t. First, you calculate t_f and then calculate R_f (By using 1. t_f = t_f + scale_(R_f_t);
2.R_f = R_R_f in you code) .What's more, I think you made the wrong order as we should calculate R_f at first and then calculate t_f (By using 1.R_f = R_R_f 2. t_f = t_f + scale_(R_f_t)),which was described in the Constructing Trajectory part of your blog(http://avisingh599.github.io/vision/monocular-vo).
Sorry for my disturbance and thank you very much for your code.I sincerely want to know whether I am right or not and I need your help. Thanks and best wishes!
scale = getAbsoluteScale(numFrame, 0, t.at(2));
The result is always zero.
I don't know how this function is computed. Any reference? Thanks.
Hi @avisingh599 ,when I run the code in Visual Studio 2013, I always have this proplem:
Debug Assertion Failed!
Program:..Odometry\matlab\Monocular visual odometry\demo\Debug\demo.exe
File:f:\dd\vctools\crt\crtw32\misc\dbgheap.c
Line:1424
Expression:_pFirstBlock==pHead
Could you help me? Sincerely.
Hello
I have solved some questions when i run the code with grayscale image in the 00 sequence,but i have a new error as follow,it occurred while reading the 455th images
OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 1102 terminate called after throwing an instance of 'cv::Exception'
could you give me some advice?Thanks a lot!
We know that due to the scale indefiniteness problem, we cannot estimate the distance traveled by the camera without distance information.
However, we would like to get the relative travel distance.
Can you determine the relative travel distance of the monocular camera under the following conditions?
・Input is video image (or acceleration and gyro sensor values)
・No ground-truth
・No distance information
Hello! @avisingh599 How can I use my own dataset to build odometry? I am especially interested in how I can calculate the values from 00.txt for my dataset, and also in what format the value of the focal length is written (718 ,,,).
Hi, @avisingh599 ,
Where could i download "00.txt" for absolute scale? I couldn't find it in KITTI website.
Thank your for your excellent work, I met some error when I tried to learn your code. Please help me .
leon@leon-Prime-Series:~/mono-vo/build$ make
Scanning dependencies of target vo
[100%] Building CXX object CMakeFiles/vo.dir/src/visodo.cpp.o
/home/leon/mono-vo/src/visodo.cpp: In function ‘int main(int, char**)’:
/home/leon/mono-vo/src/visodo.cpp:192:48: error: ‘CV_RGB’ was not declared in this scope
circle(traj, Point(x, y) ,1, CV_RGB(255,0,0), 2);
^
/home/leon/mono-vo/src/visodo.cpp:194:68: error: ‘CV_FILLED’ was not declared in this scope
rectangle( traj, Point(10, 30), Point(550, 50), CV_RGB(0,0,0), CV_FILLED);
^
make[2]: *** [CMakeFiles/vo.dir/src/visodo.cpp.o] error 1
make[1]: *** [CMakeFiles/vo.dir/all] error 2
make: *** [all] error 2
Hi there,
thanks a lot for your software. I would like to "augment" (make more accurate/precise) my plain GPS unit's readings with visual odometry (acutally do sensor fusion). The use case would be when one is in city downtown with high buildings then the GPS readings are unreliable in some situations and I would like to compensate for this with visual odometry.
My question is following - is it possible to calibrate a given mono camera setup to introduce an absolute scale for its odometry output? I mean something like to travel a known distance (say 100m) and then introduce some constant to odometry calculation so that it would know itself it took 100m for future measurements?
I will appreciate your answer a lot! Thanks in advance!
Hi,
Please, could you explain how do you get the performance graph ? how it is possible to replay it ?
I needed to add a minimum version to the CMakeLists.txt because I have an older version of OpenCV installed.
find_package( OpenCV 3.0 REQUIRED )
use my own data, but havo no groundtruth, how to unifirm the scale?
Dear Avi Singh,
Thanks a lot for this code, it'a a great help for monocular odometry. Could you indicate precisely which KITTY dataset do you use in your example ?
First question in the image reading (l86, l87 and l158), you use 6 digits for the filename, but some of the datasets use 10 digits for the filename, do you know a way to read this 10 digits properly, "*10d" is not working. I have solve this issue by renaming the image filenames.
Then I run several errors when runing the code with several KITTY dataset:
I've tried first with colored image, but i get the error "error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'". It occur in the loop when converting RGB2GRAY
I've also tried with gray images, but i get the error "error: (-215:Assertion failed) (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 in function 'calc'"" happening in the loop during featureTracking.
Do you know how from when the errors can come ?
I'm using Ubuntu 14.04 and OpenCV 3.4.3 with the KITTY dataset 2011_09_26_drive_0001
Computer : Intel® Core™ i7-4712MQ CPU @ 2.30GHz × 8 RAM : 16Go
Best regards
Boris
Hi,
could you please explain this part of the code?
if((scale>0.1) && (t.at<double>(2) > t.at<double>(0))
&& (t.at<double>(2) > t.at<double>(1)))
{
t_f = t_f + scale*(R_f*t);
R_f = R*R_f;
}
else
{
cout << "scale below 0.1, or incorrect translation" << endl;
}
when I apply this code to my own dataset, I get unreasonable results.
Is there any theoretical logic written in any textbooks you might know about rotation and translation concatenation to build the trajectory?
Cheers,
I don't understand this because prevPts and currPts are not used anywhere !
Mat prevPts(2,prevFeatures.size(), CV_64F), currPts(2,currFeatures.size(), CV_64F);
for(int i=0;i<prevFeatures.size();i++) { //this (x,y) combination makes sense as observed from the source code of triangulatePoints on GitHub
prevPts.at<double>(0,i) = prevFeatures.at(i).x;
prevPts.at<double>(1,i) = prevFeatures.at(i).y;
currPts.at<double>(0,i) = currFeatures.at(i).x;
currPts.at<double>(1,i) = currFeatures.at(i).y;
}
Have you tried to optimize the past frames through the connection of mappoints? I think that Bundle Adjustment might be a good choice to the scale drift problem. The error will accumulate, and if the environment changes quickly, this situation will be worse.
By the way, why did you say that your algorithm can not calcullate the relative pose? R and t are calculated by the comparison from prevframe to currentframe.
Thank you!
Hello
Thanks for your nice code first! I use this code with grayscale image in the sequences 00 of the KITTI dataset. And i have some questions with your code.
results1_1.txt
,the sequences 00 only have the image0, image1, calib.txt and time.txt
ofstream myfile;
myfile.open ("results1_1.txt");
2.The function double getAbsoluteScale(int frame_id, int sequence_id, double z_cal)
has three parameters, but the z_cal
is not used, whether it is ok?
Could you give some help, thanks a lot!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.