template class sophus::RuntimeImageView

Overview

#include <runtime_image.h>

template <class TPredicate = AnyImagePredicate>
class RuntimeImageView {
public:
    // construction

    template <class TPixel>
    RuntimeImageView(ImageView<TPixel> const& image);

    RuntimeImageView(
        ImageShape const& image_shape,
        RuntimePixelType const& pixel_type,
        void const* ptr
        );

    // methods

    template <class TPixel>
    bool has() const;

    uint8_t const* rawRowPtr(int v) const;
    uint8_t const* rawPtr() const;
    int numBytesPerPixelChannel() const;
    NumberType numberType() const;
    ImageShape const& shape() const;
    ImageSize const& imageSize() const;
    int width() const;
    int height() const;
    size_t pitchBytes() const;
    size_t sizeBytes() const;
    bool isEmpty() const;
    RuntimePixelType pixelType() const;
    int numChannels() const;
    RuntimeImageView subview(Eigen::Vector2i uv, sophus::ImageSize size) const;

    template <class TPixel>
    ImageView<TPixel> imageView() const;

protected:
    // fields

    ImageShape shape_ = {};
    RuntimePixelType pixel_type_;
    uint8_t const* ptr_;

    // construction

    RuntimeImageView();
};

Detailed Documentation

Construction

template <class TPixel>
RuntimeImageView(ImageView<TPixel> const& image)

Create type-erased image view from ImageView.

By design not “explicit”.

Methods

template <class TPixel>
bool has() const

Return true is this contains data of type TPixel.

uint8_t const* rawRowPtr(int v) const

Returns v-th row pointer.

Precondition: v must be in [0, height).

int numBytesPerPixelChannel() const

Number of bytes per channel of a single pixel.

E.g. a pixel of Eigen::Matrix<uint8_t, 3, 1> has 1 byte per channel.

RuntimeImageView subview(Eigen::Vector2i uv, sophus::ImageSize size) const

Returns subview with shared ownership semantics of whole image.

template <class TPixel>
ImageView<TPixel> imageView() const

Returns typed image.

Precondition: this-> has<TPixel>()