georeference.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #ifndef TRANSFORM_UTIL_GEOREFERENCE_H_
31 #define TRANSFORM_UTIL_GEOREFERENCE_H_
32 
33 #include <string>
34 
35 #include <yaml-cpp/yaml.h>
36 
37 //opencv includes
38 #include <opencv2/core/core.hpp>
39 #include <opencv2/highgui/highgui.hpp>
40 #include <opencv2/imgproc/imgproc.hpp>
41 #include <opencv2/video/video.hpp>
42 
43 namespace swri_transform_util
44 {
46  {
47  public:
48  explicit GeoReference(const std::string& path);
49  GeoReference(const GeoReference& geo);
50  ~GeoReference();
51 
52  bool Load();
53  void Print();
54 
55  std::string GeoPath() const { return path_; }
56  std::string Path() const { return image_path_; }
57  unsigned int Width() const { return width_; }
58  unsigned int Height() const { return height_; }
59  unsigned int TileSize() const { return tile_size_; }
60  std::string Extension() const { return extension_; }
61 
62  std::string Datum() const { return datum_; }
63  std::string Projection() const { return projection_; }
64 
65  void GetCoordinate(int x_pixel, int y_pixel, double& x_coordinate, double& y_coordinate) const;
66  void GetPixel(double x_coordinate, double y_coordinate, int& x_pixel, int& y_pixel) const;
67 
68  private:
69  bool loaded_;
70 
71  // Image properties
72  std::string path_;
73  std::string image_path_;
74  unsigned int width_;
75  unsigned int height_;
76  unsigned int tile_size_;
77  std::string extension_;
78 
79  // Coordinate system
80  std::string datum_;
81  std::string projection_;
82 
83  // Affine transform from pixel space
84  cv::Mat transform_;
86 
87  // Tiepoints
88  cv::Mat pixels_;
89  cv::Mat coordinates_;
90 
91  double x_offset_;
92  double y_offset_;
93 
94  void GetTransform();
95  };
96 }
97 
98 #endif // TRANSFORM_UTIL_GEOREFERENCE_H_
99 
swri_transform_util::GeoReference::projection_
std::string projection_
Definition: georeference.h:81
swri_transform_util::GeoReference::TileSize
unsigned int TileSize() const
Definition: georeference.h:59
swri_transform_util::GeoReference::transform_
cv::Mat transform_
Definition: georeference.h:84
swri_transform_util::GeoReference::Datum
std::string Datum() const
Definition: georeference.h:62
swri_transform_util::GeoReference::coordinates_
cv::Mat coordinates_
Definition: georeference.h:89
swri_transform_util::GeoReference::Path
std::string Path() const
Definition: georeference.h:56
swri_transform_util::GeoReference
Definition: georeference.h:45
swri_transform_util::GeoReference::extension_
std::string extension_
Definition: georeference.h:77
swri_transform_util::GeoReference::Print
void Print()
swri_transform_util::GeoReference::pixels_
cv::Mat pixels_
Definition: georeference.h:88
swri_transform_util::GeoReference::y_offset_
double y_offset_
Definition: georeference.h:92
swri_transform_util::GeoReference::GetPixel
void GetPixel(double x_coordinate, double y_coordinate, int &x_pixel, int &y_pixel) const
swri_transform_util::GeoReference::inverse_transform_
cv::Mat inverse_transform_
Definition: georeference.h:85
swri_transform_util::GeoReference::image_path_
std::string image_path_
Definition: georeference.h:73
swri_transform_util::GeoReference::datum_
std::string datum_
Definition: georeference.h:80
swri_transform_util::GeoReference::Extension
std::string Extension() const
Definition: georeference.h:60
swri_transform_util::GeoReference::Load
bool Load()
swri_transform_util
Definition: earth_constants.h:33
swri_transform_util::GeoReference::loaded_
bool loaded_
Definition: georeference.h:69
swri_transform_util::GeoReference::width_
unsigned int width_
Definition: georeference.h:74
swri_transform_util::GeoReference::GetCoordinate
void GetCoordinate(int x_pixel, int y_pixel, double &x_coordinate, double &y_coordinate) const
swri_transform_util::GeoReference::GeoPath
std::string GeoPath() const
Definition: georeference.h:55
swri_transform_util::GeoReference::GetTransform
void GetTransform()
swri_transform_util::GeoReference::GeoReference
GeoReference(const std::string &path)
swri_transform_util::GeoReference::Height
unsigned int Height() const
Definition: georeference.h:58
swri_transform_util::GeoReference::height_
unsigned int height_
Definition: georeference.h:75
swri_transform_util::GeoReference::~GeoReference
~GeoReference()
swri_transform_util::GeoReference::path_
std::string path_
Definition: georeference.h:72
swri_transform_util::GeoReference::Projection
std::string Projection() const
Definition: georeference.h:63
swri_transform_util::GeoReference::x_offset_
double x_offset_
Definition: georeference.h:91
swri_transform_util::GeoReference::Width
unsigned int Width() const
Definition: georeference.h:57
swri_transform_util::GeoReference::tile_size_
unsigned int tile_size_
Definition: georeference.h:76


swri_transform_util
Author(s): Marc Alban
autogenerated on Tue Oct 3 2023 02:32:38