Apollo  v5.5.0
Open source self driving car software
util.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 <fstream>
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 #include "Eigen/Dense"
24 
26 
27 namespace apollo {
28 namespace perception {
29 namespace lidar {
30 
31 enum {
33 };
34 
35 typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, 1> Vectord;
36 typedef Eigen::Matrix<int, VALID_OBJECT_TYPE, 1> Vectori;
37 typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE> Matrixd;
38 
39 namespace util {
40 
41 void FromStdToVector(const std::vector<float>& src_prob, Vectord* dst_prob);
42 
43 void FromEigenToVector(const Vectord& src_prob, std::vector<float>* dst_prob);
44 
45 void ToLog(Vectord* prob);
46 
47 void ToExp(Vectord* prob);
48 
49 void ToExpStable(Vectord* prob);
50 
51 void Normalize(Vectord* prob);
52 
53 void NormalizeRow(Matrixd* prob);
54 
55 bool LoadSingleMatrix(std::ifstream& fin, Matrixd* matrix);
56 
57 bool LoadSingleMatrixFile(const std::string& filename, Matrixd* matrix);
58 
59 bool LoadMultipleMatricesFile(const std::string& filename,
60  std::map<std::string, Matrixd>* matrices);
61 
62 } // namespace util
63 } // namespace lidar
64 } // namespace perception
65 } // namespace apollo
Eigen::Matrix< int, VALID_OBJECT_TYPE, 1 > Vectori
Definition: util.h:36
void FromStdToVector(const std::vector< float > &src_prob, Vectord *dst_prob)
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition: util.h:35
Definition: blob.h:72
bool LoadSingleMatrixFile(const std::string &filename, Matrixd *matrix)
Eigen::Matrix< double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE > Matrixd
Definition: util.h:37
bool LoadMultipleMatricesFile(const std::string &filename, std::map< std::string, Matrixd > *matrices)
void ToExpStable(Vectord *prob)
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
void NormalizeRow(Matrixd *prob)
bool LoadSingleMatrix(std::ifstream &fin, Matrixd *matrix)
void Normalize(Vectord *prob)