ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TreeIso.cpp File Reference
#include "TreeIso.h"
#include "TreeIsoHelper.h"
#include <ecvMainAppInterface.h>
#include <ecvQtHelpers.h>
#include <ecvPointCloud.h>
#include <QCoreApplication>
#include <QElapsedTimer>
#include <QProgressDialog>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
Include dependency graph for TreeIso.cpp:

Go to the source code of this file.

Typedefs

typedef boost::geometry::model::d2::point_xy< double > point_xy
 
typedef boost::geometry::model::polygon< point_xypolygon
 
typedef boost::geometry::model::multi_point< point_xymulti_point
 
typedef boost::geometry::model::multi_polygon< polygonmulti_polygon
 
typedef std::vector< float > Vec3d
 

Functions

template<class result_t = std::chrono::milliseconds, class clock_t = std::chrono::steady_clock, class duration_t = std::chrono::milliseconds>
static auto Since (std::chrono::time_point< clock_t, duration_t > const &start)
 
void knn_cpp_build (knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &kdtree, unsigned n_thread)
 
void knn_cpp_query (knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &kdtree, Eigen::MatrixXf &query_points, size_t k, std::vector< std::vector< size_t >> &res_idx, std::vector< Vec3d > &res_dists)
 
float knn_cpp_query_min_d (knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &kdtree, Eigen::MatrixXf &query_points, size_t k)
 
void knn_cpp_nearest_neighbors (const std::vector< Vec3d > &dataset, size_t k, std::vector< std::vector< uint32_t >> &res_idx, std::vector< Vec3d > &res_dists, unsigned n_thread)
 
template<typename T >
void unique_group (std::vector< T > &arr, std::vector< std::vector< T >> &u_group, std::vector< T > &arr_unq, std::vector< T > &ui)
 
template<typename T >
void unique_group (std::vector< T > &arr, std::vector< std::vector< T >> &u_group, std::vector< T > &arr_unq)
 
template<typename T >
void unique_group (std::vector< T > &arr, std::vector< std::vector< T >> &u_group)
 
template<typename T1 , typename T2 >
void get_subset (std::vector< T1 > &arr, std::vector< T2 > &indices, std::vector< T1 > &arr_sub)
 
template<typename T1 , typename T2 >
void get_subset (const std::vector< std::vector< T1 >> &arr, const std::vector< T2 > &indices, Eigen::MatrixXf &arr_sub)
 
template<typename T1 , typename T2 >
void get_subset (const std::vector< std::vector< T1 >> &arr, const std::vector< T2 > &indices, std::vector< std::vector< T1 >> &arr_sub)
 
template<typename T1 , typename T2 >
bool get_subset (ccPointCloud *pcd, std::vector< T2 > &indices, std::vector< std::vector< T1 >> &arr_sub)
 
template<typename T >
void toTranslatedVector (const ccPointCloud *pc, std::vector< std::vector< T >> &y)
 
bool perform_cut_pursuit (const uint32_t K, const float regStrength, const std::vector< Vec3d > &pc, std::vector< float > &edgeWeight, std::vector< uint32_t > &Eu, std::vector< uint32_t > &Ev, std::vector< uint32_t > &in_component, std::vector< std::vector< uint32_t >> &components)
 
void perform_cut_pursuit2d (const uint32_t K, const float regStrength, const std::vector< Vec3d > &pc_vec, Vec3d &edgeWeight, std::vector< uint32_t > &Eu, std::vector< uint32_t > &Ev, std::vector< uint32_t > &in_component)
 
template<typename T >
size_t arg_min_col (std::vector< T > &arr)
 
template<typename T >
size_t arg_max_col (std::vector< T > &arr)
 
template<typename T >
void min_col (std::vector< std::vector< T >> &arr, std::vector< T > &min_vals)
 
template<typename T >
min_col (std::vector< T > &arr)
 
template<typename T >
mean_col (std::vector< T > &arr)
 
template<typename T >
median_col (std::vector< T > &arr)
 
template<typename T >
mode_col (std::vector< T > &arr)
 
template<typename T >
void max_col (std::vector< std::vector< T >> &arr, std::vector< T > &max_vals)
 
template<typename T >
void mean_col (std::vector< std::vector< T >> &arr, std::vector< T > &mean_vals)
 
template<typename T >
void decimate_vec (std::vector< std::vector< T >> &arr, T res, std::vector< std::vector< T >> &vec_dec)
 
template<typename T >
void sort_indexes_by_row (std::vector< std::vector< T >> &v, std::vector< size_t > &idx, std::vector< std::vector< T >> &v_sorted)
 
template<typename ValueType , typename IndexType >
void sort_indexes (std::vector< ValueType > &v, std::vector< IndexType > &idx, std::vector< ValueType > &v_sorted)
 
template<typename T >
void unique_index_by_rows (std::vector< std::vector< T >> &arr, std::vector< size_t > &ia, std::vector< size_t > &ic)
 

Variables

static const char InitSegsSFName [] = "init_segs"
 
static const char IntermedSegsSFName [] = "intermediate_segs"
 
static const char FinalSegsSFName [] = "final_segs"
 

Typedef Documentation

◆ multi_point

typedef boost::geometry::model::multi_point<point_xy> multi_point

Definition at line 38 of file TreeIso.cpp.

◆ multi_polygon

typedef boost::geometry::model::multi_polygon<polygon> multi_polygon

Definition at line 39 of file TreeIso.cpp.

◆ point_xy

typedef boost::geometry::model::d2::point_xy<double> point_xy

Definition at line 36 of file TreeIso.cpp.

◆ polygon

typedef boost::geometry::model::polygon<point_xy> polygon

Definition at line 37 of file TreeIso.cpp.

◆ Vec3d

typedef std::vector<float> Vec3d

Definition at line 41 of file TreeIso.cpp.

Function Documentation

◆ arg_max_col()

template<typename T >
size_t arg_max_col ( std::vector< T > &  arr)

Definition at line 1393 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ arg_min_col()

template<typename T >
size_t arg_min_col ( std::vector< T > &  arr)

Definition at line 1386 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ decimate_vec()

template<typename T >
void decimate_vec ( std::vector< std::vector< T >> &  arr,
res,
std::vector< std::vector< T >> &  vec_dec 
)

Definition at line 1501 of file TreeIso.cpp.

References cloudViewer::utility::floor(), and min_col().

Referenced by TreeIso::Init_seg_pcd(), and TreeIso::Intermediate_seg_pcd().

◆ get_subset() [1/4]

template<typename T1 , typename T2 >
bool get_subset ( ccPointCloud pcd,
std::vector< T2 > &  indices,
std::vector< std::vector< T1 >> &  arr_sub 
)

◆ get_subset() [2/4]

template<typename T1 , typename T2 >
void get_subset ( const std::vector< std::vector< T1 >> &  arr,
const std::vector< T2 > &  indices,
Eigen::MatrixXf &  arr_sub 
)

Definition at line 1165 of file TreeIso.cpp.

References size.

◆ get_subset() [3/4]

template<typename T1 , typename T2 >
void get_subset ( const std::vector< std::vector< T1 >> &  arr,
const std::vector< T2 > &  indices,
std::vector< std::vector< T1 >> &  arr_sub 
)

Definition at line 1185 of file TreeIso.cpp.

◆ get_subset() [4/4]

template<typename T1 , typename T2 >
void get_subset ( std::vector< T1 > &  arr,
std::vector< T2 > &  indices,
std::vector< T1 > &  arr_sub 
)

◆ knn_cpp_build()

void knn_cpp_build ( knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &  kdtree,
unsigned  n_thread 
)

Definition at line 947 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd(), and TreeIso::Intermediate_seg_pcd().

◆ knn_cpp_nearest_neighbors()

◆ knn_cpp_query()

void knn_cpp_query ( knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &  kdtree,
Eigen::MatrixXf &  query_points,
size_t  k,
std::vector< std::vector< size_t >> &  res_idx,
std::vector< Vec3d > &  res_dists 
)

Definition at line 957 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ knn_cpp_query_min_d()

float knn_cpp_query_min_d ( knncpp::KDTreeMinkowskiX< float, knncpp::EuclideanDistance< float >> &  kdtree,
Eigen::MatrixXf &  query_points,
size_t  k 
)

Definition at line 983 of file TreeIso.cpp.

Referenced by TreeIso::Intermediate_seg_pcd().

◆ max_col()

template<typename T >
void max_col ( std::vector< std::vector< T >> &  arr,
std::vector< T > &  max_vals 
)

Definition at line 1464 of file TreeIso.cpp.

References max().

Referenced by TreeIso::Final_seg_pcd().

◆ mean_col() [1/2]

template<typename T >
void mean_col ( std::vector< std::vector< T >> &  arr,
std::vector< T > &  mean_vals 
)

Definition at line 1480 of file TreeIso.cpp.

References size.

◆ mean_col() [2/2]

template<typename T >
T mean_col ( std::vector< T > &  arr)

◆ median_col()

template<typename T >
T median_col ( std::vector< T > &  arr)

Definition at line 1437 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ min_col() [1/2]

template<typename T >
void min_col ( std::vector< std::vector< T >> &  arr,
std::vector< T > &  min_vals 
)

Definition at line 1400 of file TreeIso.cpp.

References min().

Referenced by decimate_vec(), and TreeIso::Final_seg_pcd().

◆ min_col() [2/2]

template<typename T >
T min_col ( std::vector< T > &  arr)

Definition at line 1416 of file TreeIso.cpp.

References result.

◆ mode_col()

template<typename T >
T mode_col ( std::vector< T > &  arr)

Definition at line 1453 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ perform_cut_pursuit()

bool perform_cut_pursuit ( const uint32_t  K,
const float  regStrength,
const std::vector< Vec3d > &  pc,
std::vector< float > &  edgeWeight,
std::vector< uint32_t > &  Eu,
std::vector< uint32_t > &  Ev,
std::vector< uint32_t > &  in_component,
std::vector< std::vector< uint32_t >> &  components 
)

Definition at line 1245 of file TreeIso.cpp.

References knn_cpp_nearest_neighbors().

Referenced by TreeIso::Init_seg_pcd().

◆ perform_cut_pursuit2d()

void perform_cut_pursuit2d ( const uint32_t  K,
const float  regStrength,
const std::vector< Vec3d > &  pc_vec,
Vec3d edgeWeight,
std::vector< uint32_t > &  Eu,
std::vector< uint32_t > &  Ev,
std::vector< uint32_t > &  in_component 
)

Definition at line 1319 of file TreeIso.cpp.

References knn_cpp_nearest_neighbors().

Referenced by TreeIso::Intermediate_seg_pcd().

◆ Since()

template<class result_t = std::chrono::milliseconds, class clock_t = std::chrono::steady_clock, class duration_t = std::chrono::milliseconds>
static auto Since ( std::chrono::time_point< clock_t, duration_t > const &  start)
static

◆ sort_indexes()

template<typename ValueType , typename IndexType >
void sort_indexes ( std::vector< ValueType > &  v,
std::vector< IndexType > &  idx,
std::vector< ValueType > &  v_sorted 
)

Definition at line 1576 of file TreeIso.cpp.

Referenced by TreeIso::Intermediate_seg_pcd(), and unique_group().

◆ sort_indexes_by_row()

template<typename T >
void sort_indexes_by_row ( std::vector< std::vector< T >> &  v,
std::vector< size_t > &  idx,
std::vector< std::vector< T >> &  v_sorted 
)

Definition at line 1531 of file TreeIso.cpp.

Referenced by unique_index_by_rows().

◆ toTranslatedVector()

template<typename T >
void toTranslatedVector ( const ccPointCloud pc,
std::vector< std::vector< T >> &  y 
)

◆ unique_group() [1/3]

template<typename T >
void unique_group ( std::vector< T > &  arr,
std::vector< std::vector< T >> &  u_group 
)

Definition at line 1120 of file TreeIso.cpp.

References sort_indexes().

◆ unique_group() [2/3]

template<typename T >
void unique_group ( std::vector< T > &  arr,
std::vector< std::vector< T >> &  u_group,
std::vector< T > &  arr_unq 
)

Definition at line 1079 of file TreeIso.cpp.

References sort_indexes().

◆ unique_group() [3/3]

template<typename T >
void unique_group ( std::vector< T > &  arr,
std::vector< std::vector< T >> &  u_group,
std::vector< T > &  arr_unq,
std::vector< T > &  ui 
)

Definition at line 1034 of file TreeIso.cpp.

References sort_indexes().

Referenced by TreeIso::Final_seg_pcd(), and TreeIso::Intermediate_seg_pcd().

◆ unique_index_by_rows()

template<typename T >
void unique_index_by_rows ( std::vector< std::vector< T >> &  arr,
std::vector< size_t > &  ia,
std::vector< size_t > &  ic 
)

Definition at line 1601 of file TreeIso.cpp.

References sort_indexes_by_row().

Referenced by TreeIso::Init_seg_pcd(), and TreeIso::Intermediate_seg_pcd().

Variable Documentation

◆ FinalSegsSFName

const char FinalSegsSFName[] = "final_segs"
static

Definition at line 49 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd().

◆ InitSegsSFName

const char InitSegsSFName[] = "init_segs"
static

◆ IntermedSegsSFName

const char IntermedSegsSFName[] = "intermediate_segs"
static

Definition at line 48 of file TreeIso.cpp.

Referenced by TreeIso::Final_seg_pcd(), and TreeIso::Intermediate_seg_pcd().