MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / global_scaling

Function global_scaling

src/video_mode.py:104–111  ·  view source on GitHub ↗

Normalizes objs, but uses (a, b) instead of (minimum, maximum) value of objs, if supplied

(objs, a=None, b=None)

Source from the content-addressed store, hash-verified

102
103def process_predicitons(predictions, smoothening='none'):
104 def global_scaling(objs, a=None, b=None):
105 """Normalizes objs, but uses (a, b) instead of (minimum, maximum) value of objs, if supplied"""
106 normalized = []
107 min_value = a if a is not None else min([obj.min() for obj in objs])
108 max_value = b if b is not None else max([obj.max() for obj in objs])
109 for obj in objs:
110 normalized += [(obj - min_value) / (max_value - min_value)]
111 return normalized
112
113 print('Processing generated depthmaps')
114 # TODO: Detect cuts and process segments separately

Callers 1

process_predicitonsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected