a question about "createTextureMesh"

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

a question about "createTextureMesh"

Letiantian
Hello, everyone! I have a question to ask!
In rtabmap_0_18_0, the "createTextureMesh" function is defined in the following:

pcl::TextureMesh::Ptr RTABMAP_EXP createTextureMesh(
                const pcl::PolygonMesh::Ptr & mesh,
                const std::map<int, Transform> & poses,
                const std::map<int, std::vector<CameraModel> > & cameraModels,
                const std::map<int, cv::Mat> & cameraDepths,
                float maxDistance = 0.0f, // max camera distance to polygon to apply texture
                float maxDepthError = 0.0f, // maximum depth error between reprojected mesh and depth image to texture a face (-1=disabled, 0=edge length is used)
                float maxAngle = 0.0f, // maximum angle between camera and face (0=disabled)
                int minClusterSize = 50, // minimum size of polygons clusters textured
                const std::vector<float> & roiRatios = std::vector<float>(), // [left, right, top, bottom] region of interest (in ratios) of the image projected.
                const ProgressState * state = 0,
                std::vector<std::map<int, pcl::PointXY> > * vertexToPixels = 0);

My question is:
the input image "cameraDepths" is a depth image (gray scale image), so the output "textureMesh" is not colored! Right? If so, how can I add color to the "textureMesh"? Could you please give me some suggestions if you are familiar with it?Thanks very much!
Reply | Threaded
Open this post in threaded view
|

Re: a question about "createTextureMesh"

matlabbe
Administrator
Hi,

It may be confusing, but this function doesn't actually create the final textured mesh, but create the structure with uv coordinates for all images before creating the corresponding textures. The depth images are optional, they are used to limit the texture projection to mesh where the depth from mesh matches the one in the depth image. This avoids projecting texture of an object behind the object if the mesh is simplified (or cut the corners).

In general, the function is followed by util3d::mergeTextures(). See usage in this example.

EDIT: For 0.18.0, see this version of that example.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: a question about "createTextureMesh"

Letiantian
This post was updated on .
Hello, Matlabbe.
Thanks very much!
    Is there any c++ code of mesh texturing for computing a sharp and accurate texture to color the mesh?
Or could you please give me some suggestions?
    Many codes on the website www.github.com can not be  compiled or excuted, other codes only give a
binary program.
Reply | Threaded
Open this post in threaded view
|

Re: a question about "createTextureMesh"

matlabbe
Administrator
Hi,

Not sure on which system you are, on Ubuntu it should be not too difficult to build rtabmap, see Installation instructions. Still, if you have difficulty to build the project and want just to try rtabmap-export app with a database, see this docker example: https://github.com/introlab/rtabmap/wiki/Multi-Session-Mapping-with-RTAB-Map-Tango#example-with-docker
On Windows, you can have the latest binaries here including rtabmap-export tool: https://ci.appveyor.com/project/matlabbe/rtabmap/branch/master/artifacts

rtabmap-export is actually the example I referred in my previous post.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: a question about "createTextureMesh"

Letiantian
You mean, we can color the mesh and add the texture to the mesh with the example (https://github.com/introlab/rtabmap/blob/f9e818c900104e4f10c6a2c55494acce000161ee/tools/Export/main.cpp#L425-L480), right?
Reply | Threaded
Open this post in threaded view
|

Re: a question about "createTextureMesh"

matlabbe
Administrator
With that example you referred, we can texture the mesh with camera rgb images. To just get the colored mesh, see that example instead.