Apollo 10.0
自动驾驶开放平台
apollo::perception::camera::DenselineLanePostprocessor类 参考

#include <denseline_lane_postprocessor.h>

类 apollo::perception::camera::DenselineLanePostprocessor 继承关系图:
apollo::perception::camera::DenselineLanePostprocessor 的协作图:

Public 成员函数

 DenselineLanePostprocessor ()
 
virtual ~DenselineLanePostprocessor ()=default
 
bool Init (const LanePostprocessorInitOptions &options=LanePostprocessorInitOptions()) override
 
bool Process2D (const LanePostprocessorOptions &options, CameraFrame *frame) override
 
bool Process3D (const LanePostprocessorOptions &options, CameraFrame *frame) override
 
std::vector< std::vector< LanePointInfo > > GetLanelinePointSet ()
 
std::vector< LanePointInfoGetAllInferLinePointSet ()
 
void GetLaneCCs (std::vector< unsigned char > *lane_map, int *lane_map_width, int *lane_map_height, std::vector< ConnectedComponent > *connected_components, std::vector< ConnectedComponent > *select_connected_components)
 
std::string Name () const override
 
- Public 成员函数 继承自 apollo::perception::camera::BaseLanePostprocessor
 BaseLanePostprocessor ()=default
 
virtual ~BaseLanePostprocessor ()=default
 
virtual void SetIm2CarHomography (const Eigen::Matrix3d &homography_im2car)
 
 DISALLOW_COPY_AND_ASSIGN (BaseLanePostprocessor)
 

详细描述

在文件 denseline_lane_postprocessor.h42 行定义.

构造及析构函数说明

◆ DenselineLanePostprocessor()

apollo::perception::camera::DenselineLanePostprocessor::DenselineLanePostprocessor ( )
inline

◆ ~DenselineLanePostprocessor()

virtual apollo::perception::camera::DenselineLanePostprocessor::~DenselineLanePostprocessor ( )
virtualdefault

成员函数说明

◆ GetAllInferLinePointSet()

std::vector< LanePointInfo > apollo::perception::camera::DenselineLanePostprocessor::GetAllInferLinePointSet ( )

在文件 denseline_lane_postprocessor.cc759 行定义.

759 {
760 float x_ratio =
761 static_cast<float>(input_crop_width_) * lane_map_width_inverse_;
762 float y_ratio =
763 static_cast<float>(input_crop_height_) * lane_map_height_inverse_;
764 image_laneline_point_set_.clear();
765 int lane_map_dim = lane_map_width_ * lane_map_height_;
766 float lane_map_width_float = static_cast<float>(lane_map_width_);
767 for (int i = 0; i < lane_map_height_; i++) {
768 for (int j = 0; j < lane_map_width_; j++) {
769 int pixel_pos = i * lane_map_width_ + j;
770 float score = lane_output_[lane_map_dim * 2 + pixel_pos];
771 if (score < laneline_point_score_thresh_) {
772 continue;
773 }
774 float dist_left = lane_output_[pixel_pos];
775 float dist_right = lane_output_[lane_map_dim + pixel_pos];
776 float map_x_left =
777 static_cast<float>(j) - dist_left * lane_map_width_float;
778 float map_x_right =
779 static_cast<float>(j) + dist_right * lane_map_width_float;
780 float org_img_y =
781 static_cast<float>(i) * y_ratio + static_cast<float>(input_offset_y_);
782 if (map_x_left > 0) {
783 LanePointInfo left_point;
784 float org_img_x_left =
785 map_x_left * x_ratio + static_cast<float>(input_offset_x_);
786 left_point.x = org_img_x_left;
787 left_point.y = org_img_y;
788 left_point.score = score;
789 image_laneline_point_set_.push_back(left_point);
790 }
791 if (map_x_right < lane_map_width_float) {
792 LanePointInfo right_point;
793 float org_img_x_right =
794 map_x_right * x_ratio + static_cast<float>(input_offset_x_);
795 right_point.x = org_img_x_right;
796 right_point.y = org_img_y;
797 right_point.score = score;
798 image_laneline_point_set_.push_back(right_point);
799 }
800 }
801 }
802 return image_laneline_point_set_;
803}

◆ GetLaneCCs()

void apollo::perception::camera::DenselineLanePostprocessor::GetLaneCCs ( std::vector< unsigned char > *  lane_map,
int *  lane_map_width,
int *  lane_map_height,
std::vector< ConnectedComponent > *  connected_components,
std::vector< ConnectedComponent > *  select_connected_components 
)

在文件 denseline_lane_postprocessor.cc805 行定义.

808 {
809 *lane_map = lane_map_;
810 *lane_map_width = lane_map_width_;
811 *lane_map_height = lane_map_height_;
812 *connected_components = lane_ccs_;
813 *select_connected_components = select_lane_ccs_;
814}

◆ GetLanelinePointSet()

std::vector< std::vector< LanePointInfo > > apollo::perception::camera::DenselineLanePostprocessor::GetLanelinePointSet ( )

在文件 denseline_lane_postprocessor.cc754 行定义.

754 {
755 return image_group_point_set_;
756}

◆ Init()

bool apollo::perception::camera::DenselineLanePostprocessor::Init ( const LanePostprocessorInitOptions options = LanePostprocessorInitOptions())
overridevirtual

实现了 apollo::perception::camera::BaseLanePostprocessor.

在文件 denseline_lane_postprocessor.cc33 行定义.

34 {
35 // read postprocessor parameter
36 std::string config_file =
37 GetConfigFile(options.config_path, options.config_file);
38 if (!cyber::common::GetProtoFromFile(config_file,
39 &lane_postprocessor_param_)) {
40 AERROR << "Read config detect_param failed: " << config_file;
41 return false;
42 }
43
44 AINFO << "lane_postprocessor param: "
45 << lane_postprocessor_param_.DebugString();
46 input_offset_x_ = lane_postprocessor_param_.input_offset_x();
47 input_offset_y_ = lane_postprocessor_param_.input_offset_y();
48 input_crop_height_ = lane_postprocessor_param_.crop_height();
49 input_crop_width_ = lane_postprocessor_param_.crop_width();
50
51 omit_bottom_line_num_ = lane_postprocessor_param_.omit_bottom_line_num();
52 laneline_map_score_thresh_ =
53 lane_postprocessor_param_.laneline_map_score_thresh();
54 laneline_point_score_thresh_ =
55 lane_postprocessor_param_.laneline_point_score_thresh();
56 laneline_point_min_num_thresh_ =
57 lane_postprocessor_param_.laneline_point_min_num_thresh();
58 cc_valid_pixels_ratio_ = lane_postprocessor_param_.cc_valid_pixels_ratio();
59 laneline_reject_dist_thresh_ =
60 lane_postprocessor_param_.laneline_reject_dist_thresh();
61
62 lane_map_dim_ = lane_map_width_ * lane_map_height_;
63 lane_pos_blob_.Reshape({4, lane_map_dim_});
64 lane_hist_blob_.Reshape({2, lane_map_dim_});
65 return true;
66}
void Reshape(const int num, const int channels, const int height, const int width)
Deprecated; use Reshape(const std::vector<int>& shape).
Definition blob.cc:72
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
Definition util.cc:80

◆ Name()

std::string apollo::perception::camera::DenselineLanePostprocessor::Name ( ) const
overridevirtual

实现了 apollo::perception::camera::BaseLanePostprocessor.

在文件 denseline_lane_postprocessor.cc816 行定义.

816 {
817 return "DenselineLanePostprocessor";
818}

◆ Process2D()

bool apollo::perception::camera::DenselineLanePostprocessor::Process2D ( const LanePostprocessorOptions options,
CameraFrame frame 
)
overridevirtual

实现了 apollo::perception::camera::BaseLanePostprocessor.

在文件 denseline_lane_postprocessor.cc68 行定义.

69 {
70 frame->lane_objects.clear();
71 // 1. locate the lane line point set
72 bool flag = LocateLanelinePointSet(frame);
73 if (!flag) {
74 return true;
75 }
76
77 // 2. classify the lane line pos type
78 std::vector<base::LaneLinePositionType> line_pos_type_vec(
79 image_group_point_set_.size());
80 std::vector<bool> line_flag(image_group_point_set_.size(), false);
81 ClassifyLanelinePosTypeInImage(image_group_point_set_, &line_pos_type_vec,
82 &line_flag);
84 for (int line_index = 0;
85 line_index < static_cast<int>(image_group_point_set_.size());
86 line_index++) {
87 if (!line_flag[line_index]) {
88 ADEBUG << "line_pos_type is invalid";
89 continue;
90 }
91 AddImageLaneline(image_group_point_set_[line_index], line_type,
92 line_pos_type_vec[line_index], line_index,
93 &(frame->lane_objects));
94 }
95 AINFO << "[AfterProcess2D]lane_lines_num: " << frame->lane_objects.size();
96
97 return true;
98}
#define ADEBUG
Definition log.h:41

◆ Process3D()

bool apollo::perception::camera::DenselineLanePostprocessor::Process3D ( const LanePostprocessorOptions options,
CameraFrame frame 
)
overridevirtual

实现了 apollo::perception::camera::BaseLanePostprocessor.

在文件 denseline_lane_postprocessor.cc100 行定义.

101 {
102 ConvertImagePoint2Camera(frame);
103 PolyFitCameraLaneline(frame);
104 return true;
105}

该类的文档由以下文件生成: