[Radiance-general] Adding view information to hdr files

Thomas Bleicher tbleicher at googlemail.com
Mon Jun 29 00:35:23 PDT 2009


On Mon, Jun 29, 2009 at 3:06 AM, Lars O. Grobe<grobe at gmx.net> wrote:
> Hi Greg,
>
> thank you for again surprising us with a new tool. Unfortunately this one is
> again in the good old tradition of conflicting with vi (well, I am really
> curious how many commands I type lead me to that little editor)...

That's not quite correct. 'vinfo' is a true and proper Greg-style csh script
that strips the binary part from the image and shows you only the header
in the editor - which is vi. If you call the tool without image all you get
is an editor window without content. In 'vim' this shows a greeting message
which you probably saw.

In fact if you have 'vim' I think you can edit the image headers directly,
without splitting the binary bits. I think I did that before.

> The reason I was asking is that I am working on full-frame fisheye hdr
> images as they are expected e.g. by findglare and evalglare. These images do
> not have any view information included, and I am trying to add this missing
> part of information.

Unfortunately I haven't actually done a script yet (just manual testing) but
what I will need to do is adding view lines to Sketchup images. I found that
in Ruby or Python you can just use something like

view = "VIEW= -vta -vp 3.5 4.5 1.5 ..."
img = file("mypic.hdr").read()
img.sub("\n\n", "%s\n\n" % view)
newfile = file("newpic.hdr", 'w').write(img)
newfile.close()

Basically you just replace the two newline characters at the end of
the header with a "VIEW=" line followed by 2 newlines. (I hope this
is proper Python code - haven't used it in a while).

Thomas



More information about the Radiance-general mailing list