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

Function process

app/raster_utils.py:265–289  ·  view source on GitHub ↗
(arr, skip_rescale=False, skip_background=False, skip_type=False, mask=None, includes_alpha=True, drop_last_band=False)

Source from the content-addressed store, hash-verified

263
264
265 def process(arr, skip_rescale=False, skip_background=False, skip_type=False, mask=None, includes_alpha=True, drop_last_band=False):
266 if not skip_rescale and rescale is not None:
267 if includes_alpha:
268 arr[:-1, :, :] = linear_rescale(arr[:-1, :, :], in_range=rescale)
269 else:
270 arr = linear_rescale(arr, in_range=rescale)
271 if not skip_background and (mask is not None or includes_alpha):
272 if mask is not None:
273 background = mask==0
274 elif includes_alpha:
275 background = arr[-1]==0
276 if includes_alpha:
277 arr[:-1, :, :][:, background] = jpg_background
278 else:
279 arr[:, background] = jpg_background
280 if not skip_type and rgb and arr.dtype != np.uint8:
281 if includes_alpha:
282 arr[-1][arr[-1] > 255] = 255
283
284 arr = arr.astype(np.uint8)
285
286 if drop_last_band:
287 return arr[:-1, :, :]
288 else:
289 return arr
290
291 def update_rgb_colorinterp(dst):
292 if with_alpha:

Callers 1

export_rasterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected