dlpy.images.ImageTable.as_random_patches

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

Generate random patches from the images in the ImageTable

Parameters:
random_ratio : double, optional

Specifies the proportion of the generated patches to output.

x : int, optional

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

y : int, optional

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

width : int, optional

Specifies the width of the patches.

height : int, optional

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

step_size : int, optional

Specifies the step size of the moving windows for extracting the patches. If not specified, it will be set to be equal to width.

output_width : int, optional

Specifies the output width of the patches. If not specified, it will be set to be equal to width.

output_height : int, optional

Specifies the output height of the patches. If not specified, it will be set to be equal to height.

inplace : bool, optional

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

Returns:
ImageTable

If inplace=True

None

If inplace=False

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_table.as_random_patches(
...     random_ratio=0.5,
...     x=0,
...     y=0,
...     width=100,
...     height=100,
...     step_size=100,
...     inplace=False
... )
>>> patches.show()