Discussion:
Loading a floating-point depthmap with small range of values...
Tim Lukins
2006-05-04 12:32:34 UTC
Permalink
Dear All,

I'm a long time user of Magick - but a first time poster! Tried scanning the archives but no luck. Really banging my head off this one, so would really appreciate some help...

Here is the problem: I'm trying to load a floating point TIFF depthmap (captured from a stereo system) - so that I can then (on the command line) alter the colourmap, export in other format, etc.

I can certainly load this file with my own code (using LibTIFF) - confirming that it's TIFFTAG_BITSPERSAMPLE==32 and TIFFTAG_ROWSPERSTRIP=1. etc, etc... It's only one channel (i.e. intensity/grayscale) as well.
convert depthfile.tif -depth 32 -define quantum:format=floating-point -define tiff:rows-per-strip=1 -colorspace GRAY -normalize test.jpg
This seems happy enough, but I just end up with a totally black JPEG (or whatever)! Tried -context-stretch and -colors 255 ,etc, etc. as well.
identify -depth 32 -define quantum:format=floating-point -define tiff:rows-per-strip=1 -format "%m:%f %wx%h (depth %z with quantum %q) - type %r with %k colours" depthfile.tif
TIFF:depthfile.tif 2048x3072 (depth 16 with quantum 32) - type PseudoClassGray with 1 colours
Which hints at what I think is the problem. The floating point values in the file are in the range 1.1332 to 1.4500 (with lots of 4th precision values - because the depth is in metres). Thus, Imagemagick converts this to only 1 colour value - perhaps(?) because it expects floating-point values to range across the exponent (e.g. 1.0 - 15324.0 or some other big number).

Is this the case I wonder? And if so, how can I "rescale" my values so they are acceptable (a simple -fx 'p.intensity*100' doesn't seem to do anything)? It's like Magick has already read the file and decided to round the values to 1...

Cheers in advance!

Tim
Tim Lukins
2006-05-09 17:13:17 UTC
Permalink
Post by Tim Lukins
Here is the problem: I'm trying to load a floating point TIFF depthmap (captured from a stereo system) -
so that I can then (on the command line) alter the colourmap, export in other format, etc.
Hi -

Following up from my own posting, the very nice developers behind ImageMagick have provided an enhancement to the 6.5.7 source (see ChangeLog in distribution for entry to version 6.5.7-5).

For the record (in case anyone else ever hits this), it accommodates a floating-point TIFF file with known min/max values from X to Y (i.e. some potentially very small range).
Post by Tim Lukins
convert -define quantum:minimum=X -define quantum:maximum=Y input.tif output.png
Perfect for viewing/converting depthmap files with units in metres (as I have).

A fantastic, quick response to my problem which completely solves it!

Tim

Loading...