Loading [MathJax]/extensions/TeX/AMSmath.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PinholeCameraIntrinsic.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <Eigen/Core>
30 
32 
33 namespace open3d {
34 namespace camera {
35 
46 };
47 
52 public:
56 
63  int height,
64  const Eigen::Matrix3d &intrinsic_matrix);
65 
71 
81  int width, int height, double fx, double fy, double cx, double cy);
82 
83  ~PinholeCameraIntrinsic() override;
84 
85 public:
95  int width, int height, double fx, double fy, double cx, double cy) {
96  width_ = width;
97  height_ = height;
98  intrinsic_matrix_.setIdentity();
99  intrinsic_matrix_(0, 0) = fx;
100  intrinsic_matrix_(1, 1) = fy;
101  intrinsic_matrix_(0, 2) = cx;
102  intrinsic_matrix_(1, 2) = cy;
103  }
104 
106  std::pair<double, double> GetFocalLength() const {
107  return std::make_pair(intrinsic_matrix_(0, 0), intrinsic_matrix_(1, 1));
108  }
109 
112  std::pair<double, double> GetPrincipalPoint() const {
113  return std::make_pair(intrinsic_matrix_(0, 2), intrinsic_matrix_(1, 2));
114  }
115 
117  double GetSkew() const { return intrinsic_matrix_(0, 1); }
118 
120  bool IsValid() const { return (width_ > 0 && height_ > 0); }
121 
122  bool ConvertToJsonValue(Json::Value &value) const override;
123  bool ConvertFromJsonValue(const Json::Value &value) override;
124 
125 public:
127  int width_ = -1;
129  int height_ = -1;
135  Eigen::Matrix3d intrinsic_matrix_;
136 };
137 } // namespace camera
138 } // namespace open3d
int height
Definition: FilePCD.cpp:72
Eigen::Matrix3d intrinsic_matrix_
Definition: PinholeCameraIntrinsic.h:135
std::pair< double, double > GetPrincipalPoint() const
Definition: PinholeCameraIntrinsic.h:112
std::pair< double, double > GetFocalLength() const
Returns the focal length in a tuple of X-axis and Y-axis focal lengths.
Definition: PinholeCameraIntrinsic.h:106
Contains the pinhole camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:51
Default settings for PrimeSense camera sensor.
void SetIntrinsics(int width, int height, double fx, double fy, double cx, double cy)
Set camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:94
double GetSkew() const
Returns the skew.
Definition: PinholeCameraIntrinsic.h:117
bool IsValid() const
Returns true iff both the width and height are greater than 0.
Definition: PinholeCameraIntrinsic.h:120
Definition: PinholeCameraIntrinsic.cpp:35
PinholeCameraIntrinsicParameters
Sets default camera intrinsic parameters for sensors.
Definition: PinholeCameraIntrinsic.h:39
int width
Definition: FilePCD.cpp:71
OPEN3D_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:68
Definition: IJsonConvertible.h:57