farm-ng-core
sophus::Image< TPixel, TAllocator > Class Template Reference

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

#include <image.h>

Inheritance diagram for sophus::Image< TPixel, TAllocator >:
Collaboration diagram for sophus::Image< TPixel, TAllocator >:

Public Member Functions

 Image ()=default
 Constructs empty image. More...
 
 Image (MutImage< TPixel, TAllocator > &&image) noexcept
 Moves MutImage into this. By design not "explicit". More...
 
auto useCount () const -> size_t
 
void reset ()
 Sets Image instance to empty. Reduced use count by one. More...
 
- Public Member Functions inherited from sophus::ImageView< TPixel >
 ImageView ()=default
 Default constructor creates an empty image. More...
 
 ImageView (ImageLayout layout, TPixel const *ptr) noexcept
 Creates view from layout and pointer to first pixel. More...
 
 ImageView (sophus::ImageSize image_size, TPixel const *ptr) noexcept
 Creates view from image size and pointer to first pixel. The image is assumed to be contiguous and the pitch is set accordingly. More...
 
auto isEmpty () const -> bool
 Returns true if view is empty. More...
 
auto isContiguous () const -> bool
 Returns true if view is contiguous. More...
 
auto imageSize () const -> sophus::ImageSize const &
 Returns ImageSize. It is {0,0} if view is empty. More...
 
auto layout () const -> ImageLayout const &
 Returns ImageLayout. It is {{0,0}, 0} is view is empty. More...
 
auto area () const -> size_t
 
auto width () const -> int
 
auto height () const -> int
 
auto pitchBytes () const -> size_t
 
auto sizeBytes () const -> size_t
 
auto colInBounds (int u) const -> bool
 Returns true if u is in [0, width). More...
 
auto rowInBounds (int v) const -> bool
 Returns true if v is in [0, height). More...
 
auto rowPtr (int v) const -> TPixel const *
 Returns v-th row pointer. More...
 
auto operator() (int u, int v) const -> TPixel const &
 Returns pixel u, v. More...
 
auto operator() (Eigen::Vector2i uv) const -> TPixel const &
 
auto ptr () const -> TPixel const *
 Returns pointer to first pixel. More...
 
auto subview (Eigen::Vector2i uv, sophus::ImageSize size) const -> ImageView
 Returns subview. More...
 
template<class TFunc >
void visit (TFunc const &user_function) const
 Performs reduction / fold on image view. More...
 
template<class TReduceOp , class TVal >
auto reduce (TReduceOp const &reduce_op, TVal val=TVal{}) const -> TVal
 Performs reduction / fold on image view. More...
 
template<class TShortCircuitReduceOp , class TVal >
auto shortCircuitReduce (TShortCircuitReduceOp const &short_circuit_reduce_op, TVal val=TVal{}) const -> TVal
 Performs reduction / fold on image view with short circuit condition. More...
 
auto operator== (ImageView const &rhs) const -> bool=delete
 The equality operator is deleted to avoid confusion. Since ImageView is a "shallow-copy" type, a consistently defined equality would check for equality of its (shallow) state: More...
 
auto operator!= (ImageView const &rhs) const -> bool=delete
 The in-equality operator is deleted to avoid confusion. More...
 
auto hasSameData (ImageView const &rhs) const -> bool
 Returns true both views have the same size and contain the same data. More...
 

Static Public Member Functions

static auto makeCopyFrom (ImageView< TPixel > const &view) -> Image
 Creates contiguous copy from view. More...
 
template<class TUVOperation >
static auto makeGenerative (ImageSize size, TUVOperation const &uv_op) -> Image
 Allocated and generates image from provided function taking u,v indices. More...
 
template<class TOtherPixel , class TUnaryOperation >
static auto makeFromTransform (ImageView< TOtherPixel > view, TUnaryOperation const &unary_op) -> Image
 Creates new Image given view and unary transform function. More...
 
template<class TLhsPixel , class TRhsPixel , class TBinaryOperation >
static auto makeFromTransform (ImageView< TLhsPixel > lhs, ImageView< TRhsPixel > rhs, TBinaryOperation const &binary_op) -> Image
 Creates new Image given two views and binary transform function. More...
 

Friends

template<class TT , class TAllocator2T >
class MutImage
 
template<class TPredicate , class TAllocator2T >
class DynImage
 

Additional Inherited Members

- Public Types inherited from sophus::ImageView< TPixel >
using Pixel = TPixel
 
- Protected Member Functions inherited from sophus::ImageView< TPixel >
void setViewToEmpty ()
 Resets view such that it is empty. More...
 
- Protected Attributes inherited from sophus::ImageView< TPixel >
ImageLayout layout_ = {}
 
TPixel const * ptr_ = nullptr
 

Detailed Description

template<class TPixel, class TAllocator = Eigen::aligned_allocator<uint8_t>>
class sophus::Image< TPixel, TAllocator >

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

Image has close interop with DynImage (see below).

Constructor & Destructor Documentation

◆ Image() [1/2]

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
sophus::Image< TPixel, TAllocator >::Image ( )
default

Constructs empty image.

◆ Image() [2/2]

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
sophus::Image< TPixel, TAllocator >::Image ( MutImage< TPixel, TAllocator > &&  image)
inlinenoexcept

Moves MutImage into this. By design not "explicit".

Member Function Documentation

◆ makeCopyFrom()

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
static auto sophus::Image< TPixel, TAllocator >::makeCopyFrom ( ImageView< TPixel > const &  view) -> Image
inlinestatic

Creates contiguous copy from view.

If view is not empty, memory allocation will happen.

◆ makeFromTransform() [1/2]

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TLhsPixel , class TRhsPixel , class TBinaryOperation >
static auto sophus::Image< TPixel, TAllocator >::makeFromTransform ( ImageView< TLhsPixel >  lhs,
ImageView< TRhsPixel >  rhs,
TBinaryOperation const &  binary_op 
) -> Image
inlinestatic

Creates new Image given two views and binary transform function.

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

◆ makeFromTransform() [2/2]

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TOtherPixel , class TUnaryOperation >
static auto sophus::Image< TPixel, TAllocator >::makeFromTransform ( ImageView< TOtherPixel >  view,
TUnaryOperation const &  unary_op 
) -> Image
inlinestatic

Creates new Image given view and unary transform function.

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

◆ makeGenerative()

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TUVOperation >
static auto sophus::Image< TPixel, TAllocator >::makeGenerative ( ImageSize  size,
TUVOperation const &  uv_op 
) -> Image
inlinestatic

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

Memory allocation will happen.

◆ reset()

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
void sophus::Image< TPixel, TAllocator >::reset ( )
inline

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

If use count goes to zero, deallocation happens.

No-op if empty.

◆ useCount()

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
auto sophus::Image< TPixel, TAllocator >::useCount ( ) const -> size_t
inline

Friends And Related Function Documentation

◆ DynImage

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPredicate , class TAllocator2T >
friend class DynImage
friend

◆ MutImage

template<class TPixel , class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TT , class TAllocator2T >
friend class MutImage
friend

The documentation for this class was generated from the following file: