You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's assume I have the following dummy .ply file:
ply
format ascii 1.0
element vertex 3
property float x
property float y
property float z
property uchar blue
property uchar green
property uchar red
end_header
1 2 3 200 201 202
4 5 6 203 204 205
7 8 9 206 207 208
Please note the order of blue, green and red properties.
Then, I want to load this information into a pre-made structure an external library imposes on me, the peculiarity being that it represents color values encoded in memory in a specific order. You can read this issue in a twofold manner: either order is BGR in the .ply file and RGB in my custom structure, or order is RGB in the .ply and BGR in said structure.
In other words, the order of properties in the .ply file differs from the order of properties as represented in memory by the structure, let's name it float3 in the example below. My attempt to circumvent this scenario is to request said properties in the order expected by float3:
structfloat3 { float red, green, blue; }; // RGB
tinyply::PlyFile file;
// boilerplate omitted, we open a .ply file with color properties encoded as BGRauto rgb = file.request_properties_from_element("vertex", {"red", "green", "blue"});
// now load `rgb` into an instance of `float3`
I'd expect tinyply to parse the .ply in the order specified in request_properties_from_element, which is what I ultimately want to memcpy into my float3 structure. However, tinyply reads actual blue values as red and viceversa, simply following the order of properties in the .ply file.
The text was updated successfully, but these errors were encountered:
As a workaround, I resorted to requesting individual color properties, i.e.:
auto r = file.request_properties_from_element("vertex", {"red"});
auto g = file.request_properties_from_element("vertex", {"green"});
auto b = file.request_properties_from_element("vertex", {"blue"});
// now, memcpy those values individually into the `float3` structure
Let's assume I have the following dummy .ply file:
Please note the order of
blue
,green
andred
properties.Then, I want to load this information into a pre-made structure an external library imposes on me, the peculiarity being that it represents color values encoded in memory in a specific order. You can read this issue in a twofold manner: either order is BGR in the .ply file and RGB in my custom structure, or order is RGB in the .ply and BGR in said structure.
In other words, the order of properties in the .ply file differs from the order of properties as represented in memory by the structure, let's name it
float3
in the example below. My attempt to circumvent this scenario is to request said properties in the order expected byfloat3
:I'd expect tinyply to parse the .ply in the order specified in
request_properties_from_element
, which is what I ultimately want tomemcpy
into myfloat3
structure. However, tinyply reads actualblue
values asred
and viceversa, simply following the order of properties in the .ply file.The text was updated successfully, but these errors were encountered: