I also had problems to get Hugin to do the work for me, so instead I developed the method I describe below. Bibble Labs recommended me to use the SciLab method for the actual correction parameter calculations, and my workflow is based on the SciLab method. The results I received work very well.
I posted an earlier version of this guide at http://support.bibblelabs.com/forums/vi ... 7&start=15
in November 2011.
I hope this guide, which I will continue to improve, also with some screen shots later on, will be of help for those, like myself, that need to have a particular non-calibrated lens calibrated but can't wait forever for "someone else" to do the work. For me, it was the lack of calibration data for the Nikkor AF-S 28-300mm f/3.5-5.6G ED VR, a fantastic lens with a fantasticly large distortion, that pushed me into learning how to make a proper lens calibration.
==================================EDIT: New version 2012-04-11.
Guide v1.2, 2012-04-11.
This guide assumes a working linux or MacOSX environment, with bash, awk, scilab-cli, g3data and exiftool. In Windows, you can use the Cygwin package in order to achieve a linux-like environment with command line tools.
0. Please have a look at http://bibblelabs.com/products/bibble5/
... ation.html as long is this link still works for a general idea about what is involved in a lens calibration procedure.
1. Find, or possibly make, a good object to perform the calibration against.
A wall with straight lines, not brick or wood but rather glass/metal frames, plates, etc, or a huge paper print-out, will do.
If the intention is to calibrate a wide angle lens, you probably will have to find a good building somewhere, as the size of the print-out needed will be very, very large...
Please see the examples of used calibration photos below in this thread.
2. Take photos at an appropriate number of focal lengths at a proper distance from the reference object. A proper minimum distance would be 3 meters, possibly a bit more. With some lenses, eg. long-focusing extreme telephoto lenses, this distance will have to be longer than 3 meters. The difference in focal length in each step for a zoom lens should be maximum 15%, and, according to this posting by former Bibble Labs employee Colleen, 10% at the end points: http://support.bibblelabs.com/forums/viewtopic.php?f=94&t=16275
. Added 2012-04-11.
3. If needed and if possible, enhance the taken photos in order to emphasise the lines - maybe a higher contrast, black and white, etc, will show the lines even clearer. Try to work with high-quality photos that eventually will be saved in a jpg format.
New (added 2012-04-10):
afx has made some scripts that will make the entire data point collecting procedure much easier. Please see his posting below, where also an attached file with the scripts and instructions is present.
4. Collection and calculation of data points:
* Take your (first) calibration photo, in jpg format, and put in an empty folder. If you have several photos, which will be the case if you are calibrating a zoom lens, name them uniquely without reusing the filenames.
* Start the docal.sh script with the jpg file name given, such as ./docal.sh Example1.jpg
* Click carefully along a number, say at least five, of calibration lines in the photo, the whole width, in the upper and/or lower half of the photo, depending on how the calibration target looks like. In Example1.jpg, see later in this thread, one can use the three first lines at the top, and the three bottom ones. The middle line is more or less straight, so its contribution to the correction parameters will be very small - and can thus be omitted. Make sure that you mark 20 points along each line. If you want to use a smaller or larger amount of data points, then you must change points=20 to the wanted number in the file gens.awk before starting docal.sh. If there is severe (mustache) distortion present, a large numbers of data points will be needed - I have used a couple of hundred points in each line for my Nikkor 28-300 lens, as it has some heavy distortion at some focal lengths.
* Once you have clicked the 20 data points along each lines - check that the total number in the box in g3data is correct - click in g3data on the radio button "Export data to file" and accept the suggested filename.
* Click on the button "Export point data".
* Finish g3data by clicking on File/Quit in the menu.
You will now be given a set of files in the folder, and a screen printout of the a, b and c values that you can test in ASP or Bibble right away - in the lens tab, the manual part. If the correction is acceptable once applied on the test photo and possibly other photos, taken at the same focal length with this lens, proceed with the following step. If the correction parameters are not working well, clean out the produced files and redo the process from the beginning.
In the produced *.lcraw file, the a, b and c parameters for the present focal length are written in the form ASP or Bibble wants to have them, eg cal_abc: 28 0.0010249 -0.0161057 -0.0133131.
Collect these values in a plain text file, which once you are done with the entire calibration and have added lens and sensor data, will look something like in 5. below.
Here, you also have to find out what the multiplier = crop factor is. This value depends on your camera's sensor size, and will be given somewhere in your camera documentation. Typical values are 1.0 (full frame cameras of any brand), 1.5 (Nikon DX cameras, some Canon cameras, Sony, Pentax), 1.6 (some Canon cameras).
5. Lens profile:
menu_lens: Nikkor 28-100mm f/3.5-5.6G AF Zoom
cal_abc: 28 0.0010249 -0.0161057 -0.0133131
cal_abc: 34 -0.0002409 -0.0101266 -0.0100525
cal_abc: 38 0.0011318 -0.0110745 -0.0000946
cal_abc: 44 0.0004819 -0.0060696 -0.0009483
cal_abc: 50 0.0000239 -0.0019766 -0.0023835
cal_abc: 62 0.0017975 -0.0080446 0.0081529
cal_abc: 75 -0.0010158 0.0041892 -0.0064874
cal_abc: 85 -0.0019801 0.0083656 -0.0111948
cal_abc: 100 -0.0023195 0.0076052 -0.0077958
6. Arrange the correction parameters according to the format ASP uses them. Here you have to become familiar with the structure in the /opt/AfterShotPro/supportfiles/Profiles/LensProfiles (Linux) or C:\Program Files (x86)\Corel\Corel AfterShot Pro\supportfiles\Profiles\LensProfiles (Windows 7, 64-bit), how to gain access to edit these files and how to make them readable for all users in the system again. These files can also be edited in such a way that all lenses, and cameras, which you don't have or ever will encounter, can be removed from the according files - which in some cases eases the automatical lens detection quite a bit, as there will not be so many duplicates due to reused lens IDs from some manufacturers (eg Tamron, Sigma, etc).
jknight (ses his posting) has provided info about the file system structure in MacOSX:
"On Mac the directory structure is as follows. ( ../Applications/Corel AfterShot Pro.app/Contents/Resources/supportfiles/Profiles/LensProfiles )
To get there it is easiest to use Finder
1. Go to Applications folder.
2. Select Corel AfterShot Pro.app and right click and choose Show Package Contents.
3. Navigate from the directory that opens in Finder down to /Contents/Resources/supportfiles/Profiles/LensProfiles"
I have cleaned out everything not needed from my files, and removed the files not needed (other manufacturers, for instance).
The lens correction = ON preset I have, always works, in batch mode also, with the cameras and lenses I have, even when there are random photos from different cameras and lenses collected in a single folder.
Robert Rottmerhusen has collected a vast amount of LensIDs for F-mount lenses compatible with Nikon. Please have a look at his site if you need additional data in order to help ASP determine what lens you have.
7. Make sure that you to Corel and to this forum upload the correction parameters you calculated, arranged as in 7. above, so that others also can use them and that they can be included in coming releases of ASP.
If there are good sites which provide information about lensIDs for other than F-mount lenses, please let me know and I will add such information to the guide.
An alternative method, based on manual data point collection and calculation.
I keep the information about the manual data point collecting method below as is, as it still is valid if you for some reason can't get afx's nice and easy-to-use scripts to run as intended.
1-3 - please see above.
4. Get the program g3data from http://www.frantz.fi/software/g3data.php
, and use it to load the photos and collect data pairs (x,y) with simple mouse klicks along the lines in each photo. Modern linux versions all seem to have g3data available as a standard package in their software repositories. There also seem to exist some precompiled binaries for Windows available at http://www.frantz.fi/software/g3data.php
Please see 4.1 to 4.10 below how to operate g3data.
4.1. First, find out the size, in number of pixels in the X resp. Y dimension, for your photo to be used. It may be the size of your sensor, or smaller if the photo has been cropped. Try to work with as large photos as possible, as more and longer calibration lines will fit in the photo, thus increasing the reliability in the lens correction.
4.2. Click on "Set point X1 on X axis(1)" and then with the mouse click in the *lower left* corner in your photo, in the very corner itself - as close to the end of the photo as possible. Once the set point has been set completely correctly, you will be rewarded with a magenta coloured corner sign, which is placed along the X and Y axis, down in the very corner of the photo, with no space between the sign and the corner.
4.3. Once you have the set point aligned correctly, you can enter its value in the white box "X1 value:", which will be "1" (one).
4.4. Then click on "Set point X2 on X axis(2)", mark correctly the *lower right* corner of your photo with a mouse click and enter the numerical value of this point in the box "X2 value:". This value will be equal to the size in pixels, in the X dimension, you determined in 4.1 above.
4.5. Then click on "Set point Y1 on Y axis(3)", mark again the *lower left* corner and enter its value, again a "1" (one) in the box.
4.6. Finally, click on "Set point Y2 on Y axis(4)", mark the *upper left* corner and enter the numerical value in the white box. This value will be equal to the size in pixels, in the Y dimension, you determined in 4.1 above.
4.7. Make sure that the radio button for Point ordering is set to "No ordering".
4.8. Set "Export data to file", and here define a file where all data points will be collected.
4.9 . Then you can start to click along the optical calibration lines in the photo. If you make an error when placing a point along aline, press the button "Remove last point". For a regularly distorted line that displays either pincushion distortion or barrel distortion, I would think that anything from 5 to 20 data points will produce a sufficient result. However, if there is mustache distortion present, a larger set of data points will be needed in order to sorten out this type of distortion. Once the entire calibration calculation procedure has been completed, the values you have received should be tested on the actual photos you used for the calibration. You will notice if there are enough datapoints or if additional ones are needed.
4.10. Finallly, you export the data with a click on the "Export point data"-button.
5. Use the collected data pairs, after having reformatted the ordering of the achived data pairs (can easily be done in Open/LibreOffice in a spreadsheet), with one set of vectors for each line, in the SciLab method (http://www.vintz.fr/lenscal/lenscal.html
) described in Jeff's comment from Tue Jan 05 2010 in this thread. (see http://support.bibblelabs.com/forums/vi
... 7&start=15). Remember to use the pixel size of the photo given in 4.1 when setting the parameters in the SciLab scripts.
Run the SciLab script and receive shortly very accurate correction parameters a, b and c.
6. Please continue with 5. and onwards in the new guide above.
Mandrivalinux 2011.0 PowerPack 64 bit, Intel QuadCore Q6700, 8 GB RAM, Dual monitors (2x30", 5120x1600), BibblePro 5.2.3 and AfterShot Pro 184.108.40.206 with all available plugins, Nikon D800E, Nikon D700, Canon S95. Color Munki Photo.