[7dd4fb]: src / parser / tparser.h Maximize Restore History

Download this file

tparser.h    168 lines (140 with data), 4.7 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
/*
* 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
typedef struct {
double x;
double y;
} pt_point;
typedef struct {
int iImage;
pt_point p1;
pt_point p2;
} pt_script_morph_point;
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;
} pt_script_pano;
typedef struct {
int projection;
int width;
int height;
float fHorFOV;
float yaw;
float pitch;
float roll;
float coef[7]; // a, b, c, d, e, g, t
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
// pointers to variable if they are used.
// For the sake of simplicity they start at 1, if they are zero they are unused
int fHorFOVIndex;
int yawIndex;
int pitchIndex;
int rollIndex;
int coefIndex[PANO_PARSER_COEF_COUNT]; // a, b, c, d, e , g, t
int morphPointsCount;
pt_script_morph_point *morphPoints;
} pt_script_image;
typedef struct {
float fGamma;
int interpolator;
int fastFT;
int huberEstimator;
} 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 iCtrlPointsCount;
pt_script_ctrl_point *ctrlPointsSpec;
} pt_script;
static pt_script_morph_point *morphPointsSpec = NULL;
pt_script *panoScriptParse(char *filename, int deferenceVariables);
void panoScriptDispose(pt_script **scriptVar);
void panoScriptDump(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 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 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);
#endif