How to use save ply

Save the file using mesh save(“D:/mesh.ply”, Mesh::PLY); Unable to get file. But I try to use mesh save(“D:/mesh.ply”, RecFusion::Mesh::PLY); Yes.
In sdk2.2, whether to use recfusion:: mesh:: ply or mesh:: ply.
In addition, the saved model file is upside down. Is it caused by the problem of the saved function? What should I do? Please tell me, thank you.

Hello,

if you have this line in your code: using namespace RecFusion; or if your code is enclosed into RecFusion namespace,
then you can use Mesh::PLY, otherwise you need to use RecFusion::Mesh::PLY.

Do you observe mesh being flipped when loading it in RecFusion or in some other software? If in RecFusion, then we indeed internally do a flip of y and z axes due to historical reasons.

Best regards,
Olga

I can already get the saved file, but your SDK automatically flips when saving the file. Please tell me what I should do. I have been waiting for you for a long time.

Another problem is that the model displayed in the meshviewer is not upside down, but the model is tilted. It is not upright. I stand alone. After reconstruction, the whole person is tilted. Is it also because of your internal processing problems?

You can easily modify the mesh and flip it before saving like this:

Mesh m;
...
for(int i =0; i < m.vertexCount(); i++)
{
    auto vertex = m.vertex(i);
    m.setVertex(vertex.x, vertex.y, -vertex.z);

    auto normal = m.normal(i);
    m.setNormal(normal.x, normal.y, -normal.z);
}

As for the model being tilted: this means that your bounding box was set up wrong

According to the code you sent, there is no way to use it in the example. I hope you can try debugging in the sample code.
I copied this code and updated it to save the file. It reported an error. There is no way to compile and debug. There is a problem with the grammar.
In addition, “…” What does this mean?
Finally, we should use “mesh m;” Or should I use “mesh mesh;”

x. Y, Z need parameters? Or just vertex x,vertex. y,vertex. z


Look at my screenshot code, is that right? Then compile the code directly? Or do you want to add x, y, Z to the parameter value?
If you can, I hope you can give me a sample code? Because this bug bothers me, I can’t launch the program now.

This was just a pseudocode. By three dots I meant a placeholder for your code, just remove them. Also remove Mesh m. And use mesh instead of m in your code.

So replace what you pasted there with this:

for(int i =0; i < mesh.vertexCount(); i++)
{
    auto vertex = mesh.vertex(i);
    mesh.setVertex(i, Mesh::Coordinate({vertex.x, vertex.y, -vertex.z}));

    auto normal = mesh.normal(i);
    mesh.setNormal(i, Mesh::Coordinate({normal.x, normal.y, -normal.z}));
}

This problem has not been solved. I have sent you an email. Please check the file and reply to the email. This bug is too serious. I failed to solve it by using the method you told me. I also attached the picture to the email.

I tried to use the method you told me to copy the code you sent, but it is still not possible. The generated file results are still upside down. I think it seems that the Z axis is upside down.I hope you can try it.I use sdk2.2

Just do the same inversion of y axis. Here is the updated code. Also beware that before showing this mesh in the viewer you need to repeat the inversion.

for(int i =0; i < mesh.vertexCount(); i++)
{
    auto vertex = mesh.vertex(i);
    mesh.setVertex(i, Mesh::Coordinate({vertex.x, -vertex.y, -vertex.z}));

    auto normal = mesh.normal(i);
    mesh.setNormal(i, Mesh::Coordinate({normal.x, -normal.y, -normal.z}));
}

I found that there is another method that can be implemented by using mesh Transform.
In addition, I also want to ask how to display the visualization of the reconstructed volume box like the recomfusionpro, that is, the calibrated image. I don’t see which SDK functions can be implemented. Please tell me. thank you.

As shown in the following figure, which function should I use to implement this function.

There is no function in SDK that would display the bounding box. You need to create this code on your own.

OK, I can create it myself.
But what I want to know is whether the position of volume box creation is fixed? When XYZ is 0, is the default location of the volume box controlled by the SDK?
Because I need to know the default location of the volume box after the SDK creates it? I can move the volume box accurately.So, please tell me where the default position of the volume box is when the XYZ value is 0 after the volume box is created.

You can get the default position from ReconstructionParams::volumePosition()

I found a very serious problem. I found in the recfusion pro test that when my model is placed in the reconstruction volume, it will suddenly lose frames. I have sent you an email. Please tell me what the problem is.

@gavranovic I found a very serious problem. I found in the recfusion pro test that when my model is placed in the reconstruction volume, it will suddenly lose frames. I have sent you an email. Please tell me what the problem is.

#include <omp.h>


int n = mesh.vertexCount();
#pragma omp parallel for
for(int i =0; i< n; i++)
{…}

According to this method, it still takes a long time. The slowest time is more than 90 seconds, and when the number of point clouds is only tens of thousands.
My code is as follows: