Monocular Human Position Estimator
Detector.hpp
Go to the documentation of this file.
1 
13 /*
14 Monocular Human Position Estimator
15 
16 Copyright © 2021
17 
18 Permission is hereby granted, free of charge, to any person obtaining a copy of
19 this software and associated documentation files (the "Software"), to deal in
20 the Software without restriction, including without limitation the rights to
21 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
22 of the Software, and to permit persons to whom the Software is furnished to do
23 so, subject to the following conditions:
24 
25 The above copyright notice and this permission notice shall be included in all
26 copies or substantial portions of the Software.
27 
28 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 SOFTWARE.
35 */
36 
37 #ifndef INCLUDE_DETECTOR_HPP_
38 #define INCLUDE_DETECTOR_HPP_
39 
40 #include <vector>
41 #include <string>
42 #include <opencv2/highgui/highgui.hpp>
43 #include <opencv2/objdetect/objdetect.hpp>
44 #include <opencv2/imgproc/imgproc.hpp>
45 // #include <opencv2/videoio/videoio.hpp>
46 #include <opencv2/opencv.hpp>
47 
48 
49 class Detector {
50  public:
51  Detector();
52  double fps;
53  double focal_length, cx, cy;
54  void set_camera_properties(std::string);
55  void set_detection_object(cv::InputArray&);
56  cv::Mat detect_object();
57  void resize_bounding_box(cv::Rect*);
58  cv::Point2d get_centroid(cv::Rect);
59  cv::Point2d get_x_and_y(cv::Rect, double);
60  std::vector<cv::Rect> detections;
61  cv::VideoCapture camera;
62  ~Detector();
63 
64  private:
65  cv::Mat frame;
66  cv::HOGDescriptor hog_detector;
67 };
68 
69 #endif // INCLUDE_DETECTOR_HPP_
70 
Detector::get_x_and_y
cv::Point2d get_x_and_y(cv::Rect, double)
Computes x and y co-ordinates of the object in the real world w.r.t camera frame.
Definition: Detector.cpp:135
Detector::resize_bounding_box
void resize_bounding_box(cv::Rect *)
Resizes the bounding box.
Definition: Detector.cpp:109
Detector::set_detection_object
void set_detection_object(cv::InputArray &)
Sets the type of object to be detected.
Definition: Detector.cpp:78
Detector::get_centroid
cv::Point2d get_centroid(cv::Rect)
Computes centroid of bounding box.
Definition: Detector.cpp:121
Detector::detect_object
cv::Mat detect_object()
Updates frame by performing hog detection.
Definition: Detector.cpp:87
Detector::Detector
Detector()
Default constructor for Detector.
Definition: Detector.cpp:44
Detector::~Detector
~Detector()
Destructor for the Detector class.
Definition: Detector.cpp:145
Detector
Definition: Detector.hpp:49
Detector::set_camera_properties
void set_camera_properties(std::string)
Sets camera source and frame parameters.
Definition: Detector.cpp:55