Main Page | Class List | File List | File Members

modPT.c File Reference

functions to manipulate lens correction coefficients and create stitcher scripts More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include "../include/jhead.h"
#include "../include/clens.h"

Classes

struct  Data1
 Measurement of 35mm film format diagonal. More...


Functions

double getHfov (double foc)
 Calculate the Horizontal Field Of View (HFOV) for a given focal length, width, height, and multiplier.

void coefD ()
 Calculate coefficient "d". Result put into the global variable coef1.d.

int getCoefs ()
 Calculate the lens correction coefficients (a,b,c) for a particular focal length of a particular lens by linear interpolation of known coefficients for the lens. The global variable "thisLens" must be pointing to the lens of interest.

double rad (double x)
 Convert degrees to radians.

double deg (double x)
 Convert radians to degrees.

int prepareScript (char *inFile)
 Write the script the stitching program will use to warp the image (ie remove the lens distortion).


Variables

const double diag35 = 43.266615
 Measurement of 35mm film format diagonal.

Data1 coef1
 Holds hfov and correction coefficients for current image.

ExifInfo exif
 Data structure to hold EXIF information.

CamNode pCurCam
 Current camera being read in from profiles.

prefType pref
 Data structure to hold program preferences.

CoefType coef []
 Array of lens correction coefficient data types.

LnsNode * thisLens
 Pointer to lens for current correction.

CamNode * thisCamera
 Pointer to camera for current correction.


Detailed Description

functions to manipulate lens correction coefficients and create stitcher scripts

Author:
Tim Jacobs (ported from Thomas Niemann's PTLens code)
Date:
2004.11.13
Full Description here.

Function Documentation

double deg double  x  ) 
 

Convert radians to degrees.

Returns:
The value in degrees
Parameters:
x The input in radians

int getCoefs  ) 
 

Calculate the lens correction coefficients (a,b,c) for a particular focal length of a particular lens by linear interpolation of known coefficients for the lens. The global variable "thisLens" must be pointing to the lens of interest.

Returns:
1 if unsuccessful, 0 otherwise. If successful, coef1.a, coef1.b, coef1.c, and coef.d are populated.

double getHfov double  foc  ) 
 

Calculate the Horizontal Field Of View (HFOV) for a given focal length, width, height, and multiplier.

Returns:
The HFOV.
Parameters:
foc The focal length of the lens when the picture was taken. Read from EXIF data.

int prepareScript char *  inFile  ) 
 

Write the script the stitching program will use to warp the image (ie remove the lens distortion).

Returns:
0 if successful, 3 if there is a problem getting the coefficients, 5 if all coefficients are 0, 4 if unable to open the script file.
Parameters:
inFile The file name for the input image

double rad double  x  ) 
 

Convert degrees to radians.

Returns:
The value in radians
Parameters:
x The input in degrees


Variable Documentation

const double diag35 = 43.266615
 

Measurement of 35mm film format diagonal.

if assuming 23.3 x 35 (phil's web site) then diag35 = 42.046284 if assuming 36 x 24 diag35 = 43.266615


Generated on Sun Nov 14 15:28:24 2004 for clens by doxygen 1.3.6