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 
std::string Projection() const
Definition: georeference.h:63
void GetCoordinate(int x_pixel, int y_pixel, double &x_coordinate, double &y_coordinate) const
std::string GeoPath() const
Definition: georeference.h:55
GeoReference(const std::string &path)
std::string Extension() const
Definition: georeference.h:60
void GetPixel(double x_coordinate, double y_coordinate, int &x_pixel, int &y_pixel) const
unsigned int Height() const
Definition: georeference.h:58
unsigned int TileSize() const
Definition: georeference.h:59
unsigned int Width() const
Definition: georeference.h:57
std::string Datum() const
Definition: georeference.h:62


swri_transform_util
Author(s): Marc Alban
autogenerated on Tue Apr 6 2021 02:50:46