GeneratePlyFile - Ply 3D files generation¶
Generate a 3D Ply file from a DEM and a color image.
Detailed description¶
The application converts an image containing elevations into a PLY file, which is a file format to store 3D models. This format is adpated for visualization on software such as MeshLab [2] or CloudCompare [3]
This application is part of the stereo reconstruction framework. The input data can be produced by the application DisparityMapToElevationMap.
- There are two types of supported input images:
- A DEM image, with a ground projection, containing elevation values. Each elevation value can be considered as a 3D point.
- A 3D grid image, containing 5 bands (the first 3 are the 3D coordinates of each point, the 5th is a validity mask where valid values are larger or equal to 1)
The user shall also give a support image that contains color values for each 3D point. The color values will be embedded in the PLY file.
Parameters¶
This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is GeneratePlyFile .
[1] | Table: Parameters table for Ply 3D files generation. |
Parameter Key | Parameter Name | Parameter Type |
---|---|---|
indem | The input DEM image | Input image |
mode | Conversion Mode | Choices |
mode dem | DEM | Choice |
mode 3dgrid | 3D grid | Choice |
map | Output Cartographic Map Projection | Choices |
map utm | Universal Trans-Mercator (UTM) | Choice |
map lambert2 | Lambert II Etendu | Choice |
map lambert93 | Lambert93 | Choice |
map wgs | WGS 84 | Choice |
map epsg | EPSG Code | Choice |
map.utm.zone | Zone number | Int |
map.utm.northhem | Northern Hemisphere | Boolean |
map.epsg.code | EPSG Code | Int |
incolor | The input color image | Input image |
out | The output Ply file | Output File name |
inxml | Load otb application from xml file | XML input parameters file |
outxml | Save otb application to xml file | XML output parameters file |
The input DEM image: The image should be either a projected DEM or a 3D grid containing 3D point coordinates and a validity mask.
Conversion Mode Available choices are:
- DEM: DEM conversion mode (the projection information of the DEM is used to derive the X and Y coordinates of each point).
- 3D grid: 3D grid conversion mode.
Output Cartographic Map Projection: Parameters of the output map projection to be used. Available choices are:
- Universal Trans-Mercator (UTM): A system of transverse mercator projections dividing the surface of Earth between 80S and 84N latitude.
- Zone number: The zone number ranges from 1 to 60 and allows defining the transverse mercator projection (along with the hemisphere).
- Northern Hemisphere: The transverse mercator projections are defined by their zone number as well as the hemisphere. Activate this parameter if your image is in the northern hemisphere.
- Lambert II Etendu: This is a Lambert Conformal Conic projection mainly used in France.
- Lambert93: This is a Lambert 93 projection mainly used in France.
- WGS 84: This is a Geographical projection.
- EPSG Code: This code is a generic way of identifying map projections, and allows specifying a large amount of them. See www.spatialreference.org to find which EPSG code is associated to your projection;.
- EPSG Code: See www.spatialreference.org to find which EPSG code is associated to your projection.
The input color image: If the color image has 4 bands it will be interpreted as Red, Green, Blue, NIR. In other cases, only the first one is used (gray scale colors). The color values are expected in the range 0 - 255, and will be embedded with each 3D point of the PLY file.
The output Ply file: The output Ply file will contain as many 3D points as pixels in the input DEM.
Load otb application from xml file: Load otb application from xml file.
Save otb application to xml file: Save otb application to xml file.
Example¶
To run this example in command-line, use the following:
otbcli_GeneratePlyFile -indem image_dem.tif -out out.ply -incolor image_color.tif
To run this example from Python, use the following code snippet:
#!/usr/bin/python
# Import the otb applications package
import otbApplication
# The following line creates an instance of the GeneratePlyFile application
GeneratePlyFile = otbApplication.Registry.CreateApplication("GeneratePlyFile")
# The following lines set all the application parameters:
GeneratePlyFile.SetParameterString("indem", "image_dem.tif")
GeneratePlyFile.SetParameterString("out", "out.ply")
GeneratePlyFile.SetParameterString("incolor", "image_color.tif")
# The following line execute the application
GeneratePlyFile.ExecuteAndWriteOutput()
Limitations¶
The input DEM image has to entirely fit into memory.
Authors¶
This application has been written by OTB-Team.
See Also¶
- These additional resources can be useful for further information: