Agisoft Metashape

Agisoft Metashape => General => Topic started by: Rico on April 24, 2015, 11:37:27 AM

Title: Camera calibration improving accuracy?
Post by: Rico on April 24, 2015, 11:37:27 AM
Hey there, im new with Photoscan and writing my thesis about it.
I was lookin around in the forum for a bit, but didnt find anything for pre calibration of Camera.
Did i get that right from this post of Alexey that there is no need to calibrate the camera at all, since Photoscan gets all the Cam-info from the EXIF. So no improvement of accuracy in measurment purposses??

6. Since the image EXIF contain focal length and sensor size there is no need to pre-calibrate camera.

Cheers Rico
Title: Re: Camera calibration improving accuracy?
Post by: Marcel on April 24, 2015, 01:11:41 PM
We are never using camera calibration, and are getting excellent results. However, we are using really good lenses and correct for lens defects (distortion, chromatic abberation, vignetting) when converting the RAW files.

I can imagine that camera calibration is useful when using (for example) fisheye lenses or other lenses with a lot of distortion (some zoom lenses can also have very weird distortion patterns).
Title: Re: Camera calibration improving accuracy?
Post by: bigben on April 25, 2015, 02:13:22 AM
Without calibrated lens settings the lens distortion parameters are calculated as part of the image alignment step.  In order for this calculation to arrive at an accurate result it requires a good spread of matching points between images. In some cases, this requirement is not completely satisfied due to inadequate overlap or areas with low/repetitive detail and the distortion parameters will be slightly off which will be partly compensated for by the camera positions being slightly off.  A typical example of this is the bowed terrain and camera path that often results from aligning a single flight path of serial images. If you use calibrated settings then you remove the possibility of getting "inaccurate" distortion parameters being calculated, improving the calculation of camera positions in less than ideal situations.
Title: Re: Camera calibration improving accuracy?
Post by: Rico on April 27, 2015, 11:09:38 AM
okay thanks for the help :)  :)
Title: Re: Camera calibration improving accuracy?
Post by: igor73 on April 27, 2015, 03:11:36 PM
It seems the exif data is less important than you would think?  Is it useful at all?  Agisoft seems to do an amazing job calibrating during the alignment.  Does the EXIF data help in any way? 

Title: Re: Camera calibration improving accuracy?
Post by: Alexey Pasumansky on April 27, 2015, 03:19:50 PM
Hello igor73,

PhotoScan uses image EXIF data for the initial step of autocalibration procedure. If the EXIF is missing PhotoScan uses the general guess (50mm focal length in 35mm equivalent), but if this guess is very different from the real values the alignment may fail or be incorrect.
Title: Re: Camera calibration improving accuracy?
Post by: Marcel on April 27, 2015, 07:44:34 PM
Hello igor73,

PhotoScan uses image EXIF data for the initial step of autocalibration procedure. If the EXIF is missing PhotoScan uses the general guess (50mm focal length in 35mm equivalent), but if this guess is very different from the real values the alignment may fail or be incorrect.

How big is the influence of a small difference between EXIF value and real value? I am asking because lenses often have a slightly different real focal length than what manufacturers state (and list in the EXIF info) For example a 50mm lens might have a real focal length of 48mm or 52mm. Does this tiny difference matter?
Title: Re: Camera calibration improving accuracy?
Post by: Alexey Pasumansky on April 27, 2015, 07:46:05 PM
Hello marcel,

Small difference for the initial step doesn't matter, as the values are to be adjusted.
Title: Re: Camera calibration improving accuracy?
Post by: Marcel on April 27, 2015, 08:42:52 PM
Thanks for the answer, that is good to know!

Am I correct that when I use "Optimize Cameras" that it's basically doing the same calibration as Agisoft Lens? (Since the values are the same).


As an example of how much the real focal length can differ from the EXIF info: when I calculate the focal length for my 50mm lens based on the Agisoft Lens output, I come out at 53,7mm. Quite a difference! (not sure if I did the conversion to mm entirely correct).
Title: Re: Camera calibration improving accuracy?
Post by: Wishgranter on April 28, 2015, 12:30:21 AM
it is correct, most lenses are defined with "common" lens parameters and in photography its not a problem, in photogrammetry and VFX it can cause "problems"
Title: Re: Camera calibration improving accuracy?
Post by: bigben on April 28, 2015, 06:13:58 AM
The process is essentially the same (optimising lens parameters and camera positions) but Agisoft Lens adds in some extra criteria via the target grid that help to (more) correctly arrive at the lens distortion parameters.
Title: Re: Camera calibration improving accuracy?
Post by: Marcel on April 28, 2015, 06:49:30 PM
The process is essentially the same (optimising lens parameters and camera positions) but Agisoft Lens adds in some extra criteria via the target grid that help to (more) correctly arrive at the lens distortion parameters.

Could you explain what these extra criteria are?

Edit: also, how do you know it is more correct, because the Optimize Cameras function in Photoscan doesn't report any results?
Title: Re: Camera calibration improving accuracy?
Post by: bisenberger on April 28, 2015, 07:16:08 PM
I had to use the the lens calibration for my Ricoh GX100 and GX200 because info about the sensor size isn't included in their EXIF data. Models created from these cameras have a bowl shape if I don't use the lens calibration.
Title: Re: Camera calibration improving accuracy?
Post by: bigben on April 29, 2015, 08:00:08 AM
The optimisation process that occurs during image alignment doesn't have any info about the relative/absolute position of the points in the real world, just their positions in the images.  Agisoft Lens uses a grid of squares as a target, so assuming that there is some pattern recognition going on to recognise the squares, then it knows that the distance between each of the corners is the same, and rows/columns of corners will have the same X/Y coordinates.  This helps avoid lens parameters that would result in the "bowl" effect. GCPs perform the same function, although this doesn't help users of the standard version.

The bowl effect in turn is caused by the the optimisation process drifting towards incorrect values that provide a mathematically correct outcome. This is usually due to inadequate overlap of images (not just the amount, but the spread of overlap across the frame) In these cases, the fov, distortion parameters and camera orientations compensate for the deviations from the true values. The same thing happens with automated panorama stitching, although it's less critical in that application.

Title: Re: Camera calibration improving accuracy?
Post by: Marcel on April 29, 2015, 10:34:39 AM
Thanks Bigben, that's interesting. I get what you mean with drifting to a mathematically correct solution, but I do wonder however how much difference there really is. There are a lot more points in the sparse cloud, and generally they are of much higher quality than photos of an LCD screen (where a recognizable detail might be 5 pixels wide + more DOF because of short distance).


I might try having the calibration target printed on a really big sheet of paper to see if that changes the results compared to the results from the LCD screen.
Title: Re: Camera calibration improving accuracy?
Post by: bigben on April 29, 2015, 02:49:34 PM
Having more points isn't really relevant compared to having real world reference points to align those to.  In theory it shouldn't make any difference what size the reference target is. The other important thing is that the reference points chosen should occur across the field of view.

To do a similar approach in the Pro version you could specify a large grid of GCPs across a wall and use the standard align and optimise steps.  The standard version doesn't use GCPs, making the lens calibration tool more practical for those users.

Advice to take multiple photographs of the same view at different rotation angles (e.g. http://culturalheritageimaging.org/Technologies/Photogrammetry/ (http://culturalheritageimaging.org/Technologies/Photogrammetry/)) is geared towards providing the image data that increases the likelihood of the optimisation process arriving at accurate values in the absence of calibrated values
Title: Re: Camera calibration improving accuracy?
Post by: aggieair on April 30, 2015, 09:13:16 PM
I calibrate our cameras in-house using the big dot wall.  I ran it both ways - with my camera info and letting Agisoft pick the interior orientation values.  Entering the camera calibration file into an Agisoft project and it did not improve the error results.  In fact, it was less accurate by 0.03 m (in the Error M and Error Pix columns).  I didn't do an accuracy assessment in ArcGIS though.  Letting Agisoft pick the interior orientation info was slightly better in the end. 

The only time I'd use that camera calibration info is if I created my mosaic in EnsoMosaic which needs it.

Someone asked me why I thought my calibrated camera info would improve results (I don't know it just seems like knowing exact data would be ideal, no?), but I was surprised.
Title: Re: Camera calibration improving accuracy?
Post by: bigben on May 02, 2015, 12:11:36 AM
The other thing to consider is that if your have calibrated lens parameters, then using any other values is technically distorting your images.  Optimising these after alignment may produce a cleaner result BUT you are altering your images to fit the data. A small deviation may be acceptable, but you have no control over that process.