#pragma once //####################################################################################### //# # //# CLOUDCOMPARE PLUGIN: qTreeIso # //# # //# This program is free software; you can redistribute it and/or modify # //# it under the terms of the GNU General Public License as published by # //# the Free Software Foundation; version 2 or later of the License. # //# # //# This program is distributed in the hope that it will be useful, # //# but WITHOUT ANY WARRANTY; without even the implied warranty of # //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # //# GNU General Public License for more details. # //# # //# Please cite the following paper if you find this tool helpful # //# # //# Xi, Z.; Hopkinson, C. 3D Graph-Based Individual-Tree Isolation (Treeiso) # //# from Terrestrial Laser Scanning Point Clouds. Remote Sens. 2022, 14, 6116. # //# https://doi.org/10.3390/rs14236116 # //# # //# Our work relies on the cut-pursuit algorithm, please also consider citing: # //# Landrieu, L.; Obozinski, G. Cut Pursuit: Fast Algorithms to Learn Piecewise # //# Constant Functions on General Weighted Graphs. SIAM J. Imaging Sci. # //# 2017, 10, 1724–1766. # //# # //# Copyright © # //# Artemis Lab, Department of Geography & Environment # //# University of Lethbridge, Canada # //# # //# # //# Zhouxin Xi and Chris Hopkinson; # //# truebelief2010@gmail.com; c.hopkinson@uleth.ca # //# # //####################################################################################### //Local #include "API.h" #include "knncpp.h" //Eigen #include //STL #include class ccPointCloud; bool perform_cut_pursuit(const uint32_t K, const float regStrength, const std::vector>& pc_vec, std::vector& edgeWeight, std::vector& Eu, std::vector& Ev, std::vector& in_component, std::vector>& components); void perform_cut_pursuit2d(const uint32_t K, const float regStrength, const std::vector>& pc_vec, std::vector& edgeWeight, std::vector& Eu, std::vector& Ev, std::vector&); template void toTranslatedVector(const ccPointCloud* pc, std::vector>& y); template size_t arg_min_col(std::vector& arr); template size_t arg_max_col(std::vector& arr); template void min_col(std::vector>& arr, std::vector&); template T min_col(std::vector& arr); template void max_col(std::vector>& arr, std::vector&); template void mean_col(std::vector>& arr, std::vector&); template T mean_col(std::vector& arr); template T median_col(std::vector& arr); template T mode_col(std::vector& arr); template void decimate_vec(std::vector>& arr, T res, std::vector>& vec_dec); template void unique_group(std::vector& arr, std::vector>& u_group, std::vector& arr_unq, std::vector& ui); template void unique_group(std::vector& idx, std::vector>&); template void unique_group(std::vector& arr, std::vector>& u_group, std::vector& arr_unq); template void unique_index_by_rows(std::vector>& arr, std::vector& ia, std::vector& ic); template void sort_indexes_by_row(std::vector>& v, std::vector& idx, std::vector>&); template void sort_indexes(std::vector& v, std::vector& idx, std::vector&); template void get_subset(const std::vector>& arr, const std::vector& indices, std::vector>&); template void get_subset(const std::vector>& arr, const std::vector& indices, Eigen::MatrixXf&); template bool get_subset(ccPointCloud* pcd, std::vector& indices, std::vector>& arr_sub); template void get_subset(std::vector& arr, std::vector& indices, std::vector& arr_sub); void knn_cpp_nearest_neighbors(const std::vector>& dataset, size_t k, std::vector >& res_idx, std::vector >& res_dists, unsigned n_thread); void knn_cpp_build(knncpp::KDTreeMinkowskiX>& kdtree, unsigned n_thread = 0); void knn_cpp_query(knncpp::KDTreeMinkowskiX>& kdtree, Eigen::MatrixXf& query_points, size_t k, std::vector >& res_idx, std::vector >& res_dists); float knn_cpp_query_min_d(knncpp::KDTreeMinkowskiX>& kdtree, Eigen::MatrixXf& query_points, size_t k);