geowatch.tasks.depth.utils module¶
- geowatch.tasks.depth.utils.process_image_chunked(image, process_func, chip_size=(2048, 2048, 3), overlap=(128, 128, 0), output_dtype=<class 'numpy.uint8'>, verbose=1, sliding_window_method='kwarray')[source]¶
- Parameters:
chip_size – must be less than half of the overlap
Example
>>> from geowatch.tasks.depth.utils import * # NOQA >>> import kwimage >>> import kwarray >>> image = kwimage.ensure_float01(kwimage.grab_test_image(dsize=(512, 512))) >>> nan_poly = kwimage.Polygon.random(rng=None).scale(image.shape[0]) >>> image = nan_poly.fill(image.copy(), np.nan) >>> process_func = lambda x: kwimage.gaussian_blur(x, sigma=7).mean(axis=2) >>> non_chunked = process_func(image) >>> chip_size = (128, 128, 3) >>> overlap = (32, 32, 0) >>> output_dtype = np.uint8 >>> verbose = 0 >>> print('kwarray') >>> result1 = process_image_chunked(image, process_func, chip_size, overlap, output_dtype, verbose=1, sliding_window_method='kwarray') >>> print('dask') >>> result2 = process_image_chunked(image, process_func, chip_size, overlap, output_dtype, verbose=1, sliding_window_method='dask') >>> # xdoctest: +REQUIRES(--show) >>> import kwplot >>> kwplot.autompl() >>> kwplot.imshow(image, pnum=(1, 3, 1), doclf=True) >>> kwplot.imshow(result1, pnum=(1, 3, 2), title='kwarray') >>> kwplot.imshow(result2, pnum=(1, 3, 3), title='dask')