Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
28 // Flightplan Variables
29 #ifndef PHOTOGRAMMETRY_SWEEP_ANGLE
30 #define PHOTOGRAMMETRY_SWEEP_ANGLE 0
31 #endif
32 
33 #ifndef PHOTOGRAMMETRY_OVERLAP
34 #define PHOTOGRAMMETRY_OVERLAP 50
35 #endif
36 
37 #ifndef PHOTOGRAMMETRY_SIDELAP
38 #define PHOTOGRAMMETRY_SIDELAP 50
39 #endif
40 
41 #ifndef PHOTOGRAMMETRY_RESOLUTION
42 #define PHOTOGRAMMETRY_RESOLUTION 50
43 #endif
44 
45 
46 // Flightplan Paramters
47 float photogrammetry_sweep_angle = 0; // in rad
48 
52 
53 // Photogrammetry Goals
54 int photogrammetry_sidelap; // Percent 0 - 100
55 int photogrammetry_overlap; // Percent 0 - 100
56 int photogrammetry_resolution; // Millimeter per pixel
57 
58 // Safety Aspects
62 
63 
65 {
67 
71 
72  photogrammetry_height_min = PHOTOGRAMMETRY_HEIGHT_MIN;
73  photogrammetry_height_max = PHOTOGRAMMETRY_HEIGHT_MAX;
74  photogrammetry_radius_min = PHOTOGRAMMETRY_RADIUS_MIN;
75 
77 }
78 
80 {
81 
82  // Photogrammetry Goals
83  float photogrammetry_sidelap_f = ((float) photogrammetry_sidelap) / 100.0f;
84  float photogrammetry_overlap_f = ((float) photogrammetry_overlap) / 100.0f;
85 
86  // Linear Projection Camera Model
87  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
88  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
89  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
90 
91  // Flightplan Variables
92  photogrammetry_height = ((float) photogrammetry_resolution) / pixel_projection_width / 1000.0f;
93 
98 
99  photogrammetry_sidestep = viewing_ratio_width * photogrammetry_height * (1.0f - photogrammetry_sidelap_f);
100  photogrammetry_triggerstep = viewing_ratio_height * photogrammetry_height * (1.0f - photogrammetry_overlap_f);
101 }
102 
104 {
105  // Linear Projection Camera Model
106  float viewing_ratio_height = ((float) PHOTOGRAMMETRY_SENSOR_HEIGHT) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
107  float viewing_ratio_width = ((float) PHOTOGRAMMETRY_SENSOR_WIDTH) / ((float)PHOTOGRAMMETRY_FOCAL_LENGTH);
108  float pixel_projection_width = viewing_ratio_width / ((float)PHOTOGRAMMETRY_PIXELS_WIDTH);
109 
110  // Resolution <-> Height
111  photogrammetry_resolution = photogrammetry_height * 1000.0f * pixel_projection_width;
112 
113  // Overlap <-> track width
114  photogrammetry_sidelap = 100.0f - photogrammetry_sidestep / viewing_ratio_width / photogrammetry_height * 100.0f;
115  photogrammetry_overlap = 100.0f - photogrammetry_triggerstep / viewing_ratio_height / photogrammetry_height * 100.0f;
116 }
117 
118 
int photogrammetry_radius_min
#define PHOTOGRAMMETRY_SIDELAP
int photogrammetry_height_max
#define PHOTOGRAMMETRY_OVERLAP
int photogrammetry_height_min
int photogrammetry_resolution
#define PHOTOGRAMMETRY_SWEEP_ANGLE
void init_photogrammetry_calculator(void)
int photogrammetry_sidestep
int photogrammetry_overlap
#define PHOTOGRAMMETRY_RESOLUTION
void photogrammetry_calculator_update_flightplan2camera(void)
void photogrammetry_calculator_update_camera2flightplan(void)
float photogrammetry_sweep_angle
int photogrammetry_height
int photogrammetry_triggerstep
Add to airframe file:
int photogrammetry_sidelap