Commit c963fede authored by David Flynn's avatar David Flynn
Browse files

attr: change RGB coding order to GBR

The GBR coding order matches the description in ISO/IEC 23001-8 for
the identity matrix (MatrixCoefficients=0).
parent 9d34012b
......@@ -68,12 +68,7 @@ public:
return data[i];
}
size_t getElementCount() const { return 3; }
T& r() { return data[0]; }
T& g() { return data[1]; }
T& b() { return data[2]; }
const T& r() const { return data[0]; }
const T& g() const { return data[1]; }
const T& b() const { return data[2]; }
T& x() { return data[0]; }
T& y() { return data[1]; }
T& z() { return data[2]; }
......
......@@ -494,9 +494,9 @@ public:
void convertRGBToYUV()
{ // BT709
for (auto& color : colors) {
const uint8_t r = color[0];
const uint8_t g = color[1];
const uint8_t b = color[2];
const uint8_t r = color[2];
const uint8_t g = color[0];
const uint8_t b = color[1];
const double y = PCCClip(
std::round(0.212600 * r + 0.715200 * g + 0.072200 * b), 0., 255.);
const double u = PCCClip(
......@@ -521,9 +521,9 @@ public:
PCCClip(round(y1 - 0.18733 * u1 - 0.46813 * v1), 0.0, 255.0);
const double b =
PCCClip(round(y1 + 1.85563 * u1 /*+ 0.00000 * v1*/), 0.0, 255.0);
color[0] = static_cast<uint8_t>(r);
color[1] = static_cast<uint8_t>(g);
color[2] = static_cast<uint8_t>(b);
color[2] = static_cast<uint8_t>(r);
color[0] = static_cast<uint8_t>(g);
color[1] = static_cast<uint8_t>(b);
}
}
......
......@@ -122,9 +122,9 @@ ply::write(
}
if (cloud.hasColors()) {
fout << "property uchar red" << std::endl;
fout << "property uchar green" << std::endl;
fout << "property uchar blue" << std::endl;
fout << "property uchar red" << std::endl;
}
if (cloud.hasReflectances()) {
fout << "property uint16 refc" << std::endl;
......@@ -396,9 +396,9 @@ ply::read(
position[2] = atof(tokens[indexZ].c_str());
if (cloud.hasColors()) {
auto& color = cloud.getColor(pointCounter);
color[0] = atoi(tokens[indexR].c_str());
color[1] = atoi(tokens[indexG].c_str());
color[2] = atoi(tokens[indexB].c_str());
color[0] = atoi(tokens[indexG].c_str());
color[1] = atoi(tokens[indexB].c_str());
color[2] = atoi(tokens[indexR].c_str());
}
if (cloud.hasReflectances()) {
cloud.getReflectance(pointCounter) =
......@@ -448,13 +448,13 @@ ply::read(
}
} else if (a == indexR && attributeInfo.byteCount == 1) {
auto& color = cloud.getColor(pointCounter);
ifs.read(reinterpret_cast<char*>(&color[0]), sizeof(uint8_t));
ifs.read(reinterpret_cast<char*>(&color[2]), sizeof(uint8_t));
} else if (a == indexG && attributeInfo.byteCount == 1) {
auto& color = cloud.getColor(pointCounter);
ifs.read(reinterpret_cast<char*>(&color[1]), sizeof(uint8_t));
ifs.read(reinterpret_cast<char*>(&color[0]), sizeof(uint8_t));
} else if (a == indexB && attributeInfo.byteCount == 1) {
auto& color = cloud.getColor(pointCounter);
ifs.read(reinterpret_cast<char*>(&color[2]), sizeof(uint8_t));
ifs.read(reinterpret_cast<char*>(&color[1]), sizeof(uint8_t));
} else if (a == indexReflectance && attributeInfo.byteCount <= 2) {
if (attributeInfo.byteCount == 1) {
uint8_t reflectance;
......
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