9 int main(
int argc,
char** argv) {
14 std::string nnPath(BLOB_PATH);
19 camId = std::stoi(argv[1]);
21 nnPath = std::string(argv[2]);
35 xin->setStreamName(
"nn_in");
39 nn->setBlobPath(nnPath);
41 xin->setMaxDataSize(300 * 300 * 3);
46 nn->out.link(xout->input);
49 cv::VideoCapture webcam(camId);
60 auto tensor = std::make_shared<dai::RawBuffer>();
83 vector<Detection> dets;
87 if(detData.size() > 0) {
89 while(detData[i * 7] != -1.0f) {
91 d.label = detData[i * 7 + 1];
92 d.score = detData[i * 7 + 2];
93 d.x_min = detData[i * 7 + 3];
94 d.y_min = detData[i * 7 + 4];
95 d.x_max = detData[i * 7 + 5];
96 d.y_max = detData[i * 7 + 6];
102 for(
const auto& d : dets) {
103 int x1 = d.x_min * frame.cols;
104 int y1 = d.y_min * frame.rows;
105 int x2 = d.x_max * frame.cols;
106 int y2 = d.y_max * frame.rows;
108 cv::rectangle(frame, cv::Rect(cv::Point(x1, y1), cv::Point(x2, y2)), cv::Scalar(255, 255, 255));
111 printf(
"===================== %lu detection(s) =======================\n",
static_cast<unsigned long>(dets.size()));
112 for(
unsigned det = 0; det < dets.size(); ++det) {
113 printf(
"%5d | %6.4f | %7.4f | %7.4f | %7.4f | %7.4f\n",
122 cv::imshow(
"preview", frame);
124 int key = cv::waitKey(1);