Go to the documentation of this file.
33 using Ptr = std::shared_ptr<TPixelLabelInfoBase>;
45 throw std::runtime_error(
"Error: label index has no defined name");
56 std::map<uint32_t, std::string>::const_iterator it;
58 if (it->second == name)
return it->first;
65 virtual void setSize(
const int NROWS,
const int NCOLS) = 0;
70 virtual void setLabel(
const int row,
const int col, uint8_t label_idx) = 0;
71 virtual void getLabels(
const int row,
const int col, uint8_t& labels) = 0;
77 const int row,
const int col, uint8_t label_idx) = 0;
80 virtual void unsetAll(
const int row,
const int col, uint8_t label_idx) = 0;
85 const int row,
const int col, uint8_t label_idx)
const = 0;
107 virtual void Print(std::ostream&)
const = 0;
115 template <
unsigned int BYTES_REQUIRED_>
118 using Ptr = std::shared_ptr<TPixelLabelInfo>;
137 void setSize(
const int NROWS,
const int NCOLS)
override
141 void setLabel(
const int row,
const int col, uint8_t label_idx)
override
145 void getLabels(
const int row,
const int col, uint8_t& labels)
override
150 void unsetLabel(
const int row,
const int col, uint8_t label_idx)
override
155 const int row,
const int col,
156 [[maybe_unused]] uint8_t label_idx)
override
161 const int row,
const int col, uint8_t label_idx)
const override
164 (
static_cast<bitmask_t>(1) << label_idx)) != 0;
174 void Print(std::ostream&
out)
const override;
void setLabelName(unsigned int label_idx, const std::string &name)
virtual void getLabels(const int row, const int col, uint8_t &labels)=0
std::shared_ptr< TPixelLabelInfoBase > Ptr
Used in CObservation3DRangeScan::pixelLabels.
friend std::ostream & operator<<(std::ostream &out, const TPixelLabelInfoBase &obj)
std stream interface
virtual void setLabel(const int row, const int col, uint8_t label_idx)=0
Mark the pixel(row,col) as classified in the category label_idx, which may be in the range 0 to MAX_N...
void setSize(const int NROWS, const int NCOLS) override
Resizes the matrix pixelLabels to the given size, setting all bitfields to zero (that is,...
virtual void unsetLabel(const int row, const int col, uint8_t label_idx)=0
For the pixel(row,col), removes its classification into the category label_idx, which may be in the r...
void internal_writeToStream(mrpt::serialization::CArchive &out) const override
Pixel-wise semantic label struct.
virtual void internal_writeToStream(mrpt::serialization::CArchive &out) const =0
void Print(std::ostream &out) const override
mrpt::vision::TStereoCalibResults out
This namespace contains representation of robot actions and observations.
Virtual base class for "archives": classes abstracting I/O streams.
typename mrpt::uint_select_by_bytecount< BYTES_REQUIRED >::type bitmask_t
Automatically-determined integer type of the proper size such that all labels fit as one bit (max: 64...
virtual bool checkLabel(const int row, const int col, uint8_t label_idx) const =0
Checks whether pixel(row,col) has been clasified into category label_idx, which may be in the range 0...
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...
virtual void unsetAll(const int row, const int col, uint8_t label_idx)=0
Removes all categories for pixel(row,col)
void writeToStream(mrpt::serialization::CArchive &out) const
TPixelLabelMatrix pixelLabels
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 r...
void unsetAll(const int row, const int col, [[maybe_unused]] uint8_t label_idx) override
virtual ~TPixelLabelInfoBase()
constexpr static unsigned int BYTES_REQUIRED
void internal_readFromStream(mrpt::serialization::CArchive &in) override
virtual void Print(std::ostream &) const =0
TPixelLabelInfoBase(unsigned int BITFIELD_BYTES_)
std::map< uint32_t, std::string > TMapLabelID2Name
virtual void setSize(const int NROWS, const int NCOLS)=0
Resizes the matrix pixelLabels to the given size, setting all bitfields to zero (that is,...
static CMatrixDynamic< bitmask_t > Zero()
void getLabels(const int row, const int col, uint8_t &labels) override
virtual void internal_readFromStream(mrpt::serialization::CArchive &in)=0
int checkLabelNameExistence(const std::string &name) const
Check the existence of a label by returning its associated index.
const std::string & getLabelName(unsigned int label_idx) const
Usage: uint_select_by_bytecount<N>::type var; allows defining var as a unsigned integer with,...
static TPixelLabelInfoBase * readAndBuildFromStream(mrpt::serialization::CArchive &in)
Virtual interface to all pixel-label semantic information structs.
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_N...
const uint8_t BITFIELD_BYTES
Minimum number of bytes required to hold MAX_NUM_DIFFERENT_LABELS bits.
TMapLabelID2Name pixelLabelNames
The 'semantic' or human-friendly name of the i'th bit in pixelLabels(r,c) can be found in pixelLabelN...
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 23:51:15 UTC 2020 | |