-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathball_pre_classifier_upper_cam.h
55 lines (42 loc) · 1.61 KB
/
ball_pre_classifier_upper_cam.h
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
49
50
51
52
53
54
55
#ifndef BALL_OBJECT_DETECTOR_H
#define BALL_OBJECT_DETECTOR_H
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
#include "ball_detector.h"
#include "ball_feature_extractor.h"
#include "base_detector.h"
#include "field_border_detector.h"
#include "htwk_vision_config.h"
#include "integral_image.h"
#include "object_hypothesis.h"
#include "tfliteexecuter.h"
namespace htwk {
/**
* @brief The BallObjectDetector class detects the ball as a object via a neural net
*/
class BallPreClassifierUpperCam : public BallDetector {
public:
BallPreClassifierUpperCam(int8_t* lutCb, int8_t* lutCr, BallFeatureExtractor* featureExtractor, HtwkVisionConfig& config);
~BallPreClassifierUpperCam() override = default;
void proceed(const uint8_t* img, std::shared_ptr<FieldBorderDetector> fieldBorderDetector, std::vector<ObjectHypothesis>& hypoList);
const std::optional<ObjectHypothesis>& getBall() const override {
return bestBallHypothesis;
}
// This is used by the machine learning tools. This must not be used in the firmware!
const std::vector<ObjectHypothesis>& getRatedBallHypotheses() const override {
return ratedBallHypotheses;
}
const std::vector<ObjectHypothesis>& getAllHypothesesWithProb() const override {
return allHypothesesWithProb;
}
private:
std::optional<ObjectHypothesis> bestBallHypothesis;
std::vector<ObjectHypothesis> ratedBallHypotheses;
std::vector<ObjectHypothesis> allHypothesesWithProb;
BallFeatureExtractor* featureExtractor;
TFLiteExecuter tflite;
};
} // namespace htwk
#endif // BALL_OBJECT_DETECTOR_H