VPI - Vision Programming Interface

3.2 Release

Dynamic Remap

Dynamically remaps pixels from an input image to an output image via a user-provided map image. More...

Functions

VPIStatus vpiCreateDynamicRemap (uint64_t backends, VPIPayload *payload)
 Create a payload for Dynamic Remap algorithm. More...
 
VPIStatus vpiSubmitDynamicRemap (VPIStream stream, uint64_t backend, VPIPayload payload, VPIImage input, VPIImage output, VPIImage map, VPIInterpolationType inputInterpolation, VPIInterpolationType mapInterpolation, VPIBorderExtension border, uint64_t flags)
 Submits a Dynamic Remap operation to the stream. More...
 

Detailed Description

Dynamically remaps pixels from an input image to an output image via a user-provided map image.

It is dynamic since it allows for dynamic update of the map image, as a regular async stream ordered operation.

Refer to Dynamic Remap for more details and usage examples.

Function Documentation

◆ vpiCreateDynamicRemap()

VPIStatus vpiCreateDynamicRemap ( uint64_t  backends,
VPIPayload payload 
)

#include <vpi/algo/DynamicRemap.h>

Create a payload for Dynamic Remap algorithm.

This function allocates all resources needed by the Dynamic Remap algorithm and ties the returned payload to the given stream.

Parameters
[in]backendsVPI backends that are eligible to execute the algorithm.
[out]payloadPointer to the payload variable that receives the created handle.
  • It must not be NULL.
Return values
VPI_ERROR_INVALID_ARGUMENTpayload is NULL.
VPI_ERROR_INVALID_ARGUMENTwarpMap is NULL.
VPI_ERROR_INVALID_ARGUMENTbackends refers to an invalid backend.
VPI_ERROR_NOT_IMPLEMENTEDAlgorithm is not supported by given backends.
VPI_ERROR_INVALID_CONTEXTCurrent context is destroyed.
VPI_ERROR_OUT_OF_MEMORYCannot allocate required resources.
VPI_ERROR_INVALID_OPERATIONBackend isn't enabled in current context.
VPI_SUCCESSOperation executed successfully.

◆ vpiSubmitDynamicRemap()

VPIStatus vpiSubmitDynamicRemap ( VPIStream  stream,
uint64_t  backend,
VPIPayload  payload,
VPIImage  input,
VPIImage  output,
VPIImage  map,
VPIInterpolationType  inputInterpolation,
VPIInterpolationType  mapInterpolation,
VPIBorderExtension  border,
uint64_t  flags 
)

#include <vpi/algo/DynamicRemap.h>

Submits a Dynamic Remap operation to the stream.

The dynamic remap copies values from input to output via a map, using two sampling steps: (1) a control-point value is sampled in the map; (2) a pixel value is sampled in the input. The following formula summarizes the two sampling steps: output(i, j) = input(map(i, j)); where each sampling step has its own interpolation.

Parameters
[in]streamThe stream where the operation will be queued in.
  • It must not be NULL.
  • Stream must have enabled the backends that will execute the algorithm.
[in]backendBackend that will execute the algorithm.
  • It must be the backend specified during payload creation or 0 as a shorthand to use its backend.
[in]payloadPayload created by vpiCreateDynamicRemap.
[in]inputImage to be remapped.
[out]outputStores the remapped image.
  • It must not be NULL.
  • It must have enabled the backends that will execute the algorithm.
  • It must have the same format as input image.
  • It can have dimensions different than input and map.
[out]mapStores the mapping of output coordinates into the input image.
  • It must not be NULL.
  • It must have enabled the backends that will execute the algorithm.
  • It must have format: VPI_IMAGE_FORMAT_2F32
  • It can have dimensions different than input and output.
[in]inputInterpolationInterpolation method to be used when fetching values from input. Valid values:
[in]mapInterpolationInterpolation method to be used when fetching values from map. Valid values:
[in]borderWhat value to pick if remapped coordinates fall outside input image.
[in]flagsControl flags.
  • Valid values are a combination of one or more of the flags:
    • 0 : default operator mode, i.e. sampling aligned to pixel center, map values are absolute, denormalized positions in the input.
    • VPI_SAMPLING_ALIGNED_TO_CORNER : The sampling of pixels in continuous spatial domain may be either at top-left corner or at the center. If given, sampling occurs at the top-left corner, or else (default) sampling at the pixel center.
    • VPI_RELATIVE_MAP : If given, map values as relative offsets to be applied to each output position to fetch values from the input, or else (default) values as absolute positions in the input.
    • VPI_NORMALIZED_MAP : If given, map values as normalized in [-1, 1] range for either absolute positions or relative offsets, or else (default) map values as denormalized.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL.
VPI_ERROR_INVALID_ARGUMENTinput or map or output are NULL.
VPI_ERROR_INVALID_ARGUMENTpayload is not generated using vpiCreateDynamicRemap.
VPI_ERROR_INVALID_ARGUMENTinput and output must have the same format.
VPI_ERROR_INVALID_ARGUMENTborder not supported.
VPI_ERROR_INVALID_ARGUMENTflags has an invalid combination.
VPI_ERROR_INVALID_PAYLOAD_TYPEpayload is invalid.
VPI_ERROR_INVALID_OPERATIONThe needed backends aren't enabled in stream, input or output or map.
VPI_SUCCESSOperation executed successfully.