Open
Conversation
ty JC! :) Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Contributor
There was a problem hiding this comment.
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_testexecutable.
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ty JC! :)