I apologize should I abuse the forum. I haven't seen any forums for C++ depthai discussions.
Here is my problem:
Using an OAK-D I'm trying to get a depth and a color video stream. Just adding the color stream to the stereo_example.cpp causes a run time error:
`terminate called after throwing an instance of 'std::runtime_error'
what(): Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'left' (X_LINK_ERROR)'
I'm on depth-ai v2.0.0 and this are the changes in stereo_example.cpp
`diff --git a/examples/src/stereo_example.cpp b/examples/src/stereo_example.cpp
index c6eb236..6973433 100644
--- a/examples/src/stereo_example.cpp
+++ b/examples/src/stereo_example.cpp
@@ -18,6 +18,7 @@ int main(){
dai::Pipeline p;
auto colorCam = p.create<dai::node::ColorCamera>();
+ auto xoutColor = p.create<dai::node::XLinkOut>();
auto monoLeft = p.create<dai::node::MonoCamera>();
auto monoRight = p.create<dai::node::MonoCamera>();
@@ -29,6 +30,8 @@ int main(){
auto xoutRectifL = p.create<dai::node::XLinkOut>();
auto xoutRectifR = p.create<dai::node::XLinkOut>();
+ xoutColor->setStreamName("color");
+
// XLinkOut
xoutLeft->setStreamName("left");
xoutRight->setStreamName("right");
@@ -90,11 +93,15 @@ int main(){
monoLeft->out.link(xoutLeft->input);
monoRight->out.link(xoutRight->input);
}
+ colorCam->setResolution(dai::ColorCameraProperties::SensorResolution::THE_1080_P);
+ colorCam->video.link(xoutColor->input);
+
// CONNECT TO DEVICE
dai::Device d(p);
d.startPipeline();
+ auto colorQueue = d.getOutputQueue("color");
auto leftQueue = d.getOutputQueue("left", 8, false);
auto rightQueue = d.getOutputQueue("right", 8, false);
auto dispQueue = withDepth ? d.getOutputQueue("disparity", 8, false) : nullptr;
@@ -113,6 +120,13 @@ int main(){
cv::imshow("right", cv::Mat(right->getHeight(), right->getWidth(), CV_8UC1, right->getData().data()));
auto t5 = std::chrono::steady_clock::now();
+ auto color = colorQueue->get<dai::ImgFrame>();
+ auto frame = cv::Mat(color->getHeight() * 3 / 2, color->getWidth(), CV_8UC1, color->getData().data());
+ cv::Mat rgb(color->getHeight(), color->getWidth(), CV_8UC3);
+ cv::cvtColor(frame, rgb, cv::COLOR_YUV2BGR_NV12);
+ cv::imshow("color", rgb);
+
+
if (withDepth) {
// Note: in some configurations (if depth is enabled), disparity may output garbage data
auto disparity = dispQueue->get<dai::ImgFrame>();