struct mrpt::obs::TPixelLabelInfoBase

Overview

Virtual interface to all pixel-label semantic information structs.

See CObservation3DRangeScan::pixelLabels

#include <mrpt/obs/TPixelLabelInfo.h>

struct TPixelLabelInfoBase
{
    // typedefs

    typedef std::shared_ptr<TPixelLabelInfoBase> Ptr;
    typedef std::map<uint32_t, std::string> TMapLabelID2Name;

    // construction

    TPixelLabelInfoBase(unsigned int BITFIELD_BYTES_);

    // methods

    const std::string& getLabelName(unsigned int label_idx) const;

    void setLabelName(
        unsigned int label_idx,
        const std::string& name
        );

    virtual void setSize(const int NROWS, const int NCOLS) = 0;
    virtual void setLabel(const int row, const int col, uint8_t label_idx) = 0;

    virtual void getLabels(
        const int row,
        const int col,
        uint8_t& labels
        ) = 0;

    virtual void unsetLabel(const int row, const int col, uint8_t label_idx) = 0;
    virtual bool checkLabel(const int row, const int col, uint8_t label_idx) const = 0;
    void writeToStream(mrpt::serialization::CArchive& out) const;
    static TPixelLabelInfoBase* readAndBuildFromStream(mrpt::serialization::CArchive& in);
};

// direct descendants

template <unsigned int BYTES_REQUIRED_>
struct TPixelLabelInfo;

Typedefs

typedef std::shared_ptr<TPixelLabelInfoBase> Ptr

Used in CObservation3DRangeScan::pixelLabels.

Methods

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, all pixels are assigned NONE category).

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_NUM_LABELS-1 Note that 0 is a valid label index, it does not mean “no label”.

See also:

unsetLabel, unsetAll

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 range 0 to 7 Note that 0 is a valid label index, it does not mean “no label”.

See also:

setLabel, unsetAll

virtual bool checkLabel(const int row, const int col, uint8_t label_idx) const = 0

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

See also:

unsetLabel, unsetAll