[Radiance-general] Getting number of pixels for fisheye view

Lars O. Grobe akilog at nus.edu.sg
Mon Feb 2 20:35:27 PST 2009


So of course I ran into that problem of having perfectly black surfaces 
in my field of view. If ever anyone needs a way to get around this, here 
is my solution for now, using nothing but primitive text processing (and 
I am sure that the grep line could be written nicer):

N_PIXELS=`vwrays fisheye.hdr | grep -v -c "0.00000e+00 0.00000e+00 
0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00"`

So I feed my image (fisheye.hdr) into vwray, which will produce 
viewpoint/direction vectors for each pixel. For pixels that are outside 
the view, it writes out three times zero. Grep -c counts those, but grep 
-v -c counts the lines NOT containing the six zero expressions. And this 
is the number of pixels inside my image's view.

Maybe someone finds it useful one day.

CU Lars.



More information about the Radiance-general mailing list