digiKam
tparser.h
Go to the documentation of this file.
1 /*============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Description : Hugin parser API
7  *
8  * Copyright (C) 2007 by Daniel M German <dmgerman at uvic doooot ca>
9  * Copyright (C) 2012 by Benjamin Girault <benjamin dot girault at gmail dot com>
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_T_PARSER_H
27 #define DIGIKAM_T_PARSER_H
28 
32 #define PARSER_MAX_LINE 1000
33 #define PT_TOKEN_MAX_LEN PARSER_MAX_LINE
34 
35 #define PANO_PARSER_MAX_PROJECTION_PARMS 10
36 #define PANO_PARSER_MAX_MASK_POINTS 20
37 
42 #ifndef FALSE
43 #define FALSE 0
44 #endif
45 
46 #ifndef TRUE
47 #define TRUE 1
48 #endif
49 
50 #define PANO_PARSER_COEF_COUNT 7
51 #define PANO_PARSER_RESP_CURVE_COEF_COUNT 5
52 #define PANO_PARSER_VIGN_COEF_COUNT 6
53 #define PANO_TRANSLATION_COEF_COUNT 3
54 #define PANO_PROJECTION_COEF_COUNT 2
55 
56 typedef struct
57 {
58  int x;
59  int y;
60 } pt_point;
61 
62 typedef enum
63 {
64  NEGATIVE = 0,
65  POSITIVE = 1,
68  NEGATIVELENS = 4
70 
71 typedef struct
72 {
73  int iImage;
75 
79 
80 typedef struct
81 {
82  char* varName;
83  int varIndex;
85 
86 typedef struct
87 {
88  double x;
89  double y;
91 
92 typedef struct
93 {
94  int iImage1;
95  int iImage2;
98  int type;
100 
101 typedef enum
102 {
103  BD_UINT8 = 0,
105  BD_FLOAT = 2
107 
108 typedef struct
109 {
110  int width;
111  int height;
112  int cropArea[PANO_PARSER_COEF_COUNT]; /* the rectangle to crop to */
113 
116  double projectionParms[PANO_PARSER_MAX_PROJECTION_PARMS];
117 
118  double fHorFOV;
119  char* outputFormat; /* n : file format of output */
120 
124  int dynamicRangeMode; /* R[01] 0 -> LDR; 1 -> HDR */
126  double exposureValue; /* E exposure value of final panorama */
129 
130 typedef struct
131 {
133  int width;
134  int height;
135 
136  double fHorFOV;
137  double yaw;
138  double pitch;
139  double roll;
140 
141  double geometryCoef[PANO_PARSER_COEF_COUNT]; /* a, b, c, d, e, g, t */
142 
146  double imageEV; /* Exposure value of image Eev */
147  double whiteBalanceFactorRed; /* Er */
148  double whiteBalanceFactorBlue; /* Eb */
149 
150  double photometricCoef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; /* R[abcde] */
151 
153  double vignettingCorrectionCoef[PANO_PARSER_VIGN_COEF_COUNT]; /* V[abcdxy] */
155  double cameraPosition[PANO_TRANSLATION_COEF_COUNT]; /* TrX and TpX params */
156  double projectionPlaneRotation[PANO_PROJECTION_COEF_COUNT]; /* TpX params */
157 
158 
159  char* name;
160  int cropArea[PANO_PARSER_COEF_COUNT]; /* the rectangle to crop to */
161 
162  int stack;
163 
171  int yawRef;
172  int pitchRef;
173  int rollRef;
174 
175  int geometryCoefRef[PANO_PARSER_COEF_COUNT]; /* a, b, c, d, e, g, t */
176 
181  int imageEVRef; /*Exposure value of image */
184 
185  int photometricCoefRef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; /* R[abcde] */
186 
188  int vignettingCorrectionCoefRef[PANO_PARSER_VIGN_COEF_COUNT]; /* V[abcdxy] */
189 
190  int stackRef;
192 
193 typedef struct
194 {
195  double fGamma;
197  int fastFT;
201 
202 typedef struct
203 {
207 
212 
216 
221 
226 
231 
234 } pt_script;
235 
237 int panoScriptParse(const char* const filename, pt_script* scriptOut);
238 void panoScriptFree(pt_script* ptr);
239 
240 #endif /* DIGIKAM_T_PARSER_H */
Definition: tparser.h:87
double y
Definition: tparser.h:89
double x
Definition: tparser.h:88
Definition: tparser.h:57
int x
Definition: tparser.h:58
int y
Definition: tparser.h:59
Definition: tparser.h:93
pt_point_double p2
Definition: tparser.h:97
int iImage1
Definition: tparser.h:94
int iImage2
Definition: tparser.h:95
pt_point_double p1
Definition: tparser.h:96
int type
Definition: tparser.h:98
Definition: tparser.h:131
int stack
Definition: tparser.h:162
int yawRef
Definition: tparser.h:171
int whiteBalanceFactorBlueRef
Definition: tparser.h:183
int height
Definition: tparser.h:134
double whiteBalanceFactorRed
Definition: tparser.h:147
int vignettingCorrectionMode
Definition: tparser.h:152
char * vignettingFlatFieldFile
Definition: tparser.h:154
int fHorFOVRef
Definition: tparser.h:170
double whiteBalanceFactorBlue
Definition: tparser.h:148
int stackRef
Definition: tparser.h:190
int vignettingCorrectionModeRef
Definition: tparser.h:187
char * name
Definition: tparser.h:159
int projection
Definition: tparser.h:132
int width
Definition: tparser.h:133
int whiteBalanceFactorRedRef
Definition: tparser.h:182
int rollRef
Definition: tparser.h:173
double roll
Definition: tparser.h:139
double yaw
Definition: tparser.h:137
double imageEV
Definition: tparser.h:146
double pitch
Definition: tparser.h:138
int pitchRef
Definition: tparser.h:172
int imageEVRef
Definition: tparser.h:181
double fHorFOV
Definition: tparser.h:136
Definition: tparser.h:72
pt_point * points
Definition: tparser.h:77
pt_mask_type type
Definition: tparser.h:74
int iImage
Definition: tparser.h:73
int iPointsCount
Definition: tparser.h:76
Definition: tparser.h:81
char * varName
Definition: tparser.h:82
int varIndex
Definition: tparser.h:83
Definition: tparser.h:194
double huberEstimator
Definition: tparser.h:198
double fGamma
Definition: tparser.h:195
double photometricHuberSigma
Definition: tparser.h:199
int interpolator
Definition: tparser.h:196
int fastFT
Definition: tparser.h:197
Definition: tparser.h:109
int height
Definition: tparser.h:111
pt_bitdepthoutput bitDepthOutput
Definition: tparser.h:125
char * outputFormat
Definition: tparser.h:119
int width
Definition: tparser.h:110
int projectionParmsCount
Definition: tparser.h:115
int projection
Definition: tparser.h:114
int dynamicRangeMode
Definition: tparser.h:124
double exposureValue
Definition: tparser.h:126
int iImagePhotometricReference
Definition: tparser.h:127
double fHorFOV
Definition: tparser.h:118
Definition: tparser.h:203
char *** ctrlPoints_prevComments
Definition: tparser.h:224
char *** varsToOptimize_prevComments
Definition: tparser.h:219
int iEndingCommentsCount
Definition: tparser.h:232
int * iMasks_prevCommentsCount
Definition: tparser.h:228
int iCtrlPointsCount
Definition: tparser.h:222
int iPano_prevCommentsCount
Definition: tparser.h:204
pt_script_pano pano
Definition: tparser.h:206
int iOptimize_prevCommentsCount
Definition: tparser.h:213
char *** masks_prevComments
Definition: tparser.h:229
pt_script_optimize_var * varsToOptimize
Definition: tparser.h:220
int iMasksCount
Definition: tparser.h:227
char ** endingComments
Definition: tparser.h:233
int * iImage_prevCommentsCount
Definition: tparser.h:209
pt_script_image * inputImageSpec
Definition: tparser.h:211
int * iCtrlPoints_prevCommentsCount
Definition: tparser.h:223
int iVarsToOptimizeCount
Definition: tparser.h:217
char ** pano_prevComments
Definition: tparser.h:205
char ** optimize_prevComments
Definition: tparser.h:214
pt_script_optimize optimize
Definition: tparser.h:215
int * iVarsToOptimize_prevCommentsCount
Definition: tparser.h:218
char *** image_prevComments
Definition: tparser.h:210
pt_script_mask ** masks
Definition: tparser.h:230
int iInputImagesCount
Definition: tparser.h:208
pt_script_ctrl_point * ctrlPointsSpec
Definition: tparser.h:225
void panoScriptParserSetDefaults(pt_script *ptr)
Definition: tparser.c:67
#define PANO_PROJECTION_COEF_COUNT
Definition: tparser.h:54
#define PANO_PARSER_COEF_COUNT
Definition: tparser.h:50
#define PANO_PARSER_MAX_PROJECTION_PARMS
Definition: tparser.h:35
int panoScriptParse(const char *const filename, pt_script *scriptOut)
Definition: tparser.c:81
#define PANO_TRANSLATION_COEF_COUNT
Definition: tparser.h:53
pt_mask_type
Definition: tparser.h:63
@ POSITIVE
Definition: tparser.h:65
@ NEGATIVESTACKAWARE
Definition: tparser.h:66
@ NEGATIVE
Definition: tparser.h:64
@ NEGATIVELENS
Definition: tparser.h:68
@ POSITVESTACKAWARE
Definition: tparser.h:67
void panoScriptFree(pt_script *ptr)
Definition: tparser.c:146
#define PANO_PARSER_VIGN_COEF_COUNT
Definition: tparser.h:52
#define PANO_PARSER_RESP_CURVE_COEF_COUNT
Definition: tparser.h:51
pt_bitdepthoutput
Definition: tparser.h:102
@ BD_FLOAT
Definition: tparser.h:105
@ BD_UINT16
Definition: tparser.h:104
@ BD_UINT8
Definition: tparser.h:103