Commit 2c6f23ec authored by Ohji Nakagami's avatar Ohji Nakagami Committed by David Flynn
Browse files

m42538/recolour: implement recolouring method of m42141 option 2

This commit eliminates the blending of point attribute values during
the attribute transfer process used in geometry quantisation by forcing
the blending weight to be 0|1 (m42141).

m42538 also recommends to disable the bounded search of the closest
attribute from the contributing set by setting searchRange=0.  This is
reflected by a change to the software defaults and configuration.
parent b328078c
......@@ -7,5 +7,5 @@ levelOfDetailCount: 5
dist2: 85 21 5 1 0
quantizationSteps: 0 1 2 4 4
quantizationDeadZoneSizes: 0 1 2 4 4
searchRange: 2
searchRange: 0
attribute: reflectance
......@@ -7,5 +7,5 @@ levelOfDetailCount: 6
dist2: 508 127 32 8 2 0
quantizationSteps: 0 1 2 4 4 4
quantizationDeadZoneSizes: 0 1 2 4 4 4
searchRange: 2
searchRange: 0
attribute: reflectance
......@@ -7,5 +7,5 @@ levelOfDetailCount: 6
dist2: 10486 2621 655 164 41 0
quantizationSteps: 0 1 2 4 4 4
quantizationDeadZoneSizes: 0 1 2 4 4 4
searchRange: 2
searchRange: 0
attribute: reflectance
......@@ -7,5 +7,5 @@ levelOfDetailCount: 6
dist2: 317194 79299 19825 4956 1239 0
quantizationSteps: 0 1 2 4 4 4
quantizationDeadZoneSizes: 0 1 2 4 4 4
searchRange: 2
searchRange: 0
attribute: reflectance
......@@ -42,6 +42,11 @@
#include "PCCKdTree.h"
#include "PCCPointSet.h"
// The recolouring method of m42141 option2.
// NB: CE1.3 (M42538) suggests that searchRange = 0 in this case rather than
// the previous default of 2.
static const bool kUseM42141RecolourMethod2 = true;
namespace pcc {
inline bool PCCTransfertColors(const PCCPointSet3 &source, const int32_t searchRange,
......@@ -100,7 +105,9 @@ inline bool PCCTransfertColors(const PCCPointSet3 &source, const int32_t searchR
const double r = double(pointCountTarget) / double(pointCountSource);
const double delta2 = (centroid2 - centroid1).getNorm2();
const double eps = 0.000001;
if (delta2 > eps) { // centroid2 != centroid1
if (kUseM42141RecolourMethod2 || delta2 > eps) {
// when delta2 > eps: centroid2 != centroid1
double w = 0.0;
const double alpha = D2 / delta2;
const double a = H * r - 1.0;
......@@ -113,6 +120,11 @@ inline bool PCCTransfertColors(const PCCPointSet3 &source, const int32_t searchR
w = (-1.0 + sqrt(delta)) / a;
}
}
if (kUseM42141RecolourMethod2) {
w = 0.0f;
}
const double oneMinusW = 1.0 - w;
PCCVector3D color0;
for (size_t k = 0; k < 3; ++k) {
......@@ -218,7 +230,8 @@ inline bool PCCTransfertReflectances(const PCCPointSet3 &source, const int32_t s
const double delta2 = pow(centroid2 - centroid1, 2.0);
const double eps = 0.000001;
if (delta2 > eps) { // centroid2 != centroid1
if (kUseM42141RecolourMethod2 || delta2 > eps) {
// when delta2 > eps: centroid2 != centroid1
double w = 0.0;
const double alpha = D2 / delta2;
const double r = double(pointCountTarget) / double(pointCountSource);
......@@ -232,6 +245,11 @@ inline bool PCCTransfertReflectances(const PCCPointSet3 &source, const int32_t s
w = (-1.0 + sqrt(delta)) / a;
}
}
if (kUseM42141RecolourMethod2) {
w = 0.0f;
}
const double oneMinusW = 1.0 - w;
// todo(df): clipping range should be based on the input data type
const double maxValue = std::numeric_limits<uint16_t>::max();
......
......@@ -182,7 +182,7 @@ bool ParseParameters(int argc, char *argv[], Parameters &params) {
"following attribute parameters)")
("searchRange",
params_attr.searchRange, size_t(2),
params_attr.searchRange, size_t(0),
"Attribute's todo(kmammou)")
("numberOfNearestNeighborsInPrediction",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment