-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzed_inference.h
More file actions
48 lines (40 loc) · 1.4 KB
/
zed_inference.h
File metadata and controls
48 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by: https://github.com/SiBensberg
//
#ifndef ZED_INFERENCE_ZED_INFERENCE_H
#define ZED_INFERENCE_ZED_INFERENCE_H
// OpenCV includes
#include <opencv2/opencv.hpp>
// OpenCV dep
#include <opencv2/cvconfig.h>
// ZED
#include <sl/Camera.hpp>
// Object Detector
#include "object_detector.h"
//
#include <filesystem>
class ZedInference {
public:
ZedInference();
int run();
bool visualize = true;
private:
bool running;
const ObjectDetector Detector;
const std::string svo_path = "../misc/zed_raw_jetta.svo";
sl::InitParameters init_params;
sl::Mat rgb_image;
sl::Mat depth_image;
sl::Camera zed;
void grabRgbImage();
void visualizeDetections(const cv::Mat& inputImage, const std::vector<std::vector<float>> &bboxes, const std::vector<std::vector<float>> &distances);
std::vector<std::vector<float>> inferenceRgbImage(const cv::Mat &rgb_image); // returns boxes. Every vector in the vector is one Box
std::vector<std::vector<float>> calculateDepth(const std::vector<std::vector<float>>& bboxes, const sl::Mat &point_cloud);
// Colors for visualisation
const cv::Scalar BLUE = {180, 128, 0};
const cv::Scalar YELLOW = {77, 220, 255};
const cv::Scalar ORANGE = {0, 110, 250};
const cv::Scalar BIGORANGE = {60, 30, 190};
const std::vector<cv::Scalar> COLORS = {BLUE, YELLOW, ORANGE, BIGORANGE};
};
#endif //ZED_INFERENCE_ZED_INFERENCE_H