MRPT  1.9.9
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions
mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ > Struct Template Referenceabstract

Detailed Description

template<unsigned int BYTES_REQUIRED_>
struct mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >

Pixel-wise semantic label struct.

See CObservation3DRangeScan::pixelLabels

Definition at line 116 of file TPixelLabelInfo.h.

#include <mrpt/obs/TPixelLabelInfo.h>

Inheritance diagram for mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >:

Public Types

using Ptr = std::shared_ptr< TPixelLabelInfo >
 
using bitmask_t = typename mrpt::uint_select_by_bytecount< BYTES_REQUIRED >::type
 Automatically-determined integer type of the proper size such that all labels fit as one bit (max: 64) More...
 
using TPixelLabelMatrix = mrpt::math::CMatrixDynamic< bitmask_t >
 Each pixel may be assigned between 0 and MAX_NUM_LABELS-1 'labels' by setting to 1 the corresponding i'th bit [0,MAX_NUM_LABELS-1] in the byte in pixelLabels(r,c). More...
 
using TMapLabelID2Name = std::map< uint32_t, std::string >
 

Public Member Functions

void setSize (const int NROWS, const int NCOLS) override
 Resizes the matrix pixelLabels to the given size, setting all bitfields to zero (that is, all pixels are assigned NONE category). More...
 
void setLabel (const int row, const int col, uint8_t label_idx) override
 Mark the pixel(row,col) as classified in the category label_idx, which may be in the range 0 to MAX_NUM_LABELS-1 Note that 0 is a valid label index, it does not mean "no label". More...
 
void getLabels (const int row, const int col, uint8_t &labels) override
 
void unsetLabel (const int row, const int col, uint8_t label_idx) override
 For the pixel(row,col), removes its classification into the category label_idx, which may be in the range 0 to 7 Note that 0 is a valid label index, it does not mean "no label". More...
 
void unsetAll (const int row, const int col, [[maybe_unused]] uint8_t label_idx) override
 
bool checkLabel (const int row, const int col, uint8_t label_idx) const override
 Checks whether pixel(row,col) has been clasified into category label_idx, which may be in the range 0 to 7. More...
 
 TPixelLabelInfo ()
 
const std::string & getLabelName (unsigned int label_idx) const
 
void setLabelName (unsigned int label_idx, const std::string &name)
 
int checkLabelNameExistence (const std::string &name) const
 Check the existence of a label by returning its associated index. More...
 
virtual void unsetAll (const int row, const int col, uint8_t label_idx)=0
 Removes all categories for pixel(row,col) More...
 
void writeToStream (mrpt::serialization::CArchive &out) const
 

Static Public Member Functions

static TPixelLabelInfoBasereadAndBuildFromStream (mrpt::serialization::CArchive &in)
 

Public Attributes

TPixelLabelMatrix pixelLabels
 
TMapLabelID2Name pixelLabelNames
 The 'semantic' or human-friendly name of the i'th bit in pixelLabels(r,c) can be found in pixelLabelNames[i] as a std::string. More...
 
const uint8_t BITFIELD_BYTES
 Minimum number of bytes required to hold MAX_NUM_DIFFERENT_LABELS bits. More...
 

Static Public Attributes

static constexpr unsigned int BYTES_REQUIRED = BYTES_REQUIRED_
 

Protected Member Functions

void internal_readFromStream (mrpt::serialization::CArchive &in) override
 
void internal_writeToStream (mrpt::serialization::CArchive &out) const override
 
void Print (std::ostream &out) const override
 

Member Typedef Documentation

◆ bitmask_t

template<unsigned int BYTES_REQUIRED_>
using mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::bitmask_t = typename mrpt::uint_select_by_bytecount<BYTES_REQUIRED>::type

Automatically-determined integer type of the proper size such that all labels fit as one bit (max: 64)

Definition at line 124 of file TPixelLabelInfo.h.

◆ Ptr

template<unsigned int BYTES_REQUIRED_>
using mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::Ptr = std::shared_ptr<TPixelLabelInfo>

Definition at line 118 of file TPixelLabelInfo.h.

◆ TMapLabelID2Name

using mrpt::obs::TPixelLabelInfoBase::TMapLabelID2Name = std::map<uint32_t, std::string>
inherited

Definition at line 34 of file TPixelLabelInfo.h.

◆ TPixelLabelMatrix

template<unsigned int BYTES_REQUIRED_>
using mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::TPixelLabelMatrix = mrpt::math::CMatrixDynamic<bitmask_t>

Each pixel may be assigned between 0 and MAX_NUM_LABELS-1 'labels' by setting to 1 the corresponding i'th bit [0,MAX_NUM_LABELS-1] in the byte in pixelLabels(r,c).

That is, each pixel is assigned an 8*BITFIELD_BYTES bit-wide bitfield of possible categories.

See also
hasPixelLabels

Definition at line 134 of file TPixelLabelInfo.h.

Constructor & Destructor Documentation

◆ TPixelLabelInfo()

template<unsigned int BYTES_REQUIRED_>
mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::TPixelLabelInfo ( )
inline

Definition at line 168 of file TPixelLabelInfo.h.

Member Function Documentation

◆ checkLabel()

template<unsigned int BYTES_REQUIRED_>
bool mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::checkLabel ( const int  row,
const int  col,
uint8_t  label_idx 
) const
inlineoverridevirtual

Checks whether pixel(row,col) has been clasified into category label_idx, which may be in the range 0 to 7.

See also
unsetLabel, unsetAll

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 160 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::pixelLabels.

◆ checkLabelNameExistence()

int mrpt::obs::TPixelLabelInfoBase::checkLabelNameExistence ( const std::string &  name) const
inlineinherited

Check the existence of a label by returning its associated index.

-1 if it does not exist.

Definition at line 54 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfoBase::pixelLabelNames.

◆ getLabelName()

const std::string& mrpt::obs::TPixelLabelInfoBase::getLabelName ( unsigned int  label_idx) const
inlineinherited

Definition at line 41 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfoBase::pixelLabelNames.

◆ getLabels()

template<unsigned int BYTES_REQUIRED_>
void mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::getLabels ( const int  row,
const int  col,
uint8_t &  labels 
)
inlineoverridevirtual

◆ internal_readFromStream()

template<unsigned int BYTES_REQUIRED_>
void TPixelLabelInfo::internal_readFromStream ( mrpt::serialization::CArchive in)
overrideprotectedvirtual

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 34 of file TPixelLabelInfo.cpp.

◆ internal_writeToStream()

template<unsigned int BYTES_REQUIRED_>
void TPixelLabelInfo::internal_writeToStream ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 47 of file TPixelLabelInfo.cpp.

References out.

◆ Print()

template<unsigned int BYTES_REQUIRED_>
template void TPixelLabelInfo::Print ( std::ostream &  out) const
overrideprotectedvirtual

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 115 of file TPixelLabelInfo.cpp.

References out.

◆ readAndBuildFromStream()

TPixelLabelInfoBase * plib::readAndBuildFromStream ( mrpt::serialization::CArchive in)
staticinherited

Definition at line 61 of file TPixelLabelInfo.cpp.

References mrpt::obs::TPixelLabelInfoBase::internal_readFromStream(), and MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

Here is the call graph for this function:

◆ setLabel()

template<unsigned int BYTES_REQUIRED_>
void mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::setLabel ( const int  row,
const int  col,
uint8_t  label_idx 
)
inlineoverridevirtual

Mark the pixel(row,col) as classified in the category label_idx, which may be in the range 0 to MAX_NUM_LABELS-1 Note that 0 is a valid label index, it does not mean "no label".

See also
unsetLabel, unsetAll

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 141 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::pixelLabels.

◆ setLabelName()

void mrpt::obs::TPixelLabelInfoBase::setLabelName ( unsigned int  label_idx,
const std::string &  name 
)
inlineinherited

Definition at line 48 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfoBase::pixelLabelNames.

◆ setSize()

template<unsigned int BYTES_REQUIRED_>
void mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::setSize ( const int  NROWS,
const int  NCOLS 
)
inlineoverridevirtual

Resizes the matrix pixelLabels to the given size, setting all bitfields to zero (that is, all pixels are assigned NONE category).

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 137 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::pixelLabels, and mrpt::math::MatrixVectorBase< Scalar, Derived >::Zero().

Here is the call graph for this function:

◆ unsetAll() [1/2]

virtual void mrpt::obs::TPixelLabelInfoBase::unsetAll ( const int  row,
const int  col,
uint8_t  label_idx 
)
pure virtualinherited

Removes all categories for pixel(row,col)

See also
setLabel, unsetLabel

◆ unsetAll() [2/2]

template<unsigned int BYTES_REQUIRED_>
void mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::unsetAll ( const int  row,
const int  col,
[[maybe_unused] ] uint8_t  label_idx 
)
inlineoverride

◆ unsetLabel()

template<unsigned int BYTES_REQUIRED_>
void mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::unsetLabel ( const int  row,
const int  col,
uint8_t  label_idx 
)
inlineoverridevirtual

For the pixel(row,col), removes its classification into the category label_idx, which may be in the range 0 to 7 Note that 0 is a valid label index, it does not mean "no label".

See also
setLabel, unsetAll

Implements mrpt::obs::TPixelLabelInfoBase.

Definition at line 150 of file TPixelLabelInfo.h.

References mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::pixelLabels.

◆ writeToStream()

void plib::writeToStream ( mrpt::serialization::CArchive out) const
inherited

Definition at line 22 of file TPixelLabelInfo.cpp.

References out.

Member Data Documentation

◆ BITFIELD_BYTES

const uint8_t mrpt::obs::TPixelLabelInfoBase::BITFIELD_BYTES
inherited

Minimum number of bytes required to hold MAX_NUM_DIFFERENT_LABELS bits.

Definition at line 101 of file TPixelLabelInfo.h.

◆ BYTES_REQUIRED

template<unsigned int BYTES_REQUIRED_>
constexpr unsigned int mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::BYTES_REQUIRED = BYTES_REQUIRED_
static

Definition at line 119 of file TPixelLabelInfo.h.

◆ pixelLabelNames

TMapLabelID2Name mrpt::obs::TPixelLabelInfoBase::pixelLabelNames
inherited

The 'semantic' or human-friendly name of the i'th bit in pixelLabels(r,c) can be found in pixelLabelNames[i] as a std::string.

Definition at line 39 of file TPixelLabelInfo.h.

Referenced by mrpt::obs::TPixelLabelInfoBase::checkLabelNameExistence(), mrpt::obs::TPixelLabelInfoBase::getLabelName(), and mrpt::obs::TPixelLabelInfoBase::setLabelName().

◆ pixelLabels

template<unsigned int BYTES_REQUIRED_>
TPixelLabelMatrix mrpt::obs::TPixelLabelInfo< BYTES_REQUIRED_ >::pixelLabels



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020