slmsuite.holography.toolbox.window_extent#
- window_extent(window, padding_frac=0, padding_pix=0)[source]#
Find a square that covers the active region of the 2D boolean mask
window.- Parameters:
window (numpy.ndarray<bool> (height, width)) – Boolean mask.
padding_frac (float) – If this default window has width
wand heighth,padding_fracproportionally changes these dimensions all sides. For instance,padding_frac=.5would modify the dimensions to bew = 1.5wandh = 1.5h.padding_pix (float) – Additional padding to add, in pixels. This is applied after
padding_frac.
- Returns:
window_extent – A rectangle that centered on the active region of
windowin the format(x, w, y, h)where(x, y)is the upper left coordinate, and(w, h)define the extent. This result is clipped to be withinshapeof the window.- Return type:
(int, int, int, int)