dlpy.images.ImageTable.as_patches

ImageTable.as_patches(x=0, y=0, width=None, height=None, step_size=None, output_width=None, output_height=None, inplace=True)

Generate patches from the images in the ImageTable

Parameters:
x : int, optional

Specify the x location of the top-left corner of the first patches.

y : int, optional

Specify the y location of the top-left corner of the first patches.

width : int, optional

Specify the width of the patches.

height : int, optional

Specify the width of the patches. If not specified, height will be set to be equal to width.

step_size : int, optional

Specify the step size of the moving windows for extracting the patches. Default : None, meaning step_size=width.

output_width : int, optional

Specify the output width of the patches. If not equal to width, the patches will be resize to the output width. Default : None, meaning output_width=width.

output_height : int, optional

Specify the output height of the patches. If not equal to height, the patches will be resize to the output height. Default : None, meaning output_height=height.

inplace : bool, optional

Specifies whether to update the original table, or create a new one.

Returns:
ImageTable

If inplace=False

None

If inplace=True

Examples

>>> from swat import CAS
>>> from dlpy.images import ImageTable
>>> s=CAS("cloud.example.com", 5570)
>>> img_tbl=ImageTable.load_files(s, "/path/to/images", caslib="CASUSER(user)")
>>> patches =img_tbl.as_patches(
...     x=0,
...     y=0,
...     width=100,
...     height=100,
...     step_size=100,
...     inplace=False
... )
>>> patches.show()