xref: /aosp_15_r20/external/armnn/samples/ObjectDetection/src/DetectedObject.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "DetectedObject.hpp"
7 
8 namespace od
9 {
10 
DetectedObject()11 DetectedObject::DetectedObject() :
12         DetectedObject(0u, "", BoundingBox(), 0u)
13 {}
14 
DetectedObject(unsigned int id,std::string label,const BoundingBox & boundingBox,float score)15 DetectedObject::DetectedObject(
16         unsigned int id,
17         std::string label,
18         const BoundingBox &boundingBox,
19         float score) :
20         m_Id(id),
21         m_Label(std::move(label)),
22         m_BoundingBox(boundingBox),
23         m_Score(score)
24 {}
25 
GetId() const26 unsigned int DetectedObject::GetId() const
27 {
28     return m_Id;
29 }
30 
GetLabel() const31 const std::string &DetectedObject::GetLabel() const
32 {
33     return m_Label;
34 }
35 
GetBoundingBox() const36 const BoundingBox &DetectedObject::GetBoundingBox() const
37 {
38     return m_BoundingBox;
39 }
40 
GetScore() const41 float DetectedObject::GetScore() const
42 {
43     return m_Score;
44 }
45 
SetId(unsigned int id)46 void DetectedObject::SetId(unsigned int id)
47 {
48     m_Id = id;
49 }
50 
SetLabel(const std::string & label)51 void DetectedObject::SetLabel(const std::string &label)
52 {
53     m_Label = label;
54 }
55 
SetBoundingBox(const BoundingBox & boundingBox)56 void DetectedObject::SetBoundingBox(const BoundingBox &boundingBox)
57 {
58     m_BoundingBox = boundingBox;
59 }
60 
SetScore(float score)61 void DetectedObject::SetScore(float score)
62 {
63     m_Score = score;
64 }
65 }// namespace od