Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
photogrammetry_calculator.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Christophe De Wagter
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
24 
25 #include "generated/airframe.h"
26 #include "generated/flight_plan.h"
27 
29 #ifndef PHOTOGRAMMETRY_SWEEP_ANGLE
30 #define PHOTOGRAMMETRY_SWEEP_ANGLE 0
31 #endif
32 
34 #ifndef PHOTOGRAMMETRY_OVERLAP
35 #define PHOTOGRAMMETRY_OVERLAP 50
36 #endif
37 
39 #ifndef PHOTOGRAMMETRY_SIDELAP
40 #define PHOTOGRAMMETRY_SIDELAP 50
41 #endif
42 
44 #ifndef PHOTOGRAMMETRY_RESOLUTION
45 #define PHOTOGRAMMETRY_RESOLUTION 50
46 #endif
47 
48 
49 // Flightplan Paramters
50 float photogrammetry_sweep_angle = 0; // in rad
51 
55 
56 // Photogrammetry Goals
57 int photogrammetry_sidelap; // Percent 0 - 100
58 int photogrammetry_overlap; // Percent 0 - 100
59 int photogrammetry_resolution; // Millimeter per pixel
60 
61 // Safety Aspects
65 
66 
68 {
70 
74 
75  photogrammetry_height_min = PHOTOGRAMMETRY_HEIGHT_MIN;
76  photogrammetry_height_max = PHOTOGRAMMETRY_HEIGHT_MAX;
77  photogrammetry_radius_min = PHOTOGRAMMETRY_RADIUS_MIN;
78 
80 }
81 
83 {
84 
85  // Photogrammetry Goals
86  float photogrammetry_sidelap_f = ((float) photogrammetry_sidelap) / 100.0f;
87  float photogrammetry_overlap_f = ((float) photogrammetry_overlap) / 100.0f;
88 
89  // Linear Projection Camera Model
90  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
91  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
92  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
93 
94  // Flightplan Variables
95  photogrammetry_height = ((float) photogrammetry_resolution) / pixel_projection_width / 1000.0f;
96 
101  }
102 
103  photogrammetry_sidestep = viewing_ratio_width * photogrammetry_height * (1.0f - photogrammetry_sidelap_f);
104  photogrammetry_triggerstep = viewing_ratio_height * photogrammetry_height * (1.0f - photogrammetry_overlap_f);
105 }
106 
108 {
109  // Linear Projection Camera Model
110  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
111  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
112  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
113 
114  // Resolution <-> Height
115  photogrammetry_resolution = photogrammetry_height * 1000.0f * pixel_projection_width;
116 
117  // Overlap <-> track width
118  photogrammetry_sidelap = 100.0f - photogrammetry_sidestep / viewing_ratio_width / photogrammetry_height * 100.0f;
119  photogrammetry_overlap = 100.0f - photogrammetry_triggerstep / viewing_ratio_height / photogrammetry_height * 100.0f;
120 }
121 
122 
#define PHOTOGRAMMETRY_SWEEP_ANGLE
Default sweep angle in radians from north.
int photogrammetry_height_max
int photogrammetry_sidestep
float photogrammetry_sweep_angle
int photogrammetry_radius_min
int photogrammetry_height
#define PHOTOGRAMMETRY_RESOLUTION
mm pixel projection size
int photogrammetry_height_min
void photogrammetry_calculator_update_camera2flightplan(void)
void init_photogrammetry_calculator(void)
int photogrammetry_resolution
void photogrammetry_calculator_update_flightplan2camera(void)
#define PHOTOGRAMMETRY_OVERLAP
overlap 1-99 percent
int photogrammetry_triggerstep
#define PHOTOGRAMMETRY_SIDELAP
sidelap 1-99 percent
int photogrammetry_sidelap
int photogrammetry_overlap
Add to airframe file: