5
$\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$
2
  • $\begingroup$ related: blender.stackexchange.com/questions/15102/… $\endgroup$
    – rfabbri
    Commented Sep 8, 2015 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
    Commented Sep 8, 2015 at 8:24

1 Answer 1

5
$\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$
2
  • $\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
    Commented Sep 15, 2015 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
    Commented Sep 15, 2015 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .