MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / apply_antialiasing_if_needed

Function apply_antialiasing_if_needed

utils/resize_right/resize_right.py:343–355  ·  view source on GitHub ↗
(interp_method, support_sz, scale_factor,
                                 antialiasing)

Source from the content-addressed store, hash-verified

341
342
343def apply_antialiasing_if_needed(interp_method, support_sz, scale_factor,
344 antialiasing):
345 # antialiasing is "stretching" the field of view according to the scale
346 # factor (only for downscaling). this is low-pass filtering. this
347 # requires modifying both the interpolation (stretching the 1d
348 # function and multiplying by the scale-factor) and the window size.
349 scale_factor = float(scale_factor)
350 if scale_factor >= 1.0 or not antialiasing:
351 return interp_method, support_sz
352 cur_interp_method = (lambda arg: scale_factor *
353 interp_method(scale_factor * arg))
354 cur_support_sz = support_sz / scale_factor
355 return cur_interp_method, cur_support_sz
356
357
358def fw_ceil(x, fw):

Callers 1

resizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected