Lens calibration presets and tracking

Hallo everybody,
following Lens calibration tut I created many Export Lens data (as presets) for my camera (and iphone…) lenses utilizing a lens grid shooted with every lensI have.
I made these presets for AE (as Mocha Lens for After Effects) and Nuke (Distortion Map Clip - Undistort and Distort) and I’ll use them to undistort or distort CGI in compositing.
But how can I re-use them to set lens distortion for every new mocha tracking?
I mean, if I have to make lens calibration BEFORE tracking (that should be always suggested), I should load the presets I’ve already done for the lens used, and than track it. But I don’t know how to make it… or maybe, we have to make every time a new calibration (using am imported Lens grid shooted with lens in use) even if I have already saved my lens distortion presets?
I think this is strange… seems to me rather than the process of Lens correction needs only to save the lens distortion map and does not need to tracking. I am wrong?

Many thanks for a reply.

Hi there,

For your records, you can find a breakdown of the lens tool here: http://www.imagineersystems.com/support/documentation/#The_Lens_Module
But it seems like what you are asking is how to export and import what you have done in the lens tool previously? In mocha Pro, all you have to do is import the distortion map clips.

Exporting Lens Data

The Lens Module provides different exports for getting your lens data out to other applications.

Distortion Maps (mocha Pro only): This format will render a map for programs that support color-based displacement or distortion (such as UV or STMaps). This is also useful if you want to save a calibration so it can be used on another shot, by importing the Distortion Map back into mocha. By default the Distortion Map will only render 1 frame, unless you have an animated distortion calibrated in mocha. Distortion Maps may also generate a map larger than your footage dimensions in order to accommodate overscan of the distortion.

  1. Click on Export Lens Data in the Lens Module or the File menu
  2. Select “Distortion Map” in the drop down
  3. The dimensions of the distortion map will be automatically calculated at a larger size to your footage to make sure there is enough overscan for correct distortion.
  4. The frame range is automatically set to only render 1 frame unless you have an animated distortion.
  5. Choose whether you want to render a map to Undistort or Distort with the radio buttons on the right
  6. Choose a destination folder for the image
  7. Distortion maps must be 32 bit floats, so TIF or DPX will be the best options
  8. Click “Save”
  9. Load the Distortion Map into the program of your choice
Importing your maps back into mocha:
  1. Go to the “Distortion Map” tab on the left side of the Lens Module
  2. Use the “Undistort (Inverse)” and “Distort (Direct)” drop downs to import your maps files
  3. Click on the Calibration dropdown and select “Distortion Map”
  4. To check the distortion, turn on your grid
  5. You can now choose to render out the distortion, or use the current calibration to assist your tracking and insertion workflow, as you would a line calibration.
  6. Keep in mind the hard boundaries of the Distortion map being imported may affect the tracking of your shot.
Note that You cannot export Lens Data with a Distortion Map calibration. You will only be able to perform track and render operations.

Please let me know if you have any questions and I will be happy to help.



Okay, now is all right.
Anyway I had many trouble to set up a correct lens calibration to create a presets for iPhone 4s lens on board.
I followed exactly the tuts suggested (by Martin Bennard):
import lens grid cilp filmed with iphone, make lens calibration by Locate line, new lines (I selected ALL grid lines…) and set 1 parameter:
The result was not credible… better with 2 - parameters, but still not credible for a lens as iPhone 4S (4,28mm alias 35mm Full frame).
I saved anyway all Disortion map clips (Distort and undistort, 1 parameter and 2 parameter…).
I attach one still frame from my lens grid clip filmed with iPhone and maybe you can tray to calibrate it and to see that the calibration doesen’t work (essentially, it creates a big distortion for a 35mm lens…): Dropbox - File Deleted

Shortly, now is all clear the process to create save and use again presents lens distortion map.
But about create a correct lens distortion I have serious doubts but maybe I’m doing something wrong:(.

Please help!

Many thanks!

I share some image to check what I’ve done:

This grid deformation is not credible… and in fact, when I make a corner pin, it doesn’t match the real distortion of the plate.

You’re not using equidistant lines though, are you? Also, is that an anamorphic lens?

Hi Mary, of course I used equidistant lines and lens is not Anamorphic. It it a iPhone onboard lens.

OK, don’t use equidistant lines, as they are not equidistant.

Okay, but I had only followed the msrtin’s tutirial about. Let me try without equidistant lines. Many thanks!

Right, but Martin’s tutorial used equidistant lines, and your grid is not “square.” That’s what’s probably throwing it off. :slight_smile:

Uhm, You are right!
I used a grid of rectangles … instead should be square. … Damn!
Okay, I try with a square grid!

MAny thnaks!