POV-Ray : Newsgroups : povray.binaries.utilities : Looking for a 16bit heightfield to logarithmic converter : Re: Looking for a 16bit heightfield to logarithmic converter Server Time: 23 Jul 2019 12:20:22 GMT
  Re: Looking for a 16bit heightfield to logarithmic converter  
From: Mike Williams
Date: 18 Dec 2003 18:12:55
Wasn't it Mike Williams who wrote:
>Wasn't it Mike Williams who wrote:
>>Wasn't it anidon who wrote:
>>>I use POVRAY to make images of straylight in optical systems.  The very low
>>>intensity parts of the image are the most interesting.  Although the
>>>information is present in the red/green image it is not visually
>>>intelligible. It would be nice to have a POV output file format that was
>>>logarithmic - but otherwise a *.exe utility which inputs the heightfield
>>>and outputs an image file which is proportional to the log ( decimal or
>>>natural )of 1 to 65535.
>>>
>>>Is anyone able and willing and sufficiently interested to create one and
>>>publish it?
>>
>>
>>If you have an image processing program that accepts Adobe-compatible
>>plugins, then I can let you have a plugin that will perform such
>>processing. Windows only. I've tried testing it on a dark HF_gray_16 TGA
>>file, and it seems to be doing the right sort of thing, but I don't have
>>any images that are in any way improved by being logarithmised and the
>>output looks pretty naff until I perform additional contrast and
>>brightness processing.
>>
>>If you don't have an image processing program that accepts Adobe-
>>compatible plugins, then it's possible to do it for free with Irfanview,
>>by installing "8BF-Filters.dll" from the Irfanview plugins page, which
>>allows Irfanview to run Adobe-compatible plugins.
>
>I've now put the plugin on my website
>
>http://www.econym.demon.co.uk/plugins/index1.htm
>
>There seems to be a bit of a problem if you use the plugin with Paint
>Shop Pro 8. I can't find any way to persuade PSP8 to save the data in
>HF_Grey_16 format that's accepted by POV as a heightfield after
>processing. It seems to be OK under Irfanview and PSP7.
>
>I currently use the following rules (when my "Scale" parameter is left
>at zero):
>
>For 8-bit grey output: output=loge(input)*23.0832
>
>For HF_Grey_16 output: output=loge(input)*5909
>
>[These magic numbers were chosen such that the max input value of 65535
>maps to the max output value (255 and 65535 respectively)]
>
>I could easily change it to use other rules if you'd like. Or I could
>write one that applies Gamma correction from HF_Grey_16 to HF_Grey_16.
>

Oops.

There turned out to be a bit of a glitch in my plugin. The system I used
is documented as having 32-bit arithmetic, but in practice numbers
higher than 32767 were turning negative. Since I was dealing with 16-bit
greyscales, I needed to handle numbers up to 65535.

It's fixed now, but if you grabbed a version below v1.2, then expect it
to only work with dark images, like the ones I initially tested it with.

I've added a second plugin for linearly adjusting the brightness and
contrast of a HF_grey_16 image. It's actually a bit pointless because
you can achieve the same effects by linearly translating and scaling the
height_field in POV. It did, however, clue me in to the  bug in the
first plugin.

I've now moved my HF plugins to a separate page of their own, since most
plugin users would be unlikely to be interested in them:

http://www.econym.demon.co.uk/plugins/hf.htm

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.