Open3D (C++ API)  0.15.1
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:
69 int width, int height, double fx, double fy, double cx, double cy);
70 ~PinholeCameraIntrinsic() override;
71
72public:
82 int width, int height, double fx, double fy, double cx, double cy) {
83 width_ = width;
85 intrinsic_matrix_.setIdentity();
86 intrinsic_matrix_(0, 0) = fx;
87 intrinsic_matrix_(1, 1) = fy;
88 intrinsic_matrix_(0, 2) = cx;
89 intrinsic_matrix_(1, 2) = cy;
90 }
91
93 std::pair<double, double> GetFocalLength() const {
95 }
96
99 std::pair<double, double> GetPrincipalPoint() const {
101 }
102
104 double GetSkew() const { return intrinsic_matrix_(0, 1); }
105
107 bool IsValid() const { return (width_ > 0 && height_ > 0); }
108
109 bool ConvertToJsonValue(Json::Value &value) const override;
110 bool ConvertFromJsonValue(const Json::Value &value) override;
111
112public:
114 int width_ = -1;
116 int height_ = -1;
122 Eigen::Matrix3d intrinsic_matrix_;
123};
124} // namespace camera
125} // namespace open3d
Contains the pinhole camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:51
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: PinholeCameraIntrinsic.cpp:70
int width_
Width of the image.
Definition: PinholeCameraIntrinsic.h:114
~PinholeCameraIntrinsic() override
Definition: PinholeCameraIntrinsic.cpp:58
std::pair< double, double > GetPrincipalPoint() const
Definition: PinholeCameraIntrinsic.h:99
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:107
std::pair< double, double > GetFocalLength() const
Returns the focal length in a tuple of X-axis and Y-axis focal lengths.
Definition: PinholeCameraIntrinsic.h:93
Eigen::Matrix3d intrinsic_matrix_
Definition: PinholeCameraIntrinsic.h:122
int height_
Height of the image.
Definition: PinholeCameraIntrinsic.h:116
bool ConvertToJsonValue(Json::Value &value) const override
Definition: PinholeCameraIntrinsic.cpp:60
double GetSkew() const
Returns the skew.
Definition: PinholeCameraIntrinsic.h:104
void SetIntrinsics(int width, int height, double fx, double fy, double cx, double cy)
Set camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:81
Definition: IJsonConvertible.h:57
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