1
$\begingroup$

When you do camera tracking in Blender and press the "Setup Tracking Scene button", Blender automatically sets up a compositing node configuration that makes is easy to add 3D elements to the video footage. One of the nodes is an Undistortion node, that is supposed to undo the lens distortion, to make the undistorted 3D elements generated by Blender fit into the footage.

When you are working on your scene, you can set the video to be the background image for your camera. In the settings for the background image, by default the "Render undistorted" checkbox is checked. My expectation was that this would have the same behaviour as the Undistortion node in the compositor, but this appears to not be the case.

In the camera background picture, the undistort-option makes the picture look worse than the original: a line that was originally pretty straight, looks bent after performing the undistortion. In the compositor, the undistorted picture looks exactly the same as the original footage, as if Blender has decided that the original video was not distored at all, and doesn't need any undistortion treatment.

My question is: how is it possible that the Undistortion node has a different behaviour from the "Render undistorted" option for the camera background? Do they, for some reason use different distortion values (K1, K2) to do their calculations?

enter image description here

enter image description here

$\endgroup$

2 Answers 2

3
$\begingroup$

The camera background image in the viewport, with Render Undistorted option enabled,

enter image description here

should look the same as the result of the "undistort node" in the compositor,

enter image description here

and same as when you check the "render undistorted" in the Clip Display options in the Movie Clip editor.

enter image description here

In the undistorted image, straight lines should look straight, not curved. If they don't, then the Radial distortion coefficients k1, k2 (and k3) are not set correctly, or the optical center of the image might be incorrect as well.

To determine the distortion coefficients photograph a chart (or anything that has straight lines), open the image in the movie clip editor and use the annotation tool to trace thosestraight lines and distort them to match the image as shown in the following link:

How to determine lens undistortion values for motion tracking?

$\endgroup$
3
  • $\begingroup$ Thanks for your extensive answer. What could be the reason why I don't get the same results in compositor and background image? Are there different places where the K1, K2 and K3 numbers can be specified, or can you only do that in the Movie Clip Editor? $\endgroup$
    – Frank
    Commented Nov 2, 2020 at 20:42
  • $\begingroup$ In the image you have two viewer nodes, make sure you are viewing the one that is connected to the undistort node. $\endgroup$
    – susu
    Commented Nov 2, 2020 at 23:04
  • $\begingroup$ I have 2 viewing nodes to make it easier to compare the pictures with and without distortion. When I switch between the two, the backdrop doesn't change. $\endgroup$
    – Frank
    Commented Nov 3, 2020 at 7:26
2
$\begingroup$

Today I found the answer to my own question. I discovered that in the Undistortion node, you need to specify the movie clip that should be used to calculate the undistorted picture. It turned out that I was using an earlier version of my video there, instead of the version that was used for motion tracking. Specifying the right video gives the expected result.

$\endgroup$
1
  • 1
    $\begingroup$ Thankyou for taking the time to come back and post an answer once you solved it for yourself - it makes the site better for everyone, so it's lovely to see it happening. $\endgroup$
    – Ben
    Commented Nov 3, 2020 at 10:11

You must log in to answer this question.

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