8 #ifndef META_OCEAN_CV_SEGMENTATION_BIN_PACKING_H
9 #define META_OCEAN_CV_SEGMENTATION_BIN_PACKING_H
22 namespace Segmentation
57 inline Index32 boxIndex()
const;
69 inline bool transposed()
const;
80 const bool transposed_ =
false;
103 typedef std::set<CV::PixelBoundingBox, BinPacking>
BoxSet;
140 transposed_(transposed)
162 const uint64_t sizeA = uint64_t(boxA.
width()) * uint64_t(boxA.
height());
163 const uint64_t sizeB = uint64_t(boxB.
width()) * uint64_t(boxB.
height());
170 return sizeA < sizeB;
175 return boundingBoxIdPairA.first.size() < boundingBoxIdPairB.first.size();
T left() const
Returns the left (including) pixel position of this bounding box.
Definition: PixelBoundingBox.h:416
unsigned int width() const
Returns the width (the number of horizontal including pixels) of this bounding box.
Definition: PixelBoundingBox.h:482
T top() const
Returns the top (including) pixel position of this bounding box.
Definition: PixelBoundingBox.h:423
unsigned int height() const
Returns the height (the number of vertical including pixels) of this bounding box.
Definition: PixelBoundingBox.h:489
This class provides the relevant packing information for a 2D box with pixel precision.
Definition: BinPacking.h:37
const CV::PixelPosition topLeft() const
Returns the location of the top left corner of the packed 2D box.
Definition: BinPacking.h:150
bool transposed() const
Returns whether the packed 2D box needs to be transposed.
Definition: BinPacking.h:155
Index32 boxIndex() const
Returns the index of the packed 2D box.
Definition: BinPacking.h:145
Packing()=default
Default constructor creating an invalid packing information.
const CV::PixelPosition topLeft_
The location of the top left corner of the packed 2D box.
Definition: BinPacking.h:77
This class implements bin packing algorithms.
Definition: BinPacking.h:30
static Packings binPacking(const CV::PixelBoundingBoxes &boxes, const bool allowTransposed, unsigned int *width=nullptr, unsigned int *height=nullptr)
Invokes a bin packing for given 2D boxes with pixel precision.
std::vector< BoundingBoxIdPair > BoundingBoxIdPairs
Definition of a vector holding box id pairs.
Definition: BinPacking.h:98
std::set< CV::PixelBoundingBox, BinPacking > BoxSet
Definition of an ordered set holding 2D boxes with pixel accuracy.
Definition: BinPacking.h:103
bool operator()(const CV::PixelBoundingBox &boxA, const CV::PixelBoundingBox &boxB) const
Compares the size of two boxes and returns whether the first box is smaller than the second box.
Definition: BinPacking.h:160
static bool sortBoundingBoxIdPair(const BoundingBoxIdPair &boundingBoxIdPairA, const BoundingBoxIdPair &boundingBoxIdPairB)
Compares two pairs of bounding boxes with ids and returns whether the left pair as a lower id than th...
Definition: BinPacking.h:173
std::vector< Packing > Packings
Definition of a vector holding Packing objects.
Definition: BinPacking.h:86
std::pair< CV::PixelBoundingBox, Index32 > BoundingBoxIdPair
Definition of a pair combining a 2D box with an id.
Definition: BinPacking.h:93
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
std::vector< PixelBoundingBox > PixelBoundingBoxes
Definition of a vector holding bounding box objects with only positive coordinate values.
Definition: PixelBoundingBox.h:42
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15