| 2902 | } |
| 2903 | |
| 2904 | void STDescManager::loadExistingSTD(const std::string &save_path, |
| 2905 | int frame_num) { |
| 2906 | std::string des_path = save_path + "des.bin"; |
| 2907 | |
| 2908 | std::ifstream inputFile(des_path, std::ios::binary); |
| 2909 | size_t mapSize; |
| 2910 | inputFile.read(reinterpret_cast<char *>(&mapSize), sizeof(mapSize)); |
| 2911 | for (size_t i = 0; i < mapSize; ++i) { |
| 2912 | STDesc_LOC loc; |
| 2913 | inputFile.read(reinterpret_cast<char *>(&loc), sizeof(STDesc_LOC)); |
| 2914 | size_t vectorSize; |
| 2915 | inputFile.read(reinterpret_cast<char *>(&vectorSize), sizeof(vectorSize)); |
| 2916 | std::vector<STDesc> descVector; |
| 2917 | for (size_t j = 0; j < vectorSize; ++j) { |
| 2918 | STDesc desc; |
| 2919 | inputFile.read(reinterpret_cast<char *>(&desc), sizeof(STDesc)); |
| 2920 | descVector.push_back(desc); |
| 2921 | } |
| 2922 | data_base_[loc] = descVector; |
| 2923 | } |
| 2924 | inputFile.close(); |
| 2925 | |
| 2926 | std::string plan_cloud_path = save_path + "plane_clouds/"; |
| 2927 | std::stringstream ss; |
| 2928 | for (auto i = 0; i < frame_num; ++i) { |
| 2929 | pcl::PointCloud<pcl::PointXYZINormal>::Ptr currPlaneCloud( |
| 2930 | new pcl::PointCloud<pcl::PointXYZINormal>()); |
| 2931 | ss << plan_cloud_path << std::setfill('0') << std::setw(6) << i << ".pcd"; |
| 2932 | pcl::io::loadPCDFile<pcl::PointXYZINormal>(ss.str(), *currPlaneCloud); |
| 2933 | // std::cout << "before push_back: " << |
| 2934 | // currPlaneCloud->points.size() |
| 2935 | // << std::endl; |
| 2936 | this->plane_cloud_vec_.push_back(currPlaneCloud); |
| 2937 | // std::cout << "aft push_back: " |
| 2938 | // << plane_cloud_vec_.back()->points.size() << std::endl; |
| 2939 | ss.clear(); |
| 2940 | ss.str(std::string()); |
| 2941 | // currPlaneCloud->clear(); |
| 2942 | } |
| 2943 | } |
| 2944 | |
| 2945 | void OctoTree::init_plane() { |
| 2946 | plane_ptr_->covariance_ = Eigen::Matrix3d::Zero(); |