Open3D (C++ API)  0.16.0
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
33namespace open3d {
34namespace camera {
35
46};
47
52public:
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
85public:
95 int width, int height, double fx, double fy, double cx, double cy) {
96 width_ = width;
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 {
108 }
109
112 std::pair<double, double> GetPrincipalPoint() const {
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
125public:
127 int width_ = -1;
129 int height_ = -1;
135 Eigen::Matrix3d intrinsic_matrix_;
136};
137} // namespace camera
138} // namespace open3d
Contains the pinhole camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:51
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: PinholeCameraIntrinsic.cpp:74
int width_
Width of the image.
Definition: PinholeCameraIntrinsic.h:127
~PinholeCameraIntrinsic() override
Definition: PinholeCameraIntrinsic.cpp:62
std::pair< double, double > GetPrincipalPoint() const
Definition: PinholeCameraIntrinsic.h:112
PinholeCameraIntrinsic()
Default Constructor.
Definition: PinholeCameraIntrinsic.cpp:38
bool IsValid() const
Returns true iff both the width and height are greater than 0.
Definition: PinholeCameraIntrinsic.h:120
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
Eigen::Matrix3d intrinsic_matrix_
Definition: PinholeCameraIntrinsic.h:135
int height_
Height of the image.
Definition: PinholeCameraIntrinsic.h:129
bool ConvertToJsonValue(Json::Value &value) const override
Definition: PinholeCameraIntrinsic.cpp:64
double GetSkew() const
Returns the skew.
Definition: PinholeCameraIntrinsic.h:117
void SetIntrinsics(int width, int height, double fx, double fy, double cx, double cy)
Set camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:94
Definition: IJsonConvertible.h:59
int width
Definition: FilePCD.cpp:71
int height
Definition: FilePCD.cpp:72
PinholeCameraIntrinsicParameters
Sets default camera intrinsic parameters for sensors.
Definition: PinholeCameraIntrinsic.h:39
@ PrimeSenseDefault
Default settings for PrimeSense camera sensor.
@ Kinect2DepthCameraDefault
Default settings for Kinect2 depth camera.
@ Kinect2ColorCameraDefault
Default settings for Kinect2 color camera.
OPEN3D_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:68
Definition: PinholeCameraIntrinsic.cpp:35