towhee.hub.builtin.operators.computer_vision.image_resize

class towhee.hub.builtin.operators.computer_vision.image_resize(dsize=None, fx=None, fy=None, interpolation=None)[source]

Bases: object

resize an image.

Parameters:
  • dsize ((int, int), optional) – target image size. Defaults to None.

  • fx (float, optional) – scale factor for x axis. Defaults to None.

  • fy (float, optional) – scale factor for y axis. Defaults to None.

  • interpolation (str|int, optional) – interpolation method, see detailed document for cv2.resize. Defaults to None.

Returns:

output image.

Return type:

ndarray

Examples:

>>> from towhee.functional import DataCollection
>>> dc = (
...     DataCollection.range(5)
...         .tensor_random(shape=[100, 100, 3])
...         .image_resize(dsize=[10, 10], interpolation='nearest')
... )
>>> dc.select['shape']().as_raw().to_list()
[(10, 10, 3), (10, 10, 3), (10, 10, 3), (10, 10, 3), (10, 10, 3)]

Methods

Attributes

metainfo

__call__(*args, **kws)

Call self as a function.

__init__(dsize=None, fx=None, fy=None, interpolation=None)[source]