Comments (20)
from poissonrecon.
from poissonrecon.
from poissonrecon.
Thank for replying so fast. I could possibly change the Material id to some properties such as roughness value (0 to 1) or glossiness etc. which can be interpolated. In that case the point would be represented as position(x,y,z), color(r,g,b), normals(nx,ny,nz) and roughness_val. Is it doable in that case? If yes, could you please give me an idea how.
Thanks,
Ahmad
from poissonrecon.
from poissonrecon.
That'll be amazing. Looking forward to your suggestion on where to make that change. Thanks a lot for the help.
from poissonrecon.
from poissonrecon.
Thanks for the detailed information. I will try it out. I'll let you know how it goes.
from poissonrecon.
Sorry about the very large reply. But I'm having trouble getting the correct output and I'm not sure where should I fix. So, I followed your comment and made these changes. I'm also not sure if it's because the roughness value is only one number and the dimension 3 is appropriate here or not.
PointStreamData.h
template <class Real, int Dim>
struct NormalColorAndRoughness
{
Point<Real, Dim> normal;
Color<Real> color;
Real roughness;
NormalColorAndRoughness(void)
{
;
}
NormalColorAndRoughness(Point<Real, Dim> n, Color<Real> c, Real rg)
: normal(n), color(c), roughness(rg)
{
;
}
NormalColorAndRoughness& operator+=(const NormalColorAndRoughness& p)
{
color += p.color, normal += p.normal, roughness += p.roughness;
return *this;
}
NormalColorAndRoughness& operator-=(const NormalColorAndRoughness& p)
{
color -= p.color, normal -= p.normal, roughness -= p.roughness;
return *this;
}
NormalColorAndRoughness& operator*=(Real s)
{
color *= s, normal *= s, roughness *= s;
return *this;
}
NormalColorAndRoughness& operator/=(Real s)
{
color /= s, normal /= s, roughness /= s;
return *this;
}
NormalColorAndRoughness operator+(const NormalColorAndRoughness& p) const
{
return NormalColorAndRoughness(
normal + p.normal, color + p.color, roughness + p.roughness);
}
NormalColorAndRoughness operator-(const NormalColorAndRoughness& p) const
{
return NormalColorAndRoughness(
normal - p.normal, color - p.color, roughness - p.roughness);
}
NormalColorAndRoughness operator*(Real s) const
{
return NormalColorAndRoughness(normal * s, color * s, roughness * s);
}
NormalColorAndRoughness operator/(Real s) const
{
return NormalColorAndRoughness(normal / s, color / s, roughness / s);
}
};
template <class Real, int Dim>
struct NormalColorAndRoughnessInfo
{
typedef NormalColorAndRoughness<Real, Dim> Type;
static Type ReadASCII(FILE* fp)
{
float n[3];
unsigned char c[3];
float rg;
if (fscanf(fp,
" %f %f %f %c %c %c %f ",
&n[0],
&n[1],
&n[2],
&c[0],
&c[1],
&c[2],
&rg) != 7)
fprintf(stderr, "[ERROR] Failed to read normal, color and roughness \n"),
exit(0);
return Type(Point<Real, Dim>(n[0], n[1], n[2]),
Color<Real>((Real)c[0], (Real)c[1], (Real)c[2]),
(Real)rg);
};
static bool ReadBinary(FILE* fp, Point<Real, Dim>& p, Type& d)
{
struct TypeOnDisk
{
Point<float, Dim> point;
Point<float, Dim> normal;
unsigned char color[3];
float rg;
};
TypeOnDisk t;
if (fread(&t, sizeof(TypeOnDisk), 1, fp) != 1) return false;
p = Point<Real, Dim>(t.point);
d.normal = Point<Real, Dim>(t.normal);
d.roughness = t.rg;
for (int c = 0; c < 3; c++) d.color[c] = (Real)t.color[c];
return true;
}
static void WriteASCII(FILE* fp, const Type& d)
{
unsigned char c[3];
SetColorValues(d.color, c);
fprintf(fp,
" %f %f %f %d %d %d %f ",
d.normal[0],
d.normal[1],
d.normal[2],
c[0],
c[1],
c[2],
d.roughness);
};
static void WriteBinary(FILE* fp, const Point<Real, Dim>& p, const Type& d)
{
struct TypeOnDisk
{
Point<float, Dim> point;
Point<float, Dim> normal;
unsigned char color[3];
float rg;
};
TypeOnDisk t;
t.point = Point<float, Dim>(p), t.normal = Point<float, Dim>(d.normal);
SetColorValues(d.color, t.color);
t.roughness = d.rg;
fwrite(&t, sizeof(TypeOnDisk), 1, fp);
}
static bool ValidPlyProperties(const bool* props)
{
return (props[0] && props[1] && props[2]) &&
((props[3] || props[6]) && (props[4] || props[7]) &&
(props[5] || props[8]) && props[9]);
}
const static PlyProperty PlyProperties[];
const static int PlyPropertyNum = 10;
template <class Vertex>
struct VertexSetter
{
static void SetValue(Vertex& v, Real w)
{
}
static void SetData(Vertex& v, const Type& nc)
{
}
};
template <bool HasNormal, bool HasValue, bool HasColor, bool HasRoughness>
struct VertexSetter<PlyVertexWithMaterial<float,
Dim,
HasNormal,
HasValue,
HasColor,
HasRoughness> >
{
typedef PlyVertexWithMaterial<float,
Dim,
HasNormal,
HasValue,
HasColor,
HasRoughness>
Vertex;
static void SetValue(Vertex& v, Real w)
{
if (HasValue) v.value() = (float)w;
}
static void SetData(Vertex& v, const Type& nc)
{
if (HasNormal) v.normal() = Point<Real, Dim>(nc.normal);
if (HasColor) SetColorValues(nc.color, v.color());
if (HasRoughness) v.roughness() = nc.roughness;
}
};
static Real ProcessDataWithConfidence(const Point<Real, Dim>& p, Type& data)
{
Real l = (Real)Length(data.normal);
if (!l || l != l) return (Real)-1.;
return l;
}
static Real ProcessData(const Point<Real, Dim>& p, Type& data)
{
Real l = (Real)Length(data.normal);
if (!l || l != l) return (Real)-1.;
data.normal /= l;
return (Real)1.;
}
struct Transform
{
Transform(const XForm<Real, Dim + 1>& xForm) : _pointXForm(xForm)
{
for (int i = 0; i < Dim; i++)
for (int j = 0; j < Dim; j++) _normalXForm(i, j) = _pointXForm(i, j);
_normalXForm = _normalXForm.transpose().inverse();
_normalXForm /= (Real)pow(fabs(_normalXForm.determinant()), 1. / Dim);
}
void operator()(Point<Real, Dim>& p, Type& nc) const
{
p = _pointXForm * p, nc.normal = _normalXForm * nc.normal;
}
protected:
XForm<Real, Dim + 1> _pointXForm;
XForm<Real, Dim> _normalXForm;
};
};
template <>
const PlyProperty NormalColorAndRoughnessInfo<float, 3>::PlyProperties[] = {
{"nx",
PLY_FLOAT,
PLY_FLOAT,
int(offsetof(Type, normal.coords[0])),
0,
0,
0,
0},
{"ny",
PLY_FLOAT,
PLY_FLOAT,
int(offsetof(Type, normal.coords[1])),
0,
0,
0,
0},
{"nz",
PLY_FLOAT,
PLY_FLOAT,
int(offsetof(Type, normal.coords[2])),
0,
0,
0,
0},
{"r",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[0])),
0,
0,
0,
0},
{"g",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[1])),
0,
0,
0,
0},
{"b",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[2])),
0,
0,
0,
0},
{"red",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[0])),
0,
0,
0,
0},
{"green",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[1])),
0,
0,
0,
0},
{"blue",
PLY_UCHAR,
PLY_FLOAT,
int(offsetof(Type, color.coords[2])),
0,
0,
0,
0},
{"rg", PLY_FLOAT, PLY_FLOAT, int(offsetof(Type, roughness)), 0, 0, 0, 0}};
template <>
const PlyProperty NormalColorAndRoughnessInfo<double, 3>::PlyProperties[] = {
{"nx",
PLY_FLOAT,
PLY_DOUBLE,
int(offsetof(Type, normal.coords[0])),
0,
0,
0,
0},
{"ny",
PLY_FLOAT,
PLY_DOUBLE,
int(offsetof(Type, normal.coords[1])),
0,
0,
0,
0},
{"nz",
PLY_FLOAT,
PLY_DOUBLE,
int(offsetof(Type, normal.coords[2])),
0,
0,
0,
0},
{"r",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[0])),
0,
0,
0,
0},
{"g",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[1])),
0,
0,
0,
0},
{"b",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[2])),
0,
0,
0,
0},
{"red",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[0])),
0,
0,
0,
0},
{"green",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[1])),
0,
0,
0,
0},
{"blue",
PLY_UCHAR,
PLY_DOUBLE,
int(offsetof(Type, color.coords[2])),
0,
0,
0,
0},
{"rg", PLY_FLOAT, PLY_FLOAT, int(offsetof(Type, roughness)), 0, 0, 0, 0}};
ply.h
///////////////////
// PlyVertWithMaterial //
///////////////////
template <class _Real,
int Dim,
bool HasNormal,
bool HasValue,
bool HasColor,
bool HasRoughness>
class PlyVertexWithMaterial
{
public:
typedef _Real Real;
protected:
static PlyProperty _Properties[];
static const int _NormalSize = HasNormal ? sizeof(Point<Real, Dim>) : 0;
static const int _ValueSize = HasValue ? sizeof(Real) : 0;
static const int _ColorSize = HasColor ? sizeof(RGBColor) : 0;
static const int _RoughnessSize = HasRoughness ? sizeof(Real) : 0;
static const int _Size =
_NormalSize + _ValueSize + _ColorSize + _RoughnessSize;
static const int _NormalOffset = 0;
static const int _ValueOffset = _NormalOffset + _NormalSize;
static const int _ColorOffset = _ValueOffset + _ValueSize;
static const int _RoughnessOffset = _ColorOffset + _RoughnessSize;
char _vertexData[_Size == 0 ? 1 : _Size];
public:
struct _PlyVertexWithMaterial
{
static const int PointCount = Dim;
static const int NormalCount = (HasNormal ? Dim : 0);
static const int ValueCount = (HasValue ? 1 : 0);
static const int ColorCount = (HasColor ? 3 : 0);
static const int RoughnessCount = (HasRoughness ? 1 : 0);
static const int Count =
NormalCount + ValueCount + ColorCount + RoughnessCount;
static const int NormalOffset = 0;
static const int ValueOffset = NormalOffset + NormalCount;
static const int ColorOffset = ValueOffset + ValueCount;
static const int RoughnessOffset = ColorOffset + RoughnessCount;
Point<Real, Count == 0 ? 1 : Count> vertexData;
Point<Real, Dim> point;
Point<Real, Dim> &normal(void)
{
return *((Point<Real, Dim> *)(&vertexData[0] + NormalOffset));
}
Real &value(void)
{
return *((Real *)(&vertexData[0] + ValueOffset));
}
Point<Real, 3> &color(void)
{
return *((Point<Real, 3> *)(&vertexData[0] + ColorOffset));
}
Real &roughness(void)
{
return *((Real *)(&vertexData[0] + RoughnessOffset));
}
const Point<Real, Dim> &normal(void) const
{
return *((Point<Real, Dim> *)(&vertexData[0] + NormalOffset));
}
const Real &value(void) const
{
return *((Real *)(&vertexData[0] + ValueOffset));
}
const Point<Real, 3> &color(void) const
{
return *((Point<Real, 3> *)(&vertexData[0] + ColorOffset));
}
const Real &roughness(void) const
{
return *((Real *)(&vertexData[0] + RoughnessOffset));
}
_PlyVertexWithMaterial(void)
{
;
}
_PlyVertexWithMaterial(Point<Real, Dim> p, Point<Real, Count> vData)
{
point = p, vertexData = vData;
}
_PlyVertexWithMaterial(PlyVertexWithMaterial p)
{
point = p.point;
if (HasNormal)
for (int i = 0; i < Dim; i++)
vertexData[NormalOffset + i] = p.normal()[i];
if (HasValue) vertexData[ValueOffset] = p.value();
if (HasRoughness) vertexData[RoughnessOffset] = p.roughness();
if (HasColor)
for (int i = 0; i < 3; i++)
vertexData[ColorOffset + i] = (Real)p.color()[i];
}
operator PlyVertexWithMaterial()
{
PlyVertexWithMaterial p;
p.point = point;
if (HasNormal)
for (int i = 0; i < Dim; i++)
p.normal()[i] = vertexData[NormalOffset + i];
if (HasValue) p.value() = vertexData[ValueOffset];
if (HasRoughness) p.roughness() = vertexData[RoughnessOffset];
if (HasColor)
for (int i = 0; i < 3; i++)
p.color()[i] = (unsigned char)std::max<int>(
0, std::min<int>(255, (int)(vertexData[ColorOffset + i] + 0.5)));
return p;
}
_PlyVertexWithMaterial &operator+=(const _PlyVertexWithMaterial &p)
{
point += p.point, vertexData += p.vertexData;
return *this;
}
_PlyVertexWithMaterial &operator-=(const _PlyVertexWithMaterial &p)
{
point -= p.point, vertexData -= p.vertexData;
return *this;
}
_PlyVertexWithMaterial &operator*=(Real s)
{
point *= s, vertexData *= s;
return *this;
}
_PlyVertexWithMaterial &operator/=(Real s)
{
point /= s, vertexData /= s;
return *this;
}
_PlyVertexWithMaterial operator+(const _PlyVertexWithMaterial &p) const
{
return _PlyVertexWithMaterial(point + p.point, vertexData + p.vertexData);
}
_PlyVertexWithMaterial operator-(const _PlyVertexWithMaterial &p) const
{
return _PlyVertexWithMaterial(point - p.point, vertexData - p.vertexData);
}
_PlyVertexWithMaterial operator*(Real s) const
{
return _PlyVertexWithMaterial(point * s, vertexData * s);
}
_PlyVertexWithMaterial operator/(Real s) const
{
return _PlyVertexWithMaterial(point / s, vertexData / s);
}
};
typedef _PlyVertexWithMaterial Wrapper;
const static int ReadComponents = Dim + (HasNormal ? Dim : 0) +
(HasValue ? 1 : 0) +
(HasRoughness ? 1 : 0) + (HasColor ? 6 : 0);
const static int WriteComponents =
Dim + (HasNormal ? Dim : 0) + (HasValue ? 1 : 0) +
(HasRoughness ? 1 : 0) + (HasColor ? 3 : 0);
static PlyProperty *Properties(void);
Point<Real, Dim> point;
Point<Real, Dim> &normal(void)
{
return *((Point<Real, Dim> *)(_vertexData + _NormalOffset));
}
Real &value(void)
{
return *((Real *)(_vertexData + _ValueOffset));
}
RGBColor &color(void)
{
return *((RGBColor *)(_vertexData + _ColorOffset));
}
Real &roughness(void)
{
return *((Real *)(_vertexData + _RoughnessOffset));
}
PlyVertexWithMaterial(void)
{
memset(_vertexData, 0, _Size);
}
PlyVertexWithMaterial(Point<Real, Dim> p) : PlyVertexWithMaterial()
{
point = p;
}
PlyVertexWithMaterial(const PlyVertexWithMaterial &v)
: PlyVertexWithMaterial()
{
point = v.point, memcpy(_vertexData, v._vertexData, _Size);
}
PlyVertexWithMaterial &operator=(const PlyVertexWithMaterial &v)
{
point = v.point, memcpy(_vertexData, v._vertexData, _Size);
return *this;
}
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
///
///
///
///
template <class Real,
int Dim,
bool HasNormal,
bool HasValue,
bool HasColor,
bool HasRoughness,
class _Real>
PlyVertexWithMaterial<Real, Dim, HasNormal, HasValue, HasColor, HasRoughness>
operator*(XForm<_Real, Dim + 1> xForm,
PlyVertexWithMaterial<Real,
Dim,
HasNormal,
HasValue,
HasColor,
HasRoughness> p)
{
PlyVertexWithMaterial<Real, Dim, HasNormal, HasValue, HasColor, HasRoughness>
_p = p;
_p.point = xForm * p.point;
if (HasNormal) _p.normal() = xForm.inverse().transpose() * p.normal();
return _p;
}
template <class Real,
int Dim,
bool HasNormal,
bool HasValue,
bool HasColor,
bool HasRoughness>
PlyProperty PlyVertexWithMaterial<
Real,
Dim,
HasNormal,
HasValue,
HasColor,
HasRoughness>::_Properties[PlyVertexWithMaterial::ReadComponents];
template <class Real,
int Dim,
bool HasNormal,
bool HasValue,
bool HasColor,
bool HasRoughness>
PlyProperty *
PlyVertexWithMaterial<Real, Dim, HasNormal, HasValue, HasColor, HasRoughness>::
Properties(void)
{
int idx = 0;
// Primary values (for writing)
int vertexDataOffset = (size_t)(&(((PlyVertexWithMaterial *)0)->_vertexData));
int pointOffset = (size_t)(&(((PlyVertexWithMaterial *)0)->point));
for (int d = 0; d < Dim; d++)
_Properties[idx++] = MakePlyProperty(PlyPositionNames[d],
PLYType<Real>(),
PLYType<Real>(),
pointOffset + sizeof(Real) * d);
if (HasNormal)
for (int d = 0; d < Dim; d++)
_Properties[idx++] =
MakePlyProperty(PlyNormalNames[d],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _NormalOffset + sizeof(Real) * d);
if (HasValue)
_Properties[idx++] = MakePlyProperty(PlyValueNames[0],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _ValueOffset);
if (HasColor)
for (int c = 0; c < 3; c++)
_Properties[idx++] = MakePlyProperty(
PlyColorNames[c],
PLYType<unsigned char>(),
PLYType<unsigned char>(),
vertexDataOffset + _ColorOffset + sizeof(unsigned char) * c);
// Alternative values (for reading or writing)
if (HasColor)
for (int c = 0; c < 3; c++)
_Properties[idx++] = MakePlyProperty(
PlyAlternateColorNames[c],
PLYType<unsigned char>(),
PLYType<unsigned char>(),
vertexDataOffset + _ColorOffset + sizeof(unsigned char) * c);
if (HasRoughness)
_Properties[idx++] = MakePlyProperty(PlyRoughnessNames[0],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _RoughnessOffset);
return _Properties;
}
template <class Real, int Dim>
using PlyVertex = PlyVertexWithMaterial<Real, Dim, false, false, false, false>;
template <class Real, int Dim>
using PlyOrientedVertex =
PlyVertexWithMaterial<Real, Dim, true, false, false, false>;
template <class Real, int Dim>
using PlyValueVertex =
PlyVertexWithMaterial<Real, Dim, false, true, false, false>;
template <class Real, int Dim>
using PlyColorVertex =
PlyVertexWithMaterial<Real, Dim, false, false, true, false>;
template <class Real, int Dim>
using PlyOrientedColorVertex =
PlyVertexWithMaterial<Real, Dim, true, false, true, false>;
template <class Real, int Dim>
using PlyColorAndValueVertex =
PlyVertexWithMaterial<Real, Dim, false, true, true, false>;
template <class Real, int Dim>
using PlyAllVertex = PlyVertexWithMaterial<Real, Dim, true, true, true, true>;
PoissonRecon.cpp
#ifdef FAST_COMPILE
static const int Degree = DEFAULT_FEM_DEGREE;
static const BoundaryType BType = DEFAULT_FEM_BOUNDARY;
typedef IsotropicUIntPack<DIMENSION,
FEMDegreeAndBType<Degree, BType>::Signature>
FEMSigs;
fprintf(
stderr,
"[WARNING] Compiled for degree-%d, boundary-%s, %s-precision _only_\n",
Degree,
BoundaryNames[BType],
sizeof(Real) == 4 ? "single" : "double");
if (!PointWeight.set)
PointWeight.value = DefaultPointWeightMultiplier * Degree;
Execute<Real,
NormalColorAndRoughnessInfo<Real, DIMENSION>,
PlyVertexWithMaterial<float, DIMENSION, true, true, true, true> >(
num_options, options, FEMSigs());
#else // !FAST_COMPILE
if (!PointWeight.set)
PointWeight.value = DefaultPointWeightMultiplier * Degree.value;
Execute<DIMENSION,
Real,
NormalColorAndRoughnessInfo<Real, DIMENSION>,
PlyVertexWithMaterial<float, DIMENSION, true, true, true, true> >(
num_options, options);
#endif // FAST_COMPILE
So, with these put in place it compiles and runs but the output is somewhat like this:
out.ply
ly
format ascii 1.0
comment *************************************************************
comment *************************************************************
comment ** Running Screened Poisson Reconstruction (Version 10.00) **
comment *************************************************************
comment *************************************************************
comment --degree 2
comment --bType 3
comment --in /home/hypevr/Poisson/PoissonReconTest/Bin/Linux/eagle.pointsout.ply
comment --depth 10
comment --out /home/hypevr/Poisson/PoissonReconTest/Bin/Linux/out.ply
comment --scale 1.100000
comment --samplesPerNode 1.000000
comment --ascii
comment --pointWeight 4.000000
comment --threads 8
comment --density
comment --iters 8
comment --data 64.000000
comment --colors
comment --tempDir /home/hypevr/Poisson/PoissonRecon/
element vertex 2101267
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float value
property uchar red
property uchar green
property uchar blue
property uchar r
element face 4202399
property list uchar int vertex_indices
end_header
-0.102389 6.97199 -1.96725 0.0270562 -0.0934122 -0.00174214 5.61052 139 134 124 139
0.194098 6.98196 -1.96725 0.0191461 -0.0913949 -0.00700025 5.74068 107 100 96 107
0.34234 7.03687 -1.96725 0.0166826 -0.0884893 -0.00972046 5.48095 120 110 105 120
0.213423 6.98797 -1.96725 0.0189661 -0.09098 -0.00735419 5.7171 109 101 98 109
-0.0282671 6.95023 -1.96725 0.0240336 -0.0926715 -0.0036984 5.74028 127 121 113 127
-0.115223 6.98797 -1.96725 0.0269436 -0.0933955 -0.00186054 5.55044 139 134 124 139
0.400588 7.06209 -1.96725 0.0144693 -0.08759 -0.0108486 5.35833 125 115 109 125
0.268219 7.00708 -1.96725 0.0182788 -0.0898554 -0.008354 5.63402 113 105 101 113
As you can see, it has a property r with the red value replicated at the end. I was expecting rg with some other values. Could you please and take a look and tell me where am I going wrong?
Thanks,
Ahmad
from poissonrecon.
from poissonrecon.
Thanks for the reply. I tried the fix but the output is still similar.
from poissonrecon.
from poissonrecon.
Thanks, I'll try to do that.
from poissonrecon.
I know it's not the right way to do it, but only for the sake of testing I changed
const static int WriteComponents =
Dim + (HasNormal ? Dim : 0) + (HasValue ? 1 : 0) +
(HasRoughness ? 1 : 0) + (HasColor ? 3 : 0);
to
const static int WriteComponents =
Dim + (HasNormal ? Dim : 0) + (HasValue ? 1 : 0) +
(HasRoughness ? 1 : 0) + (HasColor ? 6 : 0);
Although it prints all the properties but rg values are all nan.
ply
format ascii 1.0
comment *************************************************************
comment *************************************************************
comment ** Running Screened Poisson Reconstruction (Version 10.00) **
comment *************************************************************
comment *************************************************************
comment --degree 2
comment --bType 3
comment --in /home/hypevr/Poisson/PoissonReconTest/Bin/Linux/eagle.pointsout.ply
comment --depth 10
comment --out /home/hypevr/Poisson/PoissonReconTest/Bin/Linux/out.ply
comment --scale 1.100000
comment --samplesPerNode 1.000000
comment --ascii
comment --pointWeight 4.000000
comment --threads 8
comment --density
comment --iters 8
comment --data 64.000000
comment --colors
comment --tempDir /home/hypevr/Poisson/PoissonRecon/
element vertex 2101260
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float value
property uchar red
property uchar green
property uchar blue
property uchar r
property uchar g
property uchar b
property float rg
element face 4202385
property list uchar int vertex_indices
end_header
-0.102389 6.97199 -1.96725 0.0270562 -0.0934122 -0.00174213 5.61052 139 134 124 139 134 124 -nan
0.34234 7.03687 -1.96725 0.0166826 -0.0884893 -0.00972046 5.48095 120 110 105 120 110 105 -nan
0.194098 6.98196 -1.96725 0.0191461 -0.0913949 -0.00700025 5.74068 107 100 96 107 100 96 -nan
-0.0282671 6.95023 -1.96725 0.0240336 -0.0926715 -0.0036984 5.74028 127 121 113 127 121 113 -nan
0.400588 7.06209 -1.96725 0.0144693 -0.08759 -0.0108486 5.35833 125 115 109 125 115 109 -nan
-0.115224 6.98797 -1.96725 0.0269435 -0.0933955 -0.00186054 5.55044 139 134 124 139 134 124 -nan
0.213424 6.98797 -1.96725 0.0189661 -0.09098 -0.00735419 5.7171 109 101 98 109 101 98 -nan
0.0458546 6.95319 -1.96725 0.0219048 -0.0921286 -0.0051143 5.79101 118 112 106 118 112 106 -nan
0.416462 7.06925 -1.96725 0.0140666 -0.0872701 -0.0111891 5.35394 126 116 110 126 116 110 -nan
-0.116352 7.06209 -1.96725 0.0266744 -0.0931716 -0.00232576 5 139 134 124 139 134 124 -nan
0.268219 7.00708 -1.96725 0.0182788 -0.0898554 -0.008354 5.63402 113 105 101 113 105 101 -nan
Do you think there is something else that I did wrong?
from poissonrecon.
from poissonrecon.
Thanks for the reply. I can definitively send you the data. Although I probably can't do it today, but tomorrow for sure. Although it's the eagle data and I just put rg and all 1 at the end of each vertices for testing. I will upload it tomorrow.
from poissonrecon.
Here's the data. Thanks.
eagle.pointsout.zip
from poissonrecon.
Thank you very much. It worked. Also, for the offset correction, I have made the following changes,
static const int _NormalOffset = 0;
static const int _ValueOffset = _NormalOffset + _NormalSize;
static const int _RoughnessOffset = _ValueOffset + _ValueSize;
static const int _ColorOffset = _RoughnessOffset + _RoughnessSize;
static const int NormalOffset = 0;
static const int ValueOffset = NormalOffset + NormalCount;
static const int RoughnessOffset = ValueOffset + ValueCount;
static const int ColorOffset = RoughnessOffset + RoughnessCount;
bool HasRoughness>
PlyProperty *
PlyVertexWithMaterial<Real, Dim, HasNormal, HasValue, HasColor, HasRoughness>::
Properties(void)
{
int idx = 0;
// Primary values (for writing)
int vertexDataOffset = (size_t)(&(((PlyVertexWithMaterial *)0)->_vertexData));
int pointOffset = (size_t)(&(((PlyVertexWithMaterial *)0)->point));
for (int d = 0; d < Dim; d++)
_Properties[idx++] = MakePlyProperty(PlyPositionNames[d],
PLYType<Real>(),
PLYType<Real>(),
pointOffset + sizeof(Real) * d);
if (HasNormal)
for (int d = 0; d < Dim; d++)
_Properties[idx++] =
MakePlyProperty(PlyNormalNames[d],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _NormalOffset + sizeof(Real) * d);
if (HasValue)
_Properties[idx++] = MakePlyProperty(PlyValueNames[0],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _ValueOffset);
if (HasRoughness)
_Properties[idx++] = MakePlyProperty(PlyRoughnessNames[0],
PLYType<Real>(),
PLYType<Real>(),
vertexDataOffset + _RoughnessOffset);
if (HasColor)
for (int c = 0; c < 3; c++)
_Properties[idx++] = MakePlyProperty(
PlyColorNames[c],
PLYType<unsigned char>(),
PLYType<unsigned char>(),
vertexDataOffset + _ColorOffset + sizeof(unsigned char) * c);
// Alternative values (for reading or writing)
if (HasColor)
for (int c = 0; c < 3; c++)
_Properties[idx++] = MakePlyProperty(
PlyAlternateColorNames[c],
PLYType<unsigned char>(),
PLYType<unsigned char>(),
vertexDataOffset + _ColorOffset + sizeof(unsigned char) * c);
return _Properties;
}
Now the output is exactly as I expected.
element vertex 2101264
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float value
property float rg
property uchar red
property uchar green
property uchar blue
element face 4202393
property list uchar int vertex_indices
end_header
-0.102389 6.97199 -1.96725 0.0270562 -0.0934122 -0.00174214 5.61051 1 139 134 124
0.34234 7.03687 -1.96725 0.0166826 -0.0884893 -0.00972046 5.48095 1 120 110 105
0.194098 6.98196 -1.96725 0.0191461 -0.0913949 -0.00700025 5.74068 1 107 100 96
-0.115223 6.98797 -1.96725 0.0269436 -0.0933954 -0.00186054 5.55044 1 139 134 124
-0.0282671 6.95023 -1.96725 0.0240336 -0.0926714 -0.0036984 5.74028 1 127 121 113
0.400588 7.06209 -1.96725 0.0144693 -0.08759 -0.0108486 5.35833 1 125 115 109
0.213424 6.98797 -1.96725 0.0189661 -0.09098 -0.00735419 5.7171 1 109 101 98
0.0458546 6.95319 -1.96725 0.0219048 -0.0921286 -0.0051143 5.79101 1 118 112 106
-0.116352 7.06209 -1.96725 0.0266744 -0.0931716 -0.00232576 5 1 139 134 124
0.268219 7.00708 -1.96725 0.0182788 -0.0898554 -0.008354 5.63402 1 113 105 101
0.416462 7.06925 -1.96725 0.0140666 -0.0872701 -0.0111891 5.35394 1 126 116 110
0.119976 6.96406 -1.96725 0.0203401 -0.0917198 -0.00617167 5.79393 1 112 105 101
0.490584 7.10234 -1.96725 0.0120416 -0.0856962 -0.0129241 5.32321 1 132 121 114
from poissonrecon.
I want to do the same thing with Surface Trimmer. I haven't started that yet. So, I'd like to keep this issue open till I finish that because I believe it's related.
from poissonrecon.
So, I changed PlyColorAndValueVertex to PlyAllVertex as defined in Ply.h
template <class Real, int Dim>
using PlyVertex = PlyVertexWithMaterial<Real, Dim, false, false, false, false>;
template <class Real, int Dim>
using PlyOrientedVertex =
PlyVertexWithMaterial<Real, Dim, true, false, false, false>;
template <class Real, int Dim>
using PlyValueVertex =
PlyVertexWithMaterial<Real, Dim, false, true, false, false>;
template <class Real, int Dim>
using PlyColorVertex =
PlyVertexWithMaterial<Real, Dim, false, false, true, false>;
template <class Real, int Dim>
using PlyOrientedColorVertex =
PlyVertexWithMaterial<Real, Dim, true, false, true, false>;
template <class Real, int Dim>
using PlyColorAndValueVertex =
PlyVertexWithMaterial<Real, Dim, false, true, true, false>;
template <class Real, int Dim>
using PlyAllVertex = PlyVertexWithMaterial<Real, Dim, true, true, true, true>;
in SurfaceTrimmer.cpp as
bool readFlags[PlyAllVertex<float, DIMENSION>::ReadComponents];
if (!PlyReadHeader(In.value,
PlyAllVertex<float, DIMENSION>::Properties(),
PlyAllVertex<float, DIMENSION>::ReadComponents,
readFlags))
fprintf(stderr, "[ERROR] Failed to read ply header: %s\n", In.value),
exit(0);
bool hasValue = readFlags[DIMENSION];
bool hasColor = (readFlags[DIMENSION + 1] || readFlags[DIMENSION + 4]) &&
(readFlags[DIMENSION + 2] || readFlags[DIMENSION + 5]) &&
(readFlags[DIMENSION + 3] || readFlags[DIMENSION + 6]);
if (!hasValue)
fprintf(stderr, "[ERROR] Ply file does not contain values\n"), exit(0);
if (hasColor)
return Execute<PlyAllVertex<float, DIMENSION> >();
else
return Execute<PlyValueVertex<float, DIMENSION> >();
And it works. Thanks a lot for your help. I am closing the issue.
from poissonrecon.
Related Issues (20)
- Real-time monitoring memory HOT 2
- How does work the Point <Real, Dim> struct HOT 4
- Failed to build with default libjpeg,libpng, and libz. HOT 1
- How to get the number of points corresponding to an octree node HOT 8
- sln is incorrect HOT 1
- Normals - inward or outward? HOT 1
- Can we conclude a leaf node is fully inside the object if indicator function evaluations on its faces come out above the iso-value? HOT 4
- SSD Recon with Dirichelet boundary condition HOT 2
- PLY file not supported HOT 3
- Envelope Generation in PoissonRecon Integration with CloudCompare HOT 4
- PoissonRecon: Interaction between `--width` and `--depth` parameters is not well documented HOT 2
- using --exact in PoissonRecon.exe HOT 5
- A problem running with vs2019 HOT 1
- the program crushed with empty file write error message. HOT 2
- Segmentation Fault for create_from_point_cloud_poisson when n_threads is not 1.
- question about SurfaceTrimmer HOT 1
- a question about adaptive solvers HOT 3
- A question about compile v2/v3/v4 source code HOT 4
- Failed to Build : W10 VS2017 HOT 19
- A question about how to get the iso value in V1 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poissonrecon.