detected-object.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include <string>
7 #include <memory>
8 #include <utility>
9 #include <list>
10 #include <opencv2/core/types.hpp> // for cv::Rect
11 
12 
13 namespace openvino_helpers
14 {
15  /*
16  Describe detected face
17  */
19  {
20  size_t _id; // Some unique identifier that assigned to us
21  std::string _label; // Any string assigned to us in the ctor
22 
23  cv::Rect _location; // In the color frame
24  cv::Rect _depth_location; // In the depth frame
25  float _intensity; // Some heuristic calculated on _location, allowing approximate "identity" based on pixel intensity
26  float _depth;
27 
28  public:
29  using ptr = std::shared_ptr< detected_object >;
30 
31  explicit detected_object( size_t id, std::string const & label, cv::Rect const & location,
32  cv::Rect const & depth_location = cv::Rect {}, float intensity = 1, float depth = 0 );
33  virtual ~detected_object() {}
34 
35  // Update the location and intensity of the face
36  void move( cv::Rect const & location, cv::Rect const & depth_location = cv::Rect {}, float intensity = 1, float depth = 0 )
37  {
38  _location = location;
39  _depth_location = depth_location;
40  _intensity = intensity;
41  _depth = depth;
42  }
43 
44  cv::Rect const & get_location() const { return _location; }
45  cv::Rect const & get_depth_location() const { return _depth_location; }
46  float get_intensity() const { return _intensity; }
47  float get_depth() const { return _depth; }
48  size_t get_id() const { return _id; }
49  std::string const & get_label () const { return _label; }
50  };
51 
52  typedef std::list< detected_object::ptr > detected_objects;
53 
54  // Returns a face found approximately in the given location, or null if none
55  detected_object::ptr find_object( cv::Rect rect, detected_objects const & objects );
56 }
detected_object(size_t id, std::string const &label, cv::Rect const &location, cv::Rect const &depth_location=cv::Rect{}, float intensity=1, float depth=0)
GLint location
std::list< detected_object::ptr > detected_objects
GLint GLint GLsizei GLsizei GLsizei depth
GLsizei const GLchar *const * string
cv::Rect const & get_depth_location() const
cv::Rect const & get_location() const
std::string const & get_label() const
Definition: example.hpp:70
void move(cv::Rect const &location, cv::Rect const &depth_location=cv::Rect{}, float intensity=1, float depth=0)
GLuint GLsizei const GLchar * label
detected_object::ptr find_object(cv::Rect rect, detected_objects const &objects)
std::shared_ptr< detected_object > ptr


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:12