GDAL convert

Feel free to ask any question here
Post Reply
k.pliva@seznam.cz
Posts: 1
Joined: Sat Jan 04, 2025 6:02 pm

GDAL convert

Post by k.pliva@seznam.cz »

Hey, Daniel

I'm an amateur and I don't understand most of the terms mentioned there. I didn't want to bother you with basic questions, so I spent 22 hours learning all the available tutorials and guides in the forums. Your work is admirable, even as I am an ignorant amateur I wonder at the capabilities of your program. I am drawing 3D models directly in 16bit grayscale TIFF 4000x4000(16Mpx) px. I need to convert them to mesh and back to TIFF, which has many pitfalls that I have gone through. Nevertheless, I would like to ask for your advice. The results of my research are briefly as follows.

------------------------------
TIFF to POINTCLOUD conversion
FILE-OPEN-(type raster grid *.*)
TOOLS-PROJECTION-EXPORT COORDINATES TO SF
--------------------------------------
convert POINTCLOUD to MESH
EDIT-MESH-DELAUNAY 2.5d
----------------------------------------------------
convert MESH to POINTCLOUD
EDIT-MESH-SAMPLE POINTS (points number 16 000 000 to keep 4000x4000px)
-----------------------------
convert POINTCLOUD to TIFF16bit
TOOLS-PROJECTION-RASTERIZE
ACTIVE LAYER "COORD Z"
STEP = "1" = (4000x4000px)
DIRECTION Z (check RANGE 0-65535 and adjust GDAL input range)
RASTER-EXPORT HEIGHTS to Geotiff (then convert using GDAL(OSGeo4W) to Tiff16bit)
---------------------

The problem is with the conversion to TIFF16bit. Cloudcompare only exports GeoTIFF Float64. I found a procedure to convert to 16bit standard TIFF using GDAL in OSGeo4W console. The problem is that the input range varies from file to file and I always have to find it and manually adjust it in GDAL (gdalinfo -stats) and then (-scale "INPUTRANGE" 0 65535). Automatic input scale recognition doesnot work well.

1) Can I somehow normalize the "Z" axis range output from Cloudcompare to always be 0 - 65535 so I don't have to look for it in GDAL? I have not found an option to specify the dimension and origin of the model e.g. 4000x4000x65535 and the origin X0 Y0 Z0 in center bottom, which would do this.
2) Can I somehow integrate the GDAL command directly into Cloudcompare so that the RASTER command exports not only Geotiff but also TIFF 16bit grayscale?

Thanks a lot for your great work
best regard Karel
daniel
Site Admin
Posts: 7947
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: GDAL convert

Post by daniel »

1) Well, not automatically at least... You could export the Z coordinate to a scalar field, and then use the Scalar Field 'Arithmetic' tool to shift and scale the Z values so that they fit in 0-65535. But that will require a few manual operations, so I'm not sure it's much better than you actual solution

Maybe the Python plugin would help you if you are able to create a script that does that automatically.

2) The only way would be to hack the C++ code directly. Not impossible, but you'll need to compile CC yourself (and tweak the C++ code of course)
Daniel, CloudCompare admin
Post Reply