ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qColorimetricSegmenter.cpp File Reference
#include "qColorimetricSegmenter.h"
#include "HSV.h"
#include "HSVDialog.h"
#include "KmeansDlg.h"
#include "QuantiDialog.h"
#include "RgbDialog.h"
#include "ScalarDialog.h"
#include <CVLog.h>
#include <ecvPointCloud.h>
#include <DistanceComputationTools.h>
#include <algorithm>
#include <map>
#include <QMainWindow>
Include dependency graph for qColorimetricSegmenter.cpp:

Go to the source code of this file.

Typedefs

typedef QSharedPointer< cloudViewer::ReferenceCloud_Region
 
typedef std::vector< _Region_RegionSet
 
typedef std::vector< _RegionSetSetOfRegionSet
 
typedef std::map< size_t, std::vector< unsigned > > ClusterMap
 

Functions

static void ShowDurationNow (const std::chrono::high_resolution_clock::time_point &startTime)
 
static bool Inside (ColorCompType lower, ColorCompType value, ColorCompType upper)
 
static bool KNNRegions (ccPointCloud *basePointCloud, const _RegionSet &regions, const _Region &region, unsigned k, _RegionSet &neighbourRegions, unsigned thresholdDistance)
 KNNRegions Determines the neighboring regions of a region. More...
 
static double ColorimetricalDifference (ecvColor::Rgb c1, ecvColor::Rgb c2)
 colorimetricalDifference Compute colorimetrical difference between two RGB color values. More...
 
static ecvColor::Rgb ComputeAverageColor (const ccPointCloud &cloud, cloudViewer::ReferenceCloud *subset)
 
double ColorimetricalDifference (const ccPointCloud &basePointCloud, cloudViewer::ReferenceCloud *c1, cloudViewer::ReferenceCloud *c2)
 colorimetricalDifference compute mean colorimetrical difference between two reference clouds. The points in both clouds must be represented in RGB value. More...
 
static int FindRegion (const std::vector< _RegionSet > &container, cloudViewer::ReferenceCloud *region)
 findRegion Find a given region in a vector of reference clouds. More...
 
static bool GetKeyCluster (const ccPointCloud &cloud, size_t clusterPerDim, ClusterMap &clusterMap)
 
static ecvColor::Rgb ComputeAverageColor (const ccPointCloud &cloud, const std::vector< unsigned > &bucket)
 
static int ColorDistance (const ecvColor::Rgb &c1, const ecvColor::Rgb &c2)
 
static ccPointCloudComputeKmeansClustering (ccPointCloud *theCloud, unsigned K, int maxIterationCount)
 

Variables

static const unsigned TNN = 1
 
static const double TPP = 2.0
 
static const double TD = 2.0
 
static const double TRR = 2.0
 
static const unsigned Min = 2
 

Typedef Documentation

◆ _Region

typedef QSharedPointer<cloudViewer::ReferenceCloud> _Region

Definition at line 384 of file qColorimetricSegmenter.cpp.

◆ _RegionSet

typedef std::vector<_Region> _RegionSet

Definition at line 385 of file qColorimetricSegmenter.cpp.

◆ ClusterMap

typedef std::map<size_t, std::vector<unsigned> > ClusterMap

Generate nxnxn clusters of points according to their color value (RGB)

Parameters
cloud: the cloud which we work with
clusterPerDim: coefficient uses to split each RGB component Returns a map of nxnxn keys, for each key a vector of the points index in the partition

Definition at line 1029 of file qColorimetricSegmenter.cpp.

◆ SetOfRegionSet

typedef std::vector<_RegionSet> SetOfRegionSet

Definition at line 386 of file qColorimetricSegmenter.cpp.

Function Documentation

◆ ColorDistance()

static int ColorDistance ( const ecvColor::Rgb c1,
const ecvColor::Rgb c2 
)
static

Compute the distance between two colors /!\ the formula can be modified, here it is simple to be as quick as possible

Definition at line 1099 of file qColorimetricSegmenter.cpp.

References ecvColor::RgbTpl< Type >::b, ecvColor::RgbTpl< Type >::g, and ecvColor::RgbTpl< Type >::r.

Referenced by ComputeKmeansClustering().

◆ ColorimetricalDifference() [1/2]

double ColorimetricalDifference ( const ccPointCloud basePointCloud,
cloudViewer::ReferenceCloud c1,
cloudViewer::ReferenceCloud c2 
)

colorimetricalDifference compute mean colorimetrical difference between two reference clouds. The points in both clouds must be represented in RGB value.

Parameters
basePointCloudThe base cloud on which the reference clouds are based.
c1The first reference cloud.
c2The second reference cloud.
Returns
Colorimetrical difference.

Definition at line 537 of file qColorimetricSegmenter.cpp.

References ColorimetricalDifference(), and ComputeAverageColor().

◆ ColorimetricalDifference() [2/2]

static double ColorimetricalDifference ( ecvColor::Rgb  c1,
ecvColor::Rgb  c2 
)
static

colorimetricalDifference Compute colorimetrical difference between two RGB color values.

Parameters
c1First color value.
c2Second color value.
Returns
Colorimetrical difference.

Definition at line 480 of file qColorimetricSegmenter.cpp.

References ecvColor::RgbTpl< Type >::b, ecvColor::RgbTpl< Type >::g, and ecvColor::RgbTpl< Type >::r.

Referenced by ColorimetricalDifference().

◆ ComputeAverageColor() [1/2]

static ecvColor::Rgb ComputeAverageColor ( const ccPointCloud cloud,
cloudViewer::ReferenceCloud subset 
)
static

Compute the average color (RGB)

Parameters
cloud: cloud which contains the points
subset: subset of points Returns average color (RGB)

Definition at line 493 of file qColorimetricSegmenter.cpp.

References ecvColor::RgbTpl< Type >::b, count, ecvColor::RgbTpl< Type >::g, ccPointCloud::getPointColor(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), ecvColor::MAX, min(), ecvColor::RgbTpl< Type >::r, cloudViewer::ReferenceCloud::size(), and ecvColor::white().

Referenced by ColorimetricalDifference(), and ComputeKmeansClustering().

◆ ComputeAverageColor() [2/2]

static ecvColor::Rgb ComputeAverageColor ( const ccPointCloud cloud,
const std::vector< unsigned > &  bucket 
)
static

Compute the average color (RGB)

Parameters
cloud: cloud which contains the points
bucket: vector of indexes of points Returns average color (RGB)

Definition at line 1066 of file qColorimetricSegmenter.cpp.

References ecvColor::RgbTpl< Type >::b, count, ecvColor::RgbTpl< Type >::g, ccPointCloud::getPointColor(), ecvColor::MAX, min(), ecvColor::RgbTpl< Type >::r, and ecvColor::white().

◆ ComputeKmeansClustering()

static ccPointCloud* ComputeKmeansClustering ( ccPointCloud theCloud,
unsigned  K,
int  maxIterationCount 
)
static

◆ FindRegion()

static int FindRegion ( const std::vector< _RegionSet > &  container,
cloudViewer::ReferenceCloud region 
)
static

findRegion Find a given region in a vector of reference clouds.

Parameters
containerContainer containing all the regions.
regionRegion to search for in the vector.
Returns
The index of the region if found, -1 in the other case.

Definition at line 635 of file qColorimetricSegmenter.cpp.

◆ GetKeyCluster()

static bool GetKeyCluster ( const ccPointCloud cloud,
size_t  clusterPerDim,
ClusterMap clusterMap 
)
static

◆ Inside()

static bool Inside ( ColorCompType  lower,
ColorCompType  value,
ColorCompType  upper 
)
inlinestatic

Definition at line 43 of file qColorimetricSegmenter.cpp.

◆ KNNRegions()

static bool KNNRegions ( ccPointCloud basePointCloud,
const _RegionSet regions,
const _Region region,
unsigned  k,
_RegionSet neighbourRegions,
unsigned  thresholdDistance 
)
static

KNNRegions Determines the neighboring regions of a region.

Parameters
basePointCloudThe base cloud containing the points.
regionsThe list containing all the regions in the base cloud point.
regionThe region to compare with others.
kMax number of neighbours to find.
neighboursThe resulting nearest regions.
thresholdDistanceThe maximum distance to search for neighbors.

Definition at line 397 of file qColorimetricSegmenter.cpp.

References cloudViewer::DistanceComputationTools::computeCloud2CloudDistances(), params, ccPointCloud::partialClone(), and result.

◆ ShowDurationNow()

static void ShowDurationNow ( const std::chrono::high_resolution_clock::time_point &  startTime)
static

Definition at line 31 of file qColorimetricSegmenter.cpp.

References CVLog::Print().

Variable Documentation

◆ Min

const unsigned Min = 2
static

Definition at line 726 of file qColorimetricSegmenter.cpp.

◆ TD

const double TD = 2.0
static

Definition at line 724 of file qColorimetricSegmenter.cpp.

◆ TNN

const unsigned TNN = 1
static

Definition at line 722 of file qColorimetricSegmenter.cpp.

◆ TPP

const double TPP = 2.0
static

Definition at line 723 of file qColorimetricSegmenter.cpp.

◆ TRR

const double TRR = 2.0
static

Definition at line 725 of file qColorimetricSegmenter.cpp.