Monocular Human Position Estimator
HumanDetector.hpp
Go to the documentation of this file.
1 
12 /*
13 Monocular Human Position Estimator
14 
15 Copyright © 2021
16 
17 Permission is hereby granted, free of charge, to any person obtaining a copy of
18 this software and associated documentation files (the "Software"), to deal in
19 the Software without restriction, including without limitation the rights to
20 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
21 of the Software, and to permit persons to whom the Software is furnished to do
22 so, subject to the following conditions:
23 
24 The above copyright notice and this permission notice shall be included in all
25 copies or substantial portions of the Software.
26 
27 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 SOFTWARE.
34 */
35 
36 #pragma once
37 
38 #include <vector>
39 #include <string>
40 #include <opencv2/tracking.hpp>
41 #include "../include/Detector.hpp"
42 
43 
45  public:
46  explicit HumanDetector(std::string);
47  std::vector<cv::Point3d> track_positions();
48  bool show_output();
49  std::vector<cv::Point3d> get_3d_positions();
50  double avg_human_height;
51 
52  private:
53  int tracking_edge;
54  double max_tracking_distance;
55  Detector detector;
56  cv::Mat frame;
57  std::vector<cv::Scalar> colors;
58  std::vector<cv::Point3d> detected_humans; // positions
59  std::vector<int> skipped_detections;
60  std::vector<cv::Rect2d> trackings; // bounding boxes
61  std::vector<cv::Ptr<cv::Tracker>> trackers;
62  void create_colors();
63  cv::Scalar get_color(int);
64 };
HumanDetector::HumanDetector
HumanDetector(std::string)
Default Constructor for Human Detector class.
Definition: HumanDetector.cpp:42
HumanDetector::get_3d_positions
std::vector< cv::Point3d > get_3d_positions()
Computes 3D position of detected humans by calculating the estimated distance between the object and ...
Definition: HumanDetector.cpp:87
HumanDetector::show_output
bool show_output()
Displays colored bounding boxes on an image/video feed.
Definition: HumanDetector.cpp:192
HumanDetector::track_positions
std::vector< cv::Point3d > track_positions()
Tracks detected humans and assign ids.
Definition: HumanDetector.cpp:111
HumanDetector
Definition: HumanDetector.hpp:44
Detector
Definition: Detector.hpp:49