Apollo 10.0
自动驾驶开放平台
location_refiner_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 <memory>
19#include <string>
20
21#include "modules/perception/camera_location_refinement/location_refiner/proto/location_refiner.pb.h"
22
26
27namespace apollo {
28namespace perception {
29namespace camera {
30
32 public:
34
35 virtual ~LocationRefinerPostprocessor() = default;
43 bool Init(const PostprocessorInitOptions &options =
44 PostprocessorInitOptions()) override;
53 bool Process(const PostprocessorOptions &options,
54 onboard::CameraFrame *frame) override;
55
56 std::string Name() const override { return "LocationRefinerPostprocessor"; }
57
58 private:
59 bool is_in_roi(const float pt[2], float img_w, float img_h, float v,
60 float h_down) const {
61 float x = pt[0];
62 float y = pt[1];
63 if (y < v) {
64 return false;
65 } else if (y > (img_h - h_down)) {
66 return true;
67 }
68 float img_w_half = img_w / 2.0f;
69 float slope = img_w_half * algorithm::IRec(img_h - h_down - v);
70 float left = img_w_half - slope * (y - v);
71 float right = img_w_half + slope * (y - h_down);
72 return x > left && x < right;
73 }
74
75 private:
76 std::unique_ptr<ObjPostProcessor> postprocessor_;
77 std::shared_ptr<BaseCalibrationService> calibration_service_;
78 location_refiner::LocationRefinerParam location_refiner_param_;
79};
80
81} // namespace camera
82} // namespace perception
83} // namespace apollo
bool Process(const PostprocessorOptions &options, onboard::CameraFrame *frame) override
post refine location of 3D obstacles
bool Init(const PostprocessorInitOptions &options=PostprocessorInitOptions()) override
: set location refiner param
class register implement
Definition arena_queue.h:37