|
21 | 21 |
|
22 | 22 | # Image Cutout function replaces a rectangular section of an image with a constant value. |
23 | 23 | # |
| 24 | +# .. code-block:: python |
| 25 | +# |
| 26 | +# >>> import numpy as np |
| 27 | +# >>> from systemds.context import SystemDSContext |
| 28 | +# >>> from systemds.operator.algorithm import img_cutout_linearized |
| 29 | +# >>> |
| 30 | +# >>> with SystemDSContext() as sds: |
| 31 | +# ... img = sds.from_numpy( |
| 32 | +# ... np.array([[ 50., 100., 150., |
| 33 | +# ... 150., 200., 250., |
| 34 | +# ... 250., 200., 200. ]], dtype=np.float32) |
| 35 | +# ... ) |
| 36 | +# ... result_img = img_cutout_linearized(img, 2, 2, 1, 1, 25.0, 3, 3).compute() |
| 37 | +# ... print(result_img.reshape(3, 3)) |
| 38 | +# [[ 50. 100. 150.] |
| 39 | +# [150. 25. 250.] |
| 40 | +# [250. 200. 200.]] |
| 41 | +# |
| 42 | +# |
24 | 43 | # INPUT: |
25 | 44 | # --------------------------------------------------------------------------------------------- |
26 | | -# img_in Input images as linearized 2D matrix with top left corner at [1, 1] |
| 45 | +# img_in Input images as linearized 2D matrix with top left corner at [1, 1] (every row represents a linearized matrix/image) |
27 | 46 | # x Column index of the top left corner of the rectangle (starting at 1) |
28 | 47 | # y Row index of the top left corner of the rectangle (starting at 1) |
29 | 48 | # width Width of the rectangle (must be positive) |
30 | 49 | # height Height of the rectangle (must be positive) |
31 | | -# fill_value The value to set for the rectangle |
| 50 | +# fill_value The value to set for the rectangle |
32 | 51 | # s_cols Width of a single image |
33 | 52 | # s_rows Height of a single image |
34 | 53 | # --------------------------------------------------------------------------------------------- |
|
0 commit comments