Skip to content

add pva test#132

Open
charliehuang09 wants to merge 1 commit intomainfrom
test-pva
Open

add pva test#132
charliehuang09 wants to merge 1 commit intomainfrom
test-pva

Conversation

@charliehuang09
Copy link
Collaborator

ty JC! :)

ty JC! :)

Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Copilot AI review requested due to automatic review settings March 15, 2026 05:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new integration-test executable intended to exercise NVIDIA VPI AprilTag detection on either the CPU or PVA backend using an input image.

Changes:

  • Introduces pva_test.cc, a standalone VPI/OpenCV AprilTag detection + pose estimation runner that writes an annotated output image.
  • Updates the integration test CMake to build and link the new pva_test executable.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/test/integration_test/pva_test.cc New VPI/OpenCV-based AprilTag detection tool for CPU/PVA backends.
src/test/integration_test/CMakeLists.txt Adds pva_test executable target and links it with required libraries.

You can also share your feedback on Copilot code review. Take the survey.


cv::Mat outImage =
DrawAprilTags(img, outDetections, outPoses, numDetections);
imwrite("apriltag_detections_" + strBackend + ".png", outImage);
Comment on lines +234 to +256
CHECK_STATUS(vpiImageLockData(imgGrayscale, VPI_LOCK_READ, // NOLINT
VPI_IMAGE_BUFFER_HOST_PITCH_LINEAR,
&imgData));

VPIAprilTagDetection* outDetections = // NOLINT
(VPIAprilTagDetection*)outDetectionsData.buffer.aos.data;
VPIPose* outPoses = (VPIPose*)outPosesData.buffer.aos.data; // NOLINT
int numDetections = *outDetectionsData.buffer.aos.sizePointer;

printf("\n%d AprilTags detected\n", numDetections);

// Convert the grayscale image to BGR for visualization
cv::Mat img;
CHECK_STATUS(vpiImageDataExportOpenCVMat(imgData, &img)); // NOLINT

cv::Mat outImage =
DrawAprilTags(img, outDetections, outPoses, numDetections);
imwrite("apriltag_detections_" + strBackend + ".png", outImage);

// Done handling outputs, don't forget to unlock them.
CHECK_STATUS(vpiImageUnlock(imgGrayscale)); // NOLINT
CHECK_STATUS(vpiArrayUnlock(poses)); // NOLINT
CHECK_STATUS(vpiArrayUnlock(detections)); // NOLINT
Comment on lines +131 to +132
VPIAprilTagDecodeParams apritagDecodeParams = {NULL, 0, maxHamming, // NOLINT
family};
CHECK_STATUS(vpiImageUnlock(imgGrayscale)); // NOLINT
CHECK_STATUS(vpiArrayUnlock(poses)); // NOLINT
CHECK_STATUS(vpiArrayUnlock(detections)); // NOLINT
} catch (std::exception& e) {
#include <cstdio>
#include <cstring> // for memset
#include <iostream>
#include <sstream>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants