ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qM3C2Tools.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // CV_CORE_LIB
11 #include <DgmOctree.h>
12 #include <GenericIndexedCloud.h>
14 
17 class ccScalarField;
18 class ccPointCloud;
20 
22 class qM3C2Normals {
23 public:
25 
28  DEFAULT_MODE = 0, // compute normals on core points
31  VERT_MODE = 3,
34  };
35 
37 
40  static bool ComputeCorePointsNormals(
42  NormsIndexesTableType* corePointsNormals,
44  const std::vector<PointCoordinateType>& sortedRadii,
45  bool& invalidNormals,
46  int maxThreadCount = 0,
47  ccScalarField* normalScale = nullptr,
48  cloudViewer::GenericProgressCallback* progressCb = nullptr,
49  cloudViewer::DgmOctree* inputOctree = nullptr);
50 
57  int maxThreadCount = 0,
58  cloudViewer::GenericProgressCallback* progressCb = nullptr);
59 
62 };
63 
65 class qM3C2Tools {
66 public:
68 
73  bool useMedian,
74  double& meanOrMedian,
75  double& stdDevOrIQR);
76 
78  struct GuessedParams {
80  double normScale = 0.0;
81  double projScale = 0.0;
82  double projDepth = 0.0;
83  };
84 
86  static bool GuessBestParams(ccPointCloud* cloud1,
87  ccPointCloud* cloud2,
88  unsigned minPoints4Stats,
89  GuessedParams& params,
90  bool fastMode,
91  ecvMainAppInterface* app = nullptr,
92  unsigned probingCount = 1000);
93 };
cloudViewer::GenericIndexedCloud
A generic 3D point cloud with index-based point access.
Definition: GenericIndexedCloud.h:18
qM3C2Normals::HORIZ_MODE
@ HORIZ_MODE
Definition: qM3C2Tools.h:32
qM3C2Normals::ComputeCorePointsNormals
static bool ComputeCorePointsNormals(cloudViewer::GenericIndexedCloud *corePoints, NormsIndexesTableType *corePointsNormals, ccGenericPointCloud *sourceCloud, const std::vector< PointCoordinateType > &sortedRadii, bool &invalidNormals, int maxThreadCount=0, ccScalarField *normalScale=nullptr, cloudViewer::GenericProgressCallback *progressCb=nullptr, cloudViewer::DgmOctree *inputOctree=nullptr)
Computes normals on core points only.
Definition: qM3C2Tools.cpp:179
qM3C2Tools::GuessBestParams
static bool GuessBestParams(ccPointCloud *cloud1, ccPointCloud *cloud2, unsigned minPoints4Stats, GuessedParams &params, bool fastMode, ecvMainAppInterface *app=nullptr, unsigned probingCount=1000)
Tries to guess some M3C2 parameters by randomly 'probing' the cloud.
Definition: qM3C2Tools.cpp:529
qM3C2Tools::GuessedParams::projScale
double projScale
Definition: qM3C2Tools.h:81
qM3C2Tools::GuessedParams::projDepth
double projDepth
Definition: qM3C2Tools.h:82
invalidNormals
bool invalidNormals
Definition: qM3C2Tools.cpp:45
qM3C2Tools::ComputeStatistics
static void ComputeStatistics(cloudViewer::DgmOctree::NeighboursSet &set, bool useMedian, double &meanOrMedian, double &stdDevOrIQR)
Computes statistics on a neighbors set.
Definition: qM3C2Tools.cpp:487
GenericProgressCallback.h
qM3C2Normals::USE_CLOUD1_NORMALS
@ USE_CLOUD1_NORMALS
Definition: qM3C2Tools.h:29
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
qM3C2Normals::ComputationMode
ComputationMode
Normals computation mode.
Definition: qM3C2Tools.h:27
DgmOctree.h
cloudViewer::GenericProgressCallback
Definition: GenericProgressCallback.h:20
qM3C2Normals::VERT_MODE
@ VERT_MODE
Definition: qM3C2Tools.h:31
normCloud
cloudViewer::GenericIndexedCloud * normCloud
Definition: qM3C2Tools.cpp:300
NormsIndexesTableType
Array of compressed 3D normals (single index)
Definition: ecvAdvancedTypes.h:21
ecvMainAppInterface
Main application interface (for plugins)
Definition: ecvMainAppInterface.h:24
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
qM3C2Normals::USE_CORE_POINTS_NORMALS
@ USE_CORE_POINTS_NORMALS
Definition: qM3C2Tools.h:33
qM3C2Normals::DEFAULT_MODE
@ DEFAULT_MODE
Definition: qM3C2Tools.h:28
qM3C2Normals::MakeNormalsHorizontal
static void MakeNormalsHorizontal(NormsIndexesTableType &normsCodes)
Makes all normals horizontal.
Definition: qM3C2Tools.cpp:429
qM3C2Normals
M3C2 normals computation related tools.
Definition: qM3C2Tools.h:22
qM3C2Tools::GuessedParams::preferredDimension
int preferredDimension
Definition: qM3C2Tools.h:79
qM3C2Tools
M3C2 generic tools.
Definition: qM3C2Tools.h:65
cloudViewer::DgmOctree
The octree structure used throughout the library.
Definition: DgmOctree.h:39
orientationCloud
cloudViewer::GenericIndexedCloud * orientationCloud
Definition: qM3C2Tools.cpp:301
qM3C2Tools::GuessedParams
M3C2 parameters that can be guessed automatically by 'probing'.
Definition: qM3C2Tools.h:78
cloudViewer::DgmOctree::NeighboursSet
std::vector< PointDescriptor > NeighboursSet
A set of neighbours.
Definition: DgmOctree.h:133
sourceCloud
ccGenericPointCloud * sourceCloud
Definition: qCanupoTools.cpp:36
qM3C2Normals::MULTI_SCALE_MODE
@ MULTI_SCALE_MODE
Definition: qM3C2Tools.h:30
corePoints
cloudViewer::GenericIndexedCloud * corePoints
Definition: qCanupoTools.cpp:35
normalScale
ccScalarField * normalScale
Definition: qM3C2Tools.cpp:44
GenericIndexedCloud.h
qM3C2Normals::UpdateNormalOrientationsWithCloud
static bool UpdateNormalOrientationsWithCloud(cloudViewer::GenericIndexedCloud *normCloud, NormsIndexesTableType &normsCodes, cloudViewer::GenericIndexedCloud *orientationCloud, int maxThreadCount=0, cloudViewer::GenericProgressCallback *progressCb=nullptr)
Definition: qM3C2Tools.cpp:346
normsCodes
NormsIndexesTableType * normsCodes
Definition: qM3C2Tools.cpp:299
qM3C2Tools::GuessedParams::normScale
double normScale
Definition: qM3C2Tools.h:80
ccScalarField
A scalar field associated to display-related parameters.
Definition: ecvScalarField.h:19