MCPcopy Create free account
hub / github.com/WebODM/WebODM / normalize

Function normalize

app/api/imageuploads.py:14–27  ·  view source on GitHub ↗

Linear normalization http://en.wikipedia.org/wiki/Normalization_%28image_processing%29

(img)

Source from the content-addressed store, hash-verified

12import numpy as np
13
14def normalize(img):
15 """
16 Linear normalization
17 http://en.wikipedia.org/wiki/Normalization_%28image_processing%29
18 """
19 arr = np.array(img).astype('float')
20
21 minval = arr.min()
22 maxval = arr.max()
23 if minval != maxval:
24 arr -= minval
25 arr *= (255.0/(maxval-minval))
26
27 return Image.fromarray(arr)
28
29class Thumbnail(TaskNestedView):
30 def get(self, request, pk=None, project_pk=None, image_filename=""):

Callers 1

getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected