#include "depthai/depthai.hpp"
std::shared_ptr<dai::Device> device;
void start(const dai::Pipeline& pipeline) {
device = std::make_shared<dai::Device>(pipeline);
}
void stop() { device->close(); }
dai::Pipeline getPipeline() {
// Create pipeline
dai::Pipeline pipeline;
// Define source and output
auto camRgb = pipeline.create<dai::node::ColorCamera>();
auto xoutRgb = pipeline.create<dai::node::XLinkOut>();
xoutRgb->setStreamName("rgb");
// Properties
camRgb->setPreviewSize(300, 300);
camRgb->setBoardSocket(dai::CameraBoardSocket::RGB);
camRgb->setResolution(
dai::ColorCameraProperties::SensorResolution::THE_1080_P);
camRgb->setInterleaved(false);
camRgb->setColorOrder(dai::ColorCameraProperties::ColorOrder::RGB);
// Linking
camRgb->preview.link(xoutRgb->input);
return pipeline;
}
int main() {
start(getPipeline());
std::cout << "Connected cameras: ";
for(const auto& cam : device->getConnectedCameras()) {
std::cout << cam << " ";
}
std::cout << std::endl;
// Print USB speed
std::cout << "Usb speed: " << device->getUsbSpeed() << std::endl;
// Bootloader version
if(device->getBootloaderVersion()) {
std::cout << "Bootloader version: " << device->getBootloaderVersion()->toString() << std::endl;
}
/*
*
* */
stop();
}