Mech-DLK SDK (C#) 3.0.0
Mech-DLK SDK (C#) Reference Documentation
 
Loading...
Searching...
No Matches
Mmind::Dl::MRotatedBbox Struct Reference

Rotated bounding box structure. More...

#include <DataStructures.h>

Classes

struct  ExtraInfo
 

Public Member Functions

 MRotatedBbox (MPointF center, float width, float height, float angle, float confidence, int labelIndex, String^ labelName)
 
List< MPointFToBboxPoints ()
 
MBbox ToBbox ()
 

Public Attributes

MPointF center
 
float width
 
float height
 
float angle
 
ExtraInfo extraInfo
 

Detailed Description

Rotated bounding box structure.

Definition at line 115 of file DataStructures.h.

Constructor & Destructor Documentation

◆ MRotatedBbox()

Mmind::Dl::MRotatedBbox::MRotatedBbox ( MPointF center,
float width,
float height,
float angle,
float confidence,
int labelIndex,
String^ labelName )
inline

Definition at line 131 of file DataStructures.h.

132 {
133 this->center = center;
134 this->width = width;
135 this->height = height;
136 this->angle = angle;
137 this->extraInfo.confidence = confidence;
138 this->extraInfo.labelIndex = labelIndex;
139 this->extraInfo.labelName = labelName;
140 }

Member Function Documentation

◆ ToBbox()

MBbox Mmind::Dl::MRotatedBbox::ToBbox ( )
inline

Definition at line 159 of file DataStructures.h.

160 {
161 auto points = ToBboxPoints();
162 float minX = Single::MaxValue, minY = Single::MaxValue;
163 float maxX = Single::MinValue, maxY = Single::MinValue;
164
165 for each (auto point in points)
166 {
167 minX = Math::Min(minX, point.x);
168 minY = Math::Min(minY, point.y);
169 maxX = Math::Max(maxX, point.x);
170 maxY = Math::Max(maxY, point.y);
171 }
172
173 return MBbox(minX, minY, maxX, maxY, extraInfo.confidence, extraInfo.labelIndex, extraInfo.labelName);
174 }
List< MPointF > ToBboxPoints()

◆ ToBboxPoints()

List< MPointF > Mmind::Dl::MRotatedBbox::ToBboxPoints ( )
inline

Definition at line 142 of file DataStructures.h.

143 {
144 auto points = gcnew List<MPointF>();
145 float cos = (float)Math::Cos(angle);
146 float sin = (float)Math::Sin(angle);
147 float halfWidth = width / 2;
148 float halfHeight = height / 2;
149
150 // Calculate four corners
151 points->Add(MPointF(center.x + halfWidth * cos - halfHeight * sin, center.y + halfWidth * sin + halfHeight * cos));
152 points->Add(MPointF(center.x - halfWidth * cos - halfHeight * sin, center.y - halfWidth * sin + halfHeight * cos));
153 points->Add(MPointF(center.x - halfWidth * cos + halfHeight * sin, center.y - halfWidth * sin - halfHeight * cos));
154 points->Add(MPointF(center.x + halfWidth * cos + halfHeight * sin, center.y + halfWidth * sin - halfHeight * cos));
155
156 return points;
157 }

Member Data Documentation

◆ angle

float Mmind::Dl::MRotatedBbox::angle

Definition at line 120 of file DataStructures.h.

◆ center

MPointF Mmind::Dl::MRotatedBbox::center

Definition at line 117 of file DataStructures.h.

◆ extraInfo

ExtraInfo Mmind::Dl::MRotatedBbox::extraInfo

Definition at line 129 of file DataStructures.h.

◆ height

float Mmind::Dl::MRotatedBbox::height

Definition at line 119 of file DataStructures.h.

◆ width

float Mmind::Dl::MRotatedBbox::width

Definition at line 118 of file DataStructures.h.


The documentation for this struct was generated from the following file: