Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[81df4c]: PTOparser / tparser.h Maximize Restore History

Download this file

tparser.h    234 lines (189 with data), 7.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
* tparser.h
*
* Copyright Daniel M. German
*
* April 2007
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Author: Daniel M German dmgerman at uvic doooot ca
*
*/
#ifndef __TPARSER_H__
#define __TPARSER_H__
/* Maximum size for an input token */
#define PARSER_MAX_LINE 1000
#define PT_TOKEN_MAX_LEN PARSER_MAX_LINE
#define PANO_PARSER_MAX_PROJECTION_PARMS 10
/*
Data structure where the entire input file will be read
*/
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define PANO_PARSER_COEF_COUNT 7
#define PANO_PARSER_RESP_CURVE_COEF_COUNT 5
#define PANO_PARSER_VIGN_COEF_COUNT 6
#define PANO_TRANSLATION_COEF_COUNT 3
typedef struct {
double x;
double y;
} pt_point;
typedef struct {
int iImage;
pt_point p1;
pt_point p2;
} pt_script_morph_point;
typedef struct {
char *varName;
int varIndex;
} pt_script_optimize_var;
typedef struct {
int iImage1;
int iImage2;
pt_point p1;
pt_point p2;
int type;
} pt_script_ctrl_point;
typedef struct {
int width;
int height;
int projection;
int projectionParmsCount;
float projectionParms[PANO_PARSER_MAX_PROJECTION_PARMS];
char *projectionParmsString;
char *projectionName;
float fHorFOV;
char *outputFormat; // n : file format of output
// Hugin parameters
int dynamicRangeMode; // R[01] 0 -> LDR; 1 -> HDR
char *bitDepthOutput; // T bitdepth of output images, possible values are
//XXX TO BE IMPLEMENTED
float exposureValue; // E exposure value of final panorama
} pt_script_pano;
typedef struct {
int projection;
int width;
int height;
float fHorFOV;
float yaw;
float pitch;
float roll;
int featherSize;
float coef[PANO_PARSER_COEF_COUNT]; // a, b, c, d, e, g, t
// These are hugin parameters
int autoCenterCrop;
float cropFactor;
// Exposure related
float imageEV; // Exposure value of image Eev
float whiteBalanceFactorRed; // Er
float whiteBalanceFactorBlue; // Eb
int responseCurveType; // Ry 0 -> EMoR, 1 -> linear
float responseCurveCoef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; // R[abcde]
int vignettingCorrectionMode; // Vm
float vignettingCorrectionCoef[PANO_PARSER_VIGN_COEF_COUNT]; // V[abcdxy]
float translationCoef[PANO_TRANSLATION_COEF_COUNT]; // TrX parms
char *name;
char cropType ; // it can be 'S' or 'C'
int cropArea[PANO_PARSER_COEF_COUNT]; // the rectangle to crop to
int morphToFit; // true if morph to fit
// these variables hold pointers to equivalent variables in other images
// they are equivalent to the format <var>=<index> where
// <var> is variable name, and index is a base-zero pointer to another image
// For the sake of simplicity they start at 1, if they are zero they are unused
int fHorFOVRef;
int yawRef;
int pitchRef;
int rollRef;
int coefRef[PANO_PARSER_COEF_COUNT]; // a, b, c, d, e , g, t
// hugin indexes for de-referencing
int imageEVRef; //Exposure value of image
int whiteBalanceFactorRedRef; // Er
int whiteBalanceFactorBlueRef; // Eb
int vignettingCorrectionModeRef; // Vm
int vignettingCorrectionCoefRef[PANO_PARSER_VIGN_COEF_COUNT]; // V[abcdxy]
int responseCurveTypeRef; // Ry variable
int responseCurveCoefRef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; // R[abcde]
int translationCoefRef[PANO_TRANSLATION_COEF_COUNT]; // TrX parms
// Morphing Points
int morphPointsCount;
pt_script_morph_point *morphPoints;
} pt_script_image;
typedef struct {
float fGamma;
int interpolator;
int fastFT;
int huberEstimator;
float photometricHuberSigma;
int optimizeReferenceImage;
int blendMode;
} pt_script_optimize;
typedef struct {
pt_script_pano pano;
int iInputImagesCount;
pt_script_image *inputImageSpec;
int iOutputImagesCount;
pt_script_image *outputImageSpec;
int iMorphPointsCount;
pt_script_optimize optimize;
int iVarsToOptimizeCount;
pt_script_optimize_var *varsToOptimize;
int iCtrlPointsCount;
pt_script_ctrl_point *ctrlPointsSpec;
} pt_script;
void panoScriptParserSetDefaults(pt_script *ptr);
pt_script *panoScriptParse(char *, int , pt_script *);
void panoScriptParserDispose(pt_script *ptr);
void panoScriptDump(pt_script *script);
void panoParserDispose(pt_script **scriptVar);
void panoScriptLibpanoFormat(FILE *where, pt_script *script);
// Accessors to the data structures above...
// they are the preferred way to access the data in them
float panoScriptGetImageCoefA(pt_script_image *pImage);
float panoScriptGetImageCoefB(pt_script_image *pImage);
float panoScriptGetImageCoefC(pt_script_image *pImage);
float panoScriptGetImageCoefD(pt_script_image *pImage);
float panoScriptGetImageCoefE(pt_script_image *pImage);
float panoScriptGetImageSheerX(pt_script_image *pImage);
float panoScriptGetImageSheerY(pt_script_image *pImage);
int panoScriptGetImageCropType(pt_script_image *pImage);
int panoScriptGetImageMorphToFit(pt_script_image *pImage);
int panoScriptGetImageProjection(pt_script_image *pImage);
float panoScriptGetImageHFOV(pt_script_image *pImage);
float panoScriptGetImagePitch(pt_script_image *pImage);
float panoScriptGetImageYaw(pt_script_image *pImage);
float panoScriptGetImageRoll(pt_script_image *pImage);
char *panoScriptGetName(pt_script_image *pImage);
int panoScriptGetInputImagesCount(pt_script *script);
int panoScriptGetOutputImagesCount(pt_script *script);
pt_script_image *panoScriptGetInputImage(pt_script *script, int i);
pt_script_image *panoScriptGetOutputImage(pt_script *script, int i);
int panoScriptGetPanoProjection(pt_script *script);
int panoScriptGetPanoWidth(pt_script *script);
int panoScriptGetPanoHeight(pt_script *script);
float panoScriptGetPanoHFOV(pt_script *script);
float panoScriptGetPanoParmsCount(pt_script *script);
float panoScriptGetPanoParm(pt_script *script, int index);
char *panoScriptGetPanoOutputFormat(pt_script *script);
int panoScriptDeReferenceVariables(pt_script* script);
char *panoScriptGetInputFileNameOfImage(pt_script* script,int index);
char *panoScriptGetOutputFileNameOfImage(pt_script* script,int index);
//
#endif