Skip to content

Commit

Permalink
Test: Add ImageAlign depth to image test
Browse files Browse the repository at this point in the history
  • Loading branch information
SzabolcsGergely committed Nov 13, 2024
1 parent bf79ce2 commit 619e653
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions tests/src/ondevice_tests/image_align_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#include <thread>

#include "depthai/depthai.hpp"
#include "depthai/pipeline/InputQueue.hpp"

TEST_CASE("Test ColorCamera node") {
TEST_CASE("Test ImageAlign node image to image alignment") {
using namespace std;
using namespace std::chrono;
using namespace std::chrono_literals;
Expand Down Expand Up @@ -35,3 +34,36 @@ TEST_CASE("Test ColorCamera node") {
REQUIRE(aligned != nullptr);
}
}

TEST_CASE("Test ImageAlign node depth to image alignment") {
using namespace std;
using namespace std::chrono;
using namespace std::chrono_literals;

dai::Pipeline p;
auto leftCam = p.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_B);
auto rightCam = p.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_C);
auto stereo = p.create<dai::node::StereoDepth>();
auto align = p.create<dai::node::ImageAlign>();

auto leftOut = leftCam->requestOutput({1280, 800}, dai::ImgFrame::Type::NV12);
auto rightOut = rightCam->requestOutput({1280, 800}, dai::ImgFrame::Type::NV12);

leftOut->link(stereo->left);
rightOut->link(stereo->right);

stereo->depth.link(align->input);
rightOut->link(align->inputAlignTo);

auto alignedQueue = align->outputAligned.createOutputQueue();

p.start();

// Retrieve N messages
constexpr size_t N = 20;
for(size_t i = 0; i < N; ++i) {
auto aligned = alignedQueue->get<dai::ImgFrame>();

REQUIRE(aligned != nullptr);
}
}

0 comments on commit 619e653

Please sign in to comment.