Comments (4)
Hey Thibault
I might be able to help here - I spent a while working with distortion models
during the "calibration phase" of my thesis.
"CameraPinhole::normImageToPixelCoordinates()" will convert from undistorted
normalized coordinates to undistorted pixel co-ordinates, right?
And you want "CameraPinholeDistor::normImageToPixelCoordinates()" to convert
from the undistorted, normalized coordinates to the DISTORTED pixel
co-ordinates? So you are missing the step that applies a distortion model to a
set of normalized image co-ordinates?
In that case, I have some code that might help. Obviously it will depend on the
particular distortion model, but I implemented a solution for the rational
model in OpenCV and it was quite simple, and I'm sure it can be adjusted to
suit more models (such as ones using 5 or less coefficients).
Do you want me to try and implement it? Here is a bit of a sample of my old
code:
------------------------------------------------------------
fx0 = cameraMatrix.at<double>(0, 0);
fy0 = cameraMatrix.at<double>(1, 1);
ifx0 = 1./fx0;
ify0 = 1./fy0;
cx0 = cameraMatrix.at<double>(0, 2);
cy0 = cameraMatrix.at<double>(1, 2);
// and k is an array containing the distortion model coefficients for a
rational model
// x & y are the normalized, undistorted co-ordinates
// Determine radial and tangential distances/factors
r2 = x*x + y*y;
icdist = (1 + ((k[7]*r2 + k[6])*r2 + k[5])*r2)/(1 + ((k[4]*r2 + k[1])*r2 +
k[0])*r2);
deltaX = 2*k[2]*x*y + k[3]*(r2 + 2*x*x);
deltaY = k[2]*(r2 + 2*y*y) + 2*k[3]*x*y;
// x_new and y_new are the re-distorted co-ordinates, but are still normalized
x_new = (x0/icdist) + deltaX;
y_new = (y0/icdist) + deltaY;
// x2 and y2 are now denormalized as well as redistorted, so should be
equivalent to the positions on the original image
x2 = (x1/ifx0) + cx0;
y2 = (y1/ify0) + cy0;
------------------------------------------------------------
I'm happy to help with this front-end stuff (image I/O, calibration, features)
when I can because I'm probably more knowledgable with this than I am with the
actual SFM algorithms!
Original comment by [email protected]
on 3 Aug 2011 at 7:43
- Added labels: ****
- Removed labels: ****
from gsoc2011sfm.
this would be very useful!!!
You can make changes and test via the testcamera.cpp tutorial (named "Learn
what you can do with a pinhole distorded camera") if the
distortion/undistortion work well. If it's the case, you can commit ;)
Original comment by [email protected]
on 12 Aug 2011 at 11:54
- Added labels: ****
- Removed labels: ****
from gsoc2011sfm.
Hey Thibault
OK, I've added in some re-distortion and the changes seem to work (although
there are slight floating-point inaccuracies in the results of Test 8 Option
1). I've committed it too (clumsily - I left out the log message accidentally
:P). So once you've verified that the changes work feel free to close this
issue.
Steve
Original comment by [email protected]
on 17 Aug 2011 at 2:55
- Added labels: ****
- Removed labels: ****
from gsoc2011sfm.
Great work! This issue is now closed!
Original comment by [email protected]
on 18 Aug 2011 at 10:48
- Changed state: Done
- Added labels: ****
- Removed labels: ****
from gsoc2011sfm.
Related Issues (19)
- Problem with PointOfView::pointInFrontOfCamera
- Tutorial #4 rejecting all tracks and therefore displaying an empty model HOT 1
- Tutorial #9 Option 1 Seg Fault HOT 2
- Tutorial #9 Option 0 - Possibly incorrect bundle adjustment HOT 4
- Tutorial #11: Correctness of results seems to be random HOT 3
- Compilation issue relating to eigen3 libraries HOT 1
- Fresh compile error with YAML_Loader HOT 1
- "/usr/local/OpencvSFMLibraryDepends.cmake": Permission denied HOT 2
- program crashes HOT 3
- strange result EuclideanReconstruction HOT 7
- Error while compiling SFM_core project HOT 1
- MotionProcessor.h based on Boost HOT 1
- Configuration error with libmv HOT 5
- Code review request HOT 1
- Compile issues relating to libmv HOT 7
- config.h not created by cmake HOT 3
- CMake error: libmv's -lglog -lgflags missing from SfMTutorials.dir/link.txt HOT 2
- Tutorial #0 failing when trying to write keypoints HOT 3
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 gsoc2011sfm.