# Hdrgen, defining viewing angle when generating HDRs

**URL:** <https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889>\
**Category:** Uncategorized\
**Created:** [April 8, 2022, 1:45pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889 "2022-04-08T13:45:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![NimaForouzandeh](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@NimaForouzandeh](https://discourse.radiance-online.org/u/NimaForouzandeh)\
**Post date:** [April 8, 2022, 1:45pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/1 "2022-04-08T13:45:39Z")

</div>

Hi all,  
I use the following line of code to create an HDR from a series of LDRs taken by a DSLR camera with a fish-eye lens.

`hdrgen IMG_*.JPG -r response_function.rsp -o test.hdr`  
in the header of the output HDR file I get the following information about the view angles:

> VIEW= -vtv -vh 132.699707 -vv 113.398345

This is actually not true, and the viewing angle for this lens and camera is around 184.5 according to the measurements.  
This apparently causes problems when using Evalglare:

> header contains a perspective view type definition !!!  
> stopping…!!!

My questions are:

1. What could be the source of these assumptions about the viewing angles?
2. Is there any way to define the measured view angles to prevent this while generating HDR?

Nima

---

<div class="post-metadata">

**Author:** ![Greg\_Ward](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/greg_ward/32/471_2.png) [@Greg\_Ward](https://discourse.radiance-online.org/u/Greg_Ward)\
**Post date:** [April 8, 2022, 3:08pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/2 "2022-04-08T15:08:49Z")

</div>

The view angles computed by hdrgen are based on a perspective camera model. Fisheye lenses do not obey this default (-vtv) model, so that is why the angles are inaccurate.

You can replace the view string with corrected parameters using the latest (HEAD) release of Radiance and the new getinfo -r option, like so:

```auto
getinfo -r "VIEW= -vta -vh 180 -vv 180" < test.hdr > corrected.hdr

```

However, this will not be quite right, since your image is non-square. If you know the exact dimensions of the circular area in the image, you can use the new rcrop tool (see [post](https://discourse.radiance-online.org/t/calibration-of-hdr-image/5848/4)) in combination with getinfo like so:

```auto
rcrop 20 210 900 900 test.hdr | getinfo -r "VIEW= -vta -vh 180 -vv 180" > corrected.hdr

```

I’m making up the first 4 numbers, since I don’t know what row in the image marks the top of the circle (20) or what column marks the left of it (210). The third and fourth #rows and #columns should be the same for a square result, but I don’t know the size of yours.

Note that the rcrop tool and the getinfo -r option are both recent additions based on requests for the care and feeding of evalglare.

Cheers,  
-Greg

---

<div class="post-metadata">

**Author:** ![NimaForouzandeh](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@NimaForouzandeh](https://discourse.radiance-online.org/u/NimaForouzandeh)\
**Post date:** [April 9, 2022, 7:24pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/3 "2022-04-09T19:24:12Z")

</div>

Thanks, Greg,

It worked perfectly,

Kind regards,  
Nima

---

<div class="post-metadata">

**Author:** ![Jan\_Wienold](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/jan_wienold/32/472_2.png) [@Jan\_Wienold](https://discourse.radiance-online.org/u/Jan_Wienold)\
**Post date:** [April 10, 2022, 10:39am UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/4 "2022-04-10T10:39:36Z")

</div>

just make sure you use the 184.5° for both -vv and -vh , except you cut away the 2.25° on right, left,top and bottom each. I find it easier to keep the 184.5° in the header, evalglare is calculating all angles according to the header and considers only the 180° for any evaluation.  
In case the only use of the image is evalglare, you can provide also the viewing angles to it without changing header (evalglare -vv 184.5 -vh 184.5 -vta … ). However, having the right header in the image is always the better solution, especially in terms of documentation and later re-use of the image.  
cheers  
Jan

---

<div class="post-metadata">

**Author:** ![NimaForouzandeh](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@NimaForouzandeh](https://discourse.radiance-online.org/u/NimaForouzandeh)\
**Post date:** [April 10, 2022, 6:21pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/5 "2022-04-10T18:21:13Z")

</div>

Helpful comment Jan, Thanks.  
The view angle of our camera itself is 184.5° according to our measurements. Would you still suggest putting 184.5 for evalglare calculations?

Best,  
Nima

---

<div class="post-metadata">

**Author:** ![Jan\_Wienold](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/jan_wienold/32/472_2.png) [@Jan\_Wienold](https://discourse.radiance-online.org/u/Jan_Wienold)\
**Post date:** [April 10, 2022, 8:37pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/6 "2022-04-10T20:37:14Z")

</div>

well, if you have a 5.20m long room, do you model it with 5m? I dont understand your question - the header of the image describes the optics of your lens and if you have 184.5° why putting then 180° ? If you do so, all calculations are slightly deviating.  
Jan

---

<div class="post-metadata">

**Author:** ![NimaForouzandeh](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@NimaForouzandeh](https://discourse.radiance-online.org/u/NimaForouzandeh)\
**Post date:** [April 10, 2022, 10:14pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/7 "2022-04-10T22:14:06Z")

</div>

There was a small misunderstanding on my side when reading your first comment, it is all clear now.

Thanks,  
Nima

---

<div class="post-metadata">

**Author:** ![Greg\_Ward](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/greg_ward/32/471_2.png) [@Greg\_Ward](https://discourse.radiance-online.org/u/Greg_Ward)\
**Post date:** [April 10, 2022, 11:17pm UTC](https://discourse.radiance-online.org/t/hdrgen-defining-viewing-angle-when-generating-hdrs/5889/8 "2022-04-10T23:17:20Z")

</div>

Actually, I misread your first post, so it was all my fault!

-G
