ResizeCropConvertReformat

cvcuda.resize_crop_convert_reformat()
cvcuda.resize_crop_convert_reformat(src: nvcv.Tensor,

resize_dim: tuple[int,int], interp: cvcuda.Interp, crop_rect: nvcv.RectI, *, layout: str = “”, data_type: nvcv.Type = 0, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[nvcv.cuda.Stream] = None) -> nvcv.Tensor

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters
  • src (nvcv.Tensor) – Input tensor containing one or more images.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • crop_rect (nvcv.RectI) – Crop rectangle, (top, left, width, height), specifying the top-left corner and width & height dimensions of the region to crop from the resized images.

  • layout (string, optional) – String specifying output tensor layout (e.g., ‘NHWC’ or ‘CHW’). Empty string (default) indicates output tensor layout copies input.

  • data_type (nvcv.Type, optional) – Data type of output tensor channel (e.g., uint8 or float). 0 (default) indicates output tensor data type copies input.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns

The output tensor.

Return type

nvcv.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resizeCropConvertReformat(src: nvcv.ImageBatchVarShape,

resize_dim: tuple[int,int],

interp: cvcuda.Interp, crop_rect: nvcv.RectI, *, layout: str = “”, data_type: nvcv.Type = 0, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[nvcv.cuda.Stream] = None) -> nvcv.Tensor

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters
  • src (nvcv.ImageBatchVarShape) – Input image batch containing one or more images of varying sizes, but all images must have the same data type, channels, and layout.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • crop_rect (nvcv.RectI) – Crop rectangle, (top, left, width, height), specifying the top-left corner and width & height dimensions of the region to crop from the resized images.

  • layout (string, optional) – String specifying output tensor layout (e.g., ‘NHWC’ or ‘CHW’). Empty string (default) indicates output tensor layout copies input.

  • data_type (nvcv.Type, optional) – Data type of output tensor channel (e.g., uint8 or float). 0 (default) indicates output tensor data type copies input.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns

The output tensor.

Return type

nvcv.Tensor

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resize_crop_convert_reformat_into()
cvcuda.resize_crop_convert_reformat_into(dst: nvcv.Tensor,

src: nvcv.Tensor, resize_dim: tuple[int,int], interp: cvcuda.Interp, cropPos: tuple[int,int], *, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[nvcv.cuda.Stream] = None)

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters
  • dst (nvcv.Tensor) – Output tensor to store the result of the operation. Output tensor also specifies the crop dimensions (i.e., width & height), as well as the output data type (e.g., uchar3 or float) and tensor layout (e.g., ‘NHWC’ or ‘NCHW’).

  • src (nvcv.Tensor) – Input tensor containing one or more images.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • cropPos (tuple[int,int]) – Crop position, (top, left), specifying the top-left corner of the region to crop from the resized images. The crop region’s width and height is specified by the output tensor’s width & height.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns

None

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.

cvcuda.resize_crop_convert_reformat_into(dst: nvcv.Tensor,

src: nvcv.ImageBatchVarShape, resize_dim: tuple[int,int], interp: cvcuda.Interp, cropPos: tuple[int,int], *, manip: cvcuda.ChannelManip = cvcuda.ChannelManip.NO_OP, scale: float = 1.0, offset: float = 0.0, srcCast: bool = True, stream: Optional[nvcv.cuda.Stream] = None)

Executes the ResizeCropConvertReformat operation on the given cuda stream.

See also

Refer to the CV-CUDA C API reference for the ResizeCropConvertReformat operator for more details and usage examples.

Parameters
  • dst (nvcv.Tensor) – Output tensor to store the result of the operation. Output tensor also specifies the crop dimensions (i.e., width & height), as well as the output data type (e.g., uchar3 or float) and tensor layout (e.g., ‘NHWC’ or ‘NCHW’).

  • src (nvcv.ImageBatchVarShape) – Input image batch containing one or more images of varying sizes, but all images must have the same data type, channels, and layout.

  • resize_dim (tuple[int,int]) – Dimensions, width & height, of resized tensor (prior to cropping).

  • interp (cvcuda.Interp) – Interpolation type used for resizing. Currently, only cvcuda.Interp.NEAREST and cvcuda.Interp.LINEAR are available.

  • cropPos (tuple[int,int]) – Crop position, (top, left), specifying the top-left corner of the region to crop from the resized images. The crop region’s width and height is specified by the output tensor’s width & height.

  • manip (cvcuda.ChannelManip, optional) – Channel manipulation (e.g., shuffle RGB to BGR). NO_OP (default) indicates output tensor channels are unchanged.

  • scale (float, optional) – Scale (i.e., multiply) the output values by this amount. 1.0 (default) results in no scaling of the output values.

  • offset (float, optional) – Offset (i.e., add to) the output values by this amount. This is applied after scaling. Let v be a resized and cropped value, then v * scale + offset is final output value. 0.0 (default) results in no offset being added to the output.

  • srcCast (bool, optional) – Boolean indicating whether or not the resize interpolation results are re-cast back to the input (or source) data type. Refer to the C API reference for more information. True (default) re-cast resize interpolation results back to the source data type.

  • stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.

Returns

None

Caution

Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.