template class sophus::Image

Overview

Image read-only access to pixels and shared ownership, hence cheap to copy. Type is nullable. More…

#include <image.h>

template <
    class TPixel,
    template<class> class TAllocator = Eigen::aligned_allocator
    >
class Image {
public:
    // construction

    Image();
    Image(MutImage<TPixel, TAllocator>&& image);

    // methods

    size_t useCount() const;
    void reset();
    static Image makeCopyFrom(ImageView<TPixel> const& view);

    template <class TUVOperation>
    static Image makeGenerative(ImageSize size, TUVOperation const& uv_op);

    template <class TOtherPixel, class TUnaryOperation>
    static Image makeFromTransform(
        ImageView<TOtherPixel> view,
        TUnaryOperation const& unary_op
        );

    template <class TLhsPixel, class TRhsPixel, class TBinaryOperation>
    static Image makeFromTransform(
        ImageView<TLhsPixel> lhs,
        ImageView<TRhsPixel> rhs,
        TBinaryOperation const& binary_op
        );
};

Detailed Documentation

Image read-only access to pixels and shared ownership, hence cheap to copy. Type is nullable.

Image has close interop with RuntimeImage (see below).

Construction

Image()

Constructs empty image.

Image(MutImage<TPixel, TAllocator>&& image)

Moves MutImage into this. By design not “explicit”.

Methods

void reset()

Sets Image instance to empty. Reduced use count by one.

If use count goes to zero, deallocation happens.

No-op if empty.

static Image makeCopyFrom(ImageView<TPixel> const& view)

Creates contiguous copy from view.

If view is not empty, memory allocation will happen.

template <class TUVOperation>
static Image makeGenerative(
    ImageSize size,
    TUVOperation const& uv_op
    )

Allocated and generates image from provided function taking u,v indices.

Memory allocation will happen.

template <class TOtherPixel, class TUnaryOperation>
static Image makeFromTransform(
    ImageView<TOtherPixel> view,
    TUnaryOperation const& unary_op
    )

Creates new Image given view and unary transform function.

image(u, v) = unary_op(view(u, v));

template <class TLhsPixel, class TRhsPixel, class TBinaryOperation>
static Image makeFromTransform(
    ImageView<TLhsPixel> lhs,
    ImageView<TRhsPixel> rhs,
    TBinaryOperation const& binary_op
    )

Creates new Image given two views and binary transform function.

image(u, v) = binary_op(lhs(u, v), rhs(u, v));