raytools.imagetools

functions for translating from mappers to hdr

raytools.imagetools.array_uv2ang(imarray)[source]
raytools.imagetools.hdr_uv2ang(imgf, outf=None, stdout=False, **kwargs)[source]
raytools.imagetools.array_ang2uv(imarray, vm=None)[source]
raytools.imagetools.hdr_ang2uv(imgf, useview=True, outf=None, stdout=False, **kwargs)[source]
raytools.imagetools.array_rotate(imarray, ang, center=None, rotate_first=True, fill_value=None, nearest=False)[source]

rotate and center a angular fisheye image array

Parameters:
  • imarray (np.array) – ([optional 3 color], width, height)

  • ang (float) – rotation angle in degrees

  • center (tuple, optional) – new pixel center (in orginal coordinates)

  • rotate_first (bool, optional) – order of rotate/center. true is rotate first.

  • fill_value (optional) – passed to scipy.RegularGridInterpolator

Return type:

corrected np.array

raytools.imagetools.array_solid2ang(imarray, nearest=False, reverse=False, viewangle=180, returnvm=True)[source]
raytools.imagetools.hdr_solid2ang(imgf, outf=None, nearest=False, stdout=False, reverse=False, viewangle=None, **kwargs)[source]
raytools.imagetools.hdr_rotate(imgf, outf=None, rotate=0.0, center=None, rotate_first=True, nearest=False, stdout=False, **kwargs)[source]
raytools.imagetools.hdr2vol(imgf, vm=None, color=False)[source]
raytools.imagetools.vf_to_vm(view)[source]

view file to ViewMapper

raytools.imagetools.img_size(imgf)[source]
raytools.imagetools.hdr2vm(imgf, vpt=False)[source]

hdr to ViewMapper

raytools.imagetools.gather_strays(pvol, peakt, cosrad)[source]
raytools.imagetools.find_peak(v, o, l, scale=179, peaka=6.7967e-05, peakt=100000.0, peakr=4, blurtol=0.75, peakc=1.0, peakrad=4.0, findsecondary=False, blursun=False, vlambda=(0.265, 0.67, 0.065))[source]
raytools.imagetools.normalize_peak(v, o, l, scale=179, peaka=6.7967e-05, peakt=100000.0, peakr=4, blursun=False, blurtol=0.75, returnall=True, peakc=1.0, peakrad=4.0, returnparts=False, keepzeros=False, findsecondary=False, vlambda=(0.265, 0.67, 0.065))[source]

consolidate the brightest pixels represented by v, o, l up into a single source, correcting the area while maintaining equal energy

Parameters:
  • v (np.array) – shape (N, 3), direction vectors of pixels (x, y, z) normalized

  • o (np.array) – shape (N,), solid angles of pixels (steradians)

  • l (np.array) – shape (N,), luminance of pixels

  • scale (Union[float, int], optional) – scale factor for l to convert to cd/m^2, default assumes radiance units

  • peaka (float, optional) – area to aggregate to

  • peakt (Union[float, int], optional) – lower threshold for possible bright pixels

  • peakr (Union[float, int], optional) – ratio, from peak pixel value to lowest value to include when aggregating partially visible sun.

  • peakc (float, optional) – correct peak value for expected energy (use with photos)

  • peakrad (float, optional) – distance tolerance (as factor of radius) for peak pixel collection

  • blursun (bool, optional) – whether to correct area and luminance according to human PSF

  • blurtol (float, optional) – when checking for sun visibility this enables an averaging of near peak values whick could be an artifact from pfilt. set to 1 to disable.

  • returnall (bool, optional) – if true, return complete v, o, l. if false, only return peak

  • returnparts (bool, optional) – supercedes return all, return pvol, v, o, l

  • keepzeros (bool, optional) – zero at lums of source rays, but keep in return value

Returns:

  • pvol (tuple)

  • v (np.array) – shape (N, 3), direction vectors of pixels (x, y, z) normalized

  • o (np.array) – shape (N,), solid angles of pixels (steradians)

  • l (np.array) – shape (N,), luminance of pixels

raytools.imagetools.imgmetric(imgf, metrics, peakn=False, scale=179, lumrgb=None, threshold=2000.0, lowlight=False, **peakwargs)[source]