|
VPI - Vision Programming Interface
0.1.0 Release
|
Overview
The provided samples show how the library is used in simple scenarios. Most of them accept one or more arguments specifying the backend to be used, and the images to be processed. The result is saved back to disk into the same directory.
For convenience, VPI includes sample images that can be used as input. They are located in /opt/nvidia/vpi/vpi-0.1/samples/assets and can be referred directly.
Environment Setup
Sample applications are installed in /opt/nvidia/vpi/vpi-0.1/samples.
To build the sample application these packages must be installed:
- cmake >= 3.8
- g++ or clang (tested with g++-7 and clang-7)
- OpenCV >= 3.2
For Ubuntu-18.04, install the packages by executing:
apt-get install cmake g++ libopencv-dev
The installer sets up the system to allow using VPI immediately. CMake is able to find the vpi package without additional user intervention. All header and library paths are set up correctly.
Build Instructions
From within a sample directory, execute:
The sample is built into an executable in the same directory.
Once built, execute each sample using input images, such as those included in the sample assets directory.
Sample Applications
The provided sample applications, along with instructions on how to run them, are as follows.
- Convolve 2D
- Stereo Disparity
- Harris Corners Detector
- Image Resample
- KLT Bounding Box Tracker
- Event timing
uint32_t height
Height of this plane in pixels.
struct VPIContextImpl * VPIContext
void vpiArrayDestroy(VPIArray array)
Destroy an array instance as well as all resources it owns.
VPIStatus vpiEventElapsedTime(VPIEvent start, VPIEvent end, float *msec)
Computes the elapsed time in (msec) between two completed events.
VPIStatus vpiEventCreate(uint32_t flags, VPIEvent *event)
Create an event instance with the specified flags.
VPIDeviceType
Device types.
uint32_t width
Width of this plane in pixels.
VPIStatus vpiSubmitGaussianPyramidGenerator(VPIStream stream, VPIImage input, VPIPyramid output)
Computes the Gaussian pyramid from the input image.
VPIStatus vpiArrayCreate(uint32_t capacity, VPIArrayType fmt, uint32_t flags, VPIArray *array)
Create an empty array instance with the specified flags.
VPIStatus vpiPyramidCreate(uint32_t width, uint32_t height, VPIImageType fmt, uint32_t numLevels, float scale, uint32_t flags, VPIPyramid *pyr)
Create an empty image pyramid instance with the specified flags.
VPIStatus vpiEventSync(VPIEvent event)
Blocks the calling thread until the event is completed.
VPIStatus vpiCreateStereoDisparityEstimator(VPIStream stream, uint32_t imageWidth, uint32_t imageHeight, const VPIImageType inputType, const uint32_t maxDisparity, VPIPayload *payload)
Creates payload for vpiSubmitStereoDisparityEstimator.
VPIImageType
Image formats.
float sensitivity
Specifies sensitivity threshold from the Harris-Stephens equation.
signed 16-bit grayscale/luma.
Stores a bounding box that is being tracked by KLT Tracker.
VPIBoundingBox bbox
Bounding box being tracked.
VPIStatus vpiContextCreate(uint32_t flags, VPIContext *ctx)
Create a context instance.
Stores a keypoint coordinate.
uint8_t trackingStatus
Tracking status of this bounding box.
VPIStatus vpiEventRecord(VPIEvent event, VPIStream stream)
Captures in the event the contents of the stream command queue at the time of this call.
VPIStatus vpiContextSetCurrent(VPIContext ctx)
Sets the context for the calling thread.
uint32_t rowStride
Difference in bytes of beginning of one row and the beginning of the previous.
VPIStatus vpiCreateHarrisKeypointDetector(VPIStream stream, uint32_t inputWidth, uint32_t inputHeight, VPIPayload *payload)
Creates a Harris Keypoint Detector payload.
VPIArrayType type
Type of each array element.
VPIStatus vpiArraySetSize(VPIArray array, uint32_t size)
Set the array size in elements.
VPIStatus vpiArrayUnlock(VPIArray array)
Releases the lock on array object.
VPIStatus vpiImageUnlock(VPIImage img)
Releases the lock on an image object.
Structure that defines the parameters for vpiSubmitHarrisKeypointDetector.
VPIStatus vpiStreamCreate(VPIDeviceType devType, VPIStream *stream)
Create a stream instance.
VPIStatus vpiStreamSync(VPIStream stream)
Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty)...
Stores information about image characteristics and content.
float maxScaleChange
Maximum relative scale change.
VPIStatus vpiSubmitImageResampler(VPIStream stream, VPIImage input, VPIImage output, VPIInterpolationType interpolationType, VPIBoundaryCond boundary)
Runs a generic resampling algorithm on a 2D image.
float strengthThresh
Specifies the minimum threshold with which to eliminate Harris Corner scores.
VPIStatus vpiSubmitStereoDisparityEstimator(VPIPayload payload, VPIImage left, VPIImage right, VPIImage disparity, const VPIStereoDisparityEstimatorParams *params)
Runs stereo processing on a pair of images, outputs a disparity map.
uint32_t gradientSize
Gradient window size.
uint32_t size
Number of elements in the array.
VPIStatus vpiArrayWrapHostMem(const VPIArrayData *arrayData, uint32_t flags, VPIArray *array)
Create an array object by wrapping around an existing host-memory block.
VPIKLTBoundingBoxTrackerType trackingType
Type of KLT tracking that will be performed.
VPIHomographyTransform2D element.
VPIStatus vpiSubmitHarrisKeypointDetector(VPIPayload payload, VPIImage input, VPIArray outFeatures, VPIArray outScores, const VPIHarrisKeypointDetectorParams *params)
Submits Harris Keypoint Detector operation to the stream associated with the payload.
VPIStatus vpiSubmitKLTBoundingBoxTracker(VPIPayload payload, VPIImage templateImage, VPIArray inputBoxList, VPIArray inputPredictionList, VPIImage referenceImage, VPIArray outputBoxList, VPIArray outputEstimationList, const VPIKLTBoundingBoxTrackerParams *params)
Runs KLT Tracker on two frames.
void vpiContextDestroy(VPIContext ctx)
Destroy a context instance as well as all resources it owns.
uint32_t capacity
Maximum number of elements that the array can hold.
void vpiStreamDestroy(VPIStream stream)
Destroy a stream instance and deallocate all HW resources.
Lock memory only for reading.
void * data
Points to the first element of the array.
VPIStatus vpiSubmitImageConvolver(VPIStream stream, VPIImage input, VPIImage output, const float *kernelData, uint32_t kernelWidth, uint32_t kernelHeight, VPIBoundaryCond boundary)
Runs a generic 2D convolution over an image.
VPIImagePlane planes[VPI_MAX_PLANE_COUNT]
Data of all image planes.
float minNMSDistance
Non-maximum suppression radius, set to 0 to disable it.
float width
Bounding box width.
float mat3[3][3]
3x3 homogeneous matrix that defines the homography.
float maxTranslationChange
Maximum relative translation change.
Catmull-Rom cubic interpolation.
float nccThresholdStop
Threshold to stop estimating.
void vpiImageDestroy(VPIImage img)
Destroy an image instance as well as all resources it owns.
uint8_t templateStatus
Status of the template related to this bounding box.
float height
Bounding box height.
unsigned 8-bit grayscale/luma.
VPIHomographyTransform2D xform
Defines the bounding box top left corner and its homography.
float nccThresholdKill
Threshold to consider template tracking was lost.
VPIStatus vpiCreateKLTBoundingBoxTracker(VPIStream stream, uint32_t imageWidth, uint32_t imageHeight, VPIImageType imageType, VPIPayload *payload)
Creates payload for vpiSubmitKLTBoundingBoxTracker.
struct VPIEventImpl * VPIEvent
VPIKLTTrackedBoundingBox element.
Structure that defines the parameters for vpiCreateKLTBoundingBoxTracker.
unsigned 16-bit grayscale/luma.
uint32_t windowSize
width of Census Transform window for disparity features.
struct VPIImageImpl * VPIImage
float nccThresholdUpdate
Threshold for requiring template update.
int32_t numPlanes
Number of planes.
VPIStatus vpiImageGetType(VPIImage img, VPIImageType *type)
Get the image type.
Stores information about array characteristics and content.
uint32_t blockSize
Block window size used to compute the Harris Corner score.
VPIStatus vpiImageLock(VPIImage img, VPILockMode mode, VPIImageData *hostData)
Acquires the lock on an image object and returns a pointer to the image planes Depending on the inter...
VPIImageType type
Image type.
VPIStatus vpiImageCreate(uint32_t width, uint32_t height, VPIImageType type, uint32_t flags, VPIImage *img)
Create an empty image instance with the specified flags.
All pixels outside the image are considered to be zero.
signed 8-bit grayscale/luma.
VPIStatus vpiArrayLock(VPIArray array, VPILockMode mode, VPIArrayData *arrayData)
Acquires the lock on array object and returns a pointer to array data.
VPIStatus vpiImageWrapHostMem(const VPIImageData *hostData, uint32_t flags, VPIImage *img)
Create an image object by wrapping around an existing host-memory block.
uint32_t maxDisparity
Maximum disparity for matching search.
Structure that defines the parameters for vpiCreateStereoDisparityEstimator.
struct VPIPayloadImpl * VPIPayload
A handle to an algorithm payload.
struct VPIArrayImpl * VPIArray
void vpiPayloadDestroy(VPIPayload payload)
Deallocates the payload object and all associated resources.
Lock memory for reading and writing.
VPIStatus vpiArrayInvalidate(VPIArray array)
This method is useful for unmanaged arrays only (created with 'vpiArrayWrap*`).
Inverse compositional algorithm for KLT tracker.
uint32_t numberOfIterationsScaling
Number of Inverse compositional iterations of scale estimations.
void * data
Pointer to the first row of this plane.
void vpiPyramidDestroy(VPIPyramid pyr)
Destroy an image pyramid instance as well as all resources it owns.
struct VPIStreamImpl * VPIStream
void vpiEventDestroy(VPIEvent event)
Destroy an event instance as well as all resources it owns.
struct VPIPyramidImpl * VPIPyramid
VPIStatus vpiSubmitGaussianImageFilter(VPIStream stream, VPIImage input, VPIImage output, uint32_t kernelSizeX, uint32_t kernelSizeY, float sigmaX, float sigmaY, VPIBoundaryCond boundary)
Runs a 2D Gaussian filter over an image.