Apollo 11.0
自动驾驶开放平台
obj_postprocessor.h
浏览该文件的文档.
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 <vector>
19
20#ifdef LOCAL_REPO
21// todo(daohu527): need delete?
22// local repo header path
23#include "modules/perception/common/noncopyable.h"
24#include "modules/perception/lib/common/twod_threed_util.h"
25#else
26// perception-camera header path
28#endif
29
30namespace apollo {
31namespace perception {
32namespace camera {
33
35 // ground + line segments
36 float plane[4] = {0};
37 std::vector<LineSegment2D<float>> line_segs = {};
38 bool check_lowerbound = true;
39
40 // disparity
41 float *disp_map = nullptr;
42 float baseline = 0.0f;
43
44 float hwl[3] = {0};
45 float bbox[4] = {0};
46 float ry = 0.0f;
47};
48
49// hyper parameters
62
64 public:
65 ObjPostProcessor() = default;
66 virtual ~ObjPostProcessor() = default;
74 void Init(const float *k_mat, int width, int height) {
75 memcpy(k_mat_, k_mat, sizeof(float) * 9);
76 width_ = width;
77 height_ = height;
78 }
90 float center[3], float hwl[3], float *ry);
102 float center[3], float hwl[3], float *ry);
103
104 private:
105 float GetProjectionScore(float ry, const float *bbox, const float *hwl,
106 const float *center,
107 const bool &check_truncation = true) const {
108 float rot[9] = {0};
109 GenRotMatrix(ry, rot);
110 float *bbox_null_1 = nullptr;
111 float *bbox_null_2 = nullptr;
112 return GetScoreViaRotDimensionCenter(&k_mat_[0], width_, height_, bbox, rot,
113 hwl, center, check_truncation,
114 bbox_null_1, bbox_null_2);
115 }
116
117 // refinement using ground-3d bbox consistency
118 bool AdjustCenterWithGround(const float *bbox, const float *hwl, float ry,
119 const float *plane, float *center) const;
120
121 // adjustment using on-ground line segments
122 bool PostRefineCenterWithGroundBoundary(
123 const float *bbox, const float *hwl, float ry, const float *plane,
124 const std::vector<LineSegment2D<float>> &line_seg_limits, float *center,
125 bool check_lowerbound) const;
126
127 int GetDepthXPair(const float *bbox, const float *hwl, const float *center,
128 float ry, float *depth_pts, int *x_pts,
129 float *pts_c = nullptr) const;
130
131 private:
132 float k_mat_[9] = {0};
133 int width_ = 0;
134 int height_ = 0;
135 ObjPostProcessorParams params_;
136};
137
138} // namespace camera
139} // namespace perception
140} // namespace apollo
bool PostProcessObjWithGround(const ObjPostProcessorOptions &options, float center[3], float hwl[3], float *ry)
init params
bool PostProcessObjWithDispmap(const ObjPostProcessorOptions &options, float center[3], float hwl[3], float *ry)
none
void Init(const float *k_mat, int width, int height)
process 2d 3d object
void GenRotMatrix(const T &ry, T *rot)
T GetScoreViaRotDimensionCenter(const T *k_mat, int width, int height, const T *bbox, const T *rot, const T *hwl, const T *location, const bool &check_truncation, T *bbox_res=nullptr, T *bbox_near=nullptr)
class register implement
Definition arena_queue.h:37
std::vector< LineSegment2D< float > > line_segs