Apollo  v5.5.0
Open source self driving car software
undistortion_handler.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <string>
19 
24 
25 namespace apollo {
26 namespace perception {
27 namespace camera {
28 
30  public:
31  UndistortionHandler() { inited_ = false; }
32 
34 
35  bool set_device(int device);
36  bool Init(const std::string &sensor_name, int device);
37  void InitUndistortRectifyMap(const Eigen::Matrix3f &camera_model,
38  const Eigen::Matrix<float, 5, 1> distortion,
39  const Eigen::Matrix3f &R,
40  const Eigen::Matrix3f &new_camera_model,
41  int width, int height, base::Blob<float> *d_mapx,
42  base::Blob<float> *d_mapy);
47  bool Handle(const base::Image8U &src_img, base::Image8U *dst_img);
48  // @brief: Release the resources
49  bool Release(void);
50 
51  private:
52  base::Blob<float> d_mapx_;
53  base::Blob<float> d_mapy_;
54 
55  int width_ = 0; // image cols
56  int height_ = 0; // image rows
57  int in_size_ = 0; // size of the input image in byte
58  int out_size_ = 0; // size of the output image in byte
59  int device_ = 0; // device number for gpu
60  bool inited_ = 0;
61 };
62 
63 } // namespace camera
64 } // namespace perception
65 } // namespace apollo
Definition: blob.h:72
A wrapper around Blob holders serving as the basic computational unit for images. ...
Definition: image_8u.h:44
bool Handle(const base::Image8U &src_img, base::Image8U *dst_img)
: Processing each image : src_img - input image array dst_img - output image array ...
bool Init(const std::string &sensor_name, int device)
void InitUndistortRectifyMap(const Eigen::Matrix3f &camera_model, const Eigen::Matrix< float, 5, 1 > distortion, const Eigen::Matrix3f &R, const Eigen::Matrix3f &new_camera_model, int width, int height, base::Blob< float > *d_mapx, base::Blob< float > *d_mapy)
UndistortionHandler()
Definition: undistortion_handler.h:31
Definition: undistortion_handler.h:29
~UndistortionHandler()
Definition: undistortion_handler.h:33