OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 26 Jul 2016 03:07:17 -0500OpenCV Structure from Motion Reprojection Issuehttp://answers.opencv.org/question/98966/opencv-structure-from-motion-reprojection-issue/ I am currently facing an issue with my Structure from Motion program based on OpenCv. I'm gonna try to depict you what it does, and what it is supposed to do.
This program lies on the classic "structure from motion" method.
The basic idea is to take a pair of images, detect their keypoints and compute the descriptors of those keypoints. Then, the keypoints matching is done, with a certain number of tests to insure the result is good. That part works perfectly.
Once this is done, the following computations are performed : fundamental matrix, essential matrix, SVD decomposition of the essential matrix, camera matrix computation and finally, triangulation.
The result for a pair of images is a set of 3D coordinates, giving us points to be drawn in a 3D viewer. This works perfectly, for a pair.
Indeed, here is my problem : for a pair of images, the 3D points coordinates are calculated in the coordinate system of the first image of the image pair, taken as the reference image. When working with more than two images, which is the objective of my program, I have to reproject the 3D points computed in the coordinate system of the very first image, in order to get a consistent result.
My question is : How do I reproject 3D points coordinate given in a camera related system, into an other camera related system ? With the camera matrices ?
My idea was to take the 3D point coordinates, and to multiply them by the inverse of each camera matrix before.
I clarify :
Suppose I am working on the third and fourth image (hence, the third pair of images, because I am working like 1-2 / 2-3 / 3-4 and so on).
I get my 3D point coordinates in the coordinate system of the third image, how do I do to reproject them properly in the very first image coordinate system ?
I would have done the following :
Get the 3D points coordinates matrix, apply the inverse of the camera matrix for image 2 to 3, and then apply the inverse of the camera matrix for image 1 to 2. Is that even correct ?
Because those camera matrices are non square matrices, and I can't inverse them.
I am surely mistaking somewhere, and I would be grateful if someone could enlighten me, I am pretty sure this is a relative easy one, but I am obviously missing something...
Thanks a lot for reading :)DysthTue, 26 Jul 2016 03:07:17 -0500http://answers.opencv.org/question/98966/Where is the extrinsics file for the aloe plant for reprojection?http://answers.opencv.org/question/94679/where-is-the-extrinsics-file-for-the-aloe-plant-for-reprojection/ Hi community,
I was just tracking the samples shipped with OpenCV created the disparity
map for the aloe plant but cannot reproject3d as i cannot find the extrinsics
file in the samples directory. I know this is a loser question :) maybe someone
can point out a better example data set?
The example file is ; **/opencv\sources\samples\cpp\stereo_match.cpp**
..but this is a console program and expects the file names as the parameters which
i do not know where to get. I'm assuming the right intrinsics file is the 'intrinsics.yml'
file found in /opencv\sources\samples\data, but it is impossible without having the
extrinsics to reproject3d. The disparity map settings is as follows for those who might be
interested:
sStereo->alg = StereoCameraRig::STEREO_SGBM;
sStereo->SADWindowSize = 11;
sStereo->numberOfDisparities = 192;
sStereo->preFilterCap = 4;
sStereo->minDisparity = -64;
sStereo->uniquenessRatio = 1;
sStereo->speckleWindowSize = 150;
sStereo->speckleRange = 1;
sStereo->disp12MaxDiff = 1;
sStereo->P1 = 600;
sStereo->P2 = 2400;
sStereo->textureThreshold = 500;
stRig.CreateUpdateStereoMatcher();
stRig.getDisparityMap(viewL, viewR, dispMap, false);
normalize(dispMap, disp8, 0, 255, CV_MINMAX, CV_8U);
showImage(disp8, true);
Thank you very much!
(This is my first post (hope will not be the last!) and
it is my pleasure to be here in such a great library's forum with you.)
bymulkerMon, 23 May 2016 03:04:09 -0500http://answers.opencv.org/question/94679/