blur.cpp
Go to the documentation of this file.
1 #include <depthai/depthai.hpp>
2 #include <opencv2/opencv.hpp>
3 
4 constexpr int SHAPE = 300;
5 
6 int main() {
8 
9  auto camRgb = p.create<dai::node::ColorCamera>();
10  auto nn = p.create<dai::node::NeuralNetwork>();
11  auto rgbOut = p.create<dai::node::XLinkOut>();
12  auto cast = p.create<dai::node::Cast>();
13  auto castXout = p.create<dai::node::XLinkOut>();
14 
15  camRgb->setPreviewSize(SHAPE, SHAPE);
16  camRgb->setInterleaved(false);
17 
18  nn->setBlobPath(BLOB_PATH);
19 
20  rgbOut->setStreamName("rgb");
21  castXout->setStreamName("cast");
22 
23  cast->setOutputFrameType(dai::ImgFrame::Type::BGR888p);
24 
25  // Linking
26  camRgb->preview.link(nn->input);
27  camRgb->preview.link(rgbOut->input);
28  nn->out.link(cast->input);
29  cast->output.link(castXout->input);
30 
31  dai::Device device(p);
32  auto qCam = device.getOutputQueue("rgb", 4, false);
33  auto qCast = device.getOutputQueue("cast", 4, false);
34 
35  while(true) {
36  auto inCast = qCast->get<dai::ImgFrame>();
37  auto inRgb = qCam->get<dai::ImgFrame>();
38 
39  if(inCast && inRgb) {
40  cv::imshow("Blur", inCast->getCvFrame());
41  cv::imshow("Original", inRgb->getCvFrame());
42  }
43 
44  if(cv::waitKey(1) == 'q') {
45  break;
46  }
47  }
48 
49  return 0;
50 }
dai::node::XLinkOut
XLinkOut node. Sends messages over XLink.
Definition: XLinkOut.hpp:14
dai::Pipeline
Represents the pipeline, set of nodes and connections between them.
Definition: Pipeline.hpp:100
dai::node::Cast
Cast node.
Definition: Cast.hpp:14
dai::node::ColorCamera
ColorCamera node. For use with color sensors.
Definition: ColorCamera.hpp:16
dai::node::NeuralNetwork
NeuralNetwork node. Runs a neural inference on input data.
Definition: NeuralNetwork.hpp:18
dai::node::Cast::input
Input input
Definition: Cast.hpp:24
dai::node::NeuralNetwork::input
Input input
Definition: NeuralNetwork.hpp:34
dai::RawImgFrame::Type::BGR888p
@ BGR888p
dai::Device::getOutputQueue
std::shared_ptr< DataOutputQueue > getOutputQueue(const std::string &name)
Definition: Device.cpp:86
dai::node::XLinkOut::input
Input input
Definition: XLinkOut.hpp:27
depthai.hpp
dai::Pipeline::create
std::shared_ptr< N > create()
Definition: Pipeline.hpp:145
dai::ImgFrame::getCvFrame
void getCvFrame(T...)
Definition: ImgFrame.hpp:222
dai::ImgFrame
Definition: ImgFrame.hpp:25
dai::Device
Definition: Device.hpp:21
SHAPE
constexpr int SHAPE
Definition: blur.cpp:4
main
int main()
Definition: blur.cpp:6


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:18