2
$\begingroup$

I'm looking to run a SLAM algorithm over images generated from blender but I need to know the intrinsic properties of the camera. I've taken a brief look at the python api and there doesn't seem to be a way to find out the distortion coefficients of the camera, I specifically need k1 k2 p1 p2 k3 (The radial and tangential distortion). Can anyone point me in the right direction?

Cheers, Sam

$\endgroup$
  • $\begingroup$ related: blender.stackexchange.com/questions/15102/… $\endgroup$ – rfabbri Sep 8 '15 at 4:02
  • $\begingroup$ Interesting link! Although I'm trying to find the distortion coefficients. I may be misunderstanding, is there a way to find the distortion coefficients from the projection matrix? $\endgroup$ – Wholemeal Sep 8 '15 at 8:24
4
$\begingroup$

In the direct process of rendering a scene, a Blender camera itself has no distortion coefficients. Distortion is inserted a posteriori as a compositing node, see How to tweak K1, K2 and K3 undistortion values in motion tracking?.

In the inverse process of calibrating cameras from a given video clip, Blender's motion tracking interface estimates distortion parameters K1, K2 and K3, to be used in rendering through compositing in the aforementioned way. To access these distortion coefficients, you have to be in the Movie Clip Editor, load a clip, and press n to toggle on/off region containing the Lens panel:

distortion coefficients in the tracker

Notice the option to select the desired type of distortion model ("Polynomial" in this case).

You can access these parameters in Python:

bpy.data.movieclips["movieclip-file-name-here.mp4"].tracking.camera.k1
bpy.data.movieclips["movieclip-file-name-here.mp4"].tracking.camera.k2
bpy.data.movieclips["movieclip-file-name-here.mp4"].tracking.camera.k3

In case you want to render with custom lens distortion parameters, not obtained from Blender's motion tracking, see Custom nonlinear distortion lens

$\endgroup$
  • $\begingroup$ Is there not a way to find out what is done in posterori, I've checked the nodes view but beyond the images to compositor theres not a lot more about the post processes such as distortion. $\endgroup$ – Wholemeal Sep 15 '15 at 16:21
  • $\begingroup$ @Wholemeal are you sure your render is actually being distorted at all? can you visually notice distortion in the video generated from your .blend file? $\endgroup$ – rfabbri Sep 15 '15 at 16:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.