Apollo  6.0
Open source self driving car software
camera_common_undistortion.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 #include <vector>
20 
22 
23 namespace apollo {
24 namespace perception {
25 namespace camera {
26 
28  public:
30 
32 
33  inline int set_device(int dev) {
34  BASE_CUDA_CHECK(cudaSetDevice(dev));
35  return 0;
36  }
37  int init(const std::string &intrinsics_path, int dev);
38  int handle(uint8_t *src, uint8_t *dst);
39  int release(void);
40 
41  private:
42  int load_camera_intrinsics(const std::string &intrinsics_path, int *width,
43  int *height, std::vector<double> *D,
44  std::vector<double> *K);
45 
46  float *_d_mapx = nullptr;
47  float *_d_mapy = nullptr;
48  uint8_t *_d_rgb = nullptr;
49  uint8_t *_d_dst = nullptr;
50 
51  int _width = 0; // image cols
52  int _height = 0; // image rows
53  int _in_size = 0; // size of the input image in byte
54  int _out_size = 0; // size of the output image in byte
55  int _dev_no = 0; // device number for gpu
56  bool _inited = false;
57  const int CHANNEL = 3;
58 };
59 
60 } // namespace camera
61 } // namespace perception
62 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
ImageGpuPreprocessHandler()
Definition: camera_common_undistortion.h:29
Definition: camera_common_undistortion.h:27
int init(const std::string &intrinsics_path, int dev)
~ImageGpuPreprocessHandler()
Definition: camera_common_undistortion.h:31
int set_device(int dev)
Definition: camera_common_undistortion.h:33