template class sophus::RuntimeImage

Overview

Type-erased image with shared ownership, and read-only access to pixels. Type is nullable. More…

#include <image.h>

template <
    class TPredicate = AnyImagePredicate,
    template<class> class TAllocator = Eigen::aligned_allocator
    >
class RuntimeImage {
public:
    // construction

    RuntimeImage();

    template <class TPixel>
    RuntimeImage(Image<TPixel, TAllocator> const& image);

    template <class TPixel>
    RuntimeImage(MutImage<TPixel>&& image);

    RuntimeImage(ImageShape const& shape, RuntimePixelType const& pixel_type);
    RuntimeImage(ImageSize const& size, RuntimePixelType const& pixel_type);

    // methods

    template <class TPixel>
    bool has() const;

    template <class TPixel>
    Image<TPixel, TAllocator> image() const;

    template <class TPixel>
    Image<TPixel, TAllocator> reinterpretAs(ImageSize reinterpreted_size) const;

    size_t useCount() const;

    template <class TT>
    static RuntimeImage makeCopyFrom(ImageView<TT> image_view);
};

Detailed Documentation

Type-erased image with shared ownership, and read-only access to pixels. Type is nullable.

Construction

RuntimeImage()

Empty image.

template <class TPixel>
RuntimeImage(Image<TPixel, TAllocator> const& image)

Create type-erased image from Image.

Ownership is shared between RuntimeImage and Image, and hence the reference count will be increased by one (unless input is empty). By design not “explicit”.

template <class TPixel>
RuntimeImage(MutImage<TPixel>&& image)

Create type-erased image from MutImage. By design not “explicit”.

RuntimeImage(ImageShape const& shape, RuntimePixelType const& pixel_type)

Create type-image image from provided shape and pixel type. Pixel data is left uninitialized.

RuntimeImage(ImageSize const& size, RuntimePixelType const& pixel_type)

Create type-image image from provided size and pixel type. Pixel data is left uninitialized.

Methods

template <class TPixel>
bool has() const

Return true is this contains data of type TPixel.

template <class TPixel>
Image<TPixel, TAllocator> image() const

Returns typed image.

Precondition: this-> has<TPixel>()