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:

Typedefs

typedef QSharedPointer< cloudViewer::ReferenceCloud > _Region
 
typedef std::vector< _Region > _RegionSet
 
typedef std::vector< _RegionSet > SetOfRegionSet
 
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 ccPointCloud * ComputeKmeansClustering (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

◆ _RegionSet

typedef std::vector<_Region> _RegionSet

◆ 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

◆ SetOfRegionSet

typedef std::vector<_RegionSet> SetOfRegionSet

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

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.

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.

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)

References count, ccPointCloud::getPointColor(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), ecvColor::MAX, rgb, 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)

References ecvColor::RgbTpl< Type >::b, count, ecvColor::RgbTpl< Type >::g, ccPointCloud::getPointColor(), ecvColor::MAX, 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.

◆ GetKeyCluster()

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

◆ Inside()

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

◆ 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.

References a, cloudViewer::DistanceComputationTools::computeCloud2CloudDistances(), cloudViewer::DistanceComputationTools::Cloud2CloudDistancesComputationParams::kNNForLocalModel, cloudViewer::DistanceComputationTools::Cloud2CloudDistancesComputationParams::maxSearchDist, ccPointCloud::partialClone(), and result.

◆ ShowDurationNow()

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

References CVLog::Print().

Variable Documentation

◆ Min

const unsigned Min = 2
static

◆ TD

const double TD = 2.0
static

Referenced by ccPlane::SetQuadTexture().

◆ TNN

const unsigned TNN = 1
static

◆ TPP

const double TPP = 2.0
static

◆ TRR

const double TRR = 2.0
static