farm-ng-core
sophus::DynImage< TPredicate, TAllocator > Class Template Reference

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

#include <dyn_image.h>

Inheritance diagram for sophus::DynImage< TPredicate, TAllocator >:
Collaboration diagram for sophus::DynImage< TPredicate, TAllocator >:

Public Member Functions

 DynImage ()=default
 Empty image. More...
 
template<class TPixel >
 DynImage (Image< TPixel, TAllocator > const &image)
 Create type-erased image from Image. More...
 
template<class TPixel >
 DynImage (MutImage< TPixel > &&image)
 Create type-erased image from MutImage. By design not "explicit". More...
 
 DynImage (MutDynImage< TPredicate, TAllocator > &&image)
 Create type-erased image from MutImage. By design not "explicit". More...
 
template<class TPixel >
auto has () const noexcept -> bool
 Return true is this contains data of type TPixel. More...
 
template<class TPixel >
auto image () const noexcept -> Image< TPixel, TAllocator >
 Returns typed image. More...
 
template<class TPixel >
auto reinterpretAs (ImageSize reinterpreted_size) const noexcept -> Image< TPixel, TAllocator >
 
auto useCount () const -> size_t
 
- Public Member Functions inherited from sophus::DynImageView< AnyImagePredicate >
 DynImageView (ImageView< TPixel > const &image)
 Create type-erased image view from ImageView. More...
 
auto has () const noexcept -> bool
 
auto rawRowPtr (int v) const -> uint8_t const *
 Returns v-th row pointer. More...
 
auto rawPtr () const -> uint8_t const *
 
auto layout () const -> ImageLayout const &
 
auto imageSize () const -> ImageSize const &
 
auto area () const -> size_t
 
auto width () const -> int
 
auto height () const -> int
 
auto pitchBytes () const -> size_t
 
auto sizeBytes () const -> size_t
 
auto isEmpty () const -> bool
 
auto pixelFormat () const -> PixelFormat
 
auto numChannels () const -> int
 
auto subview (Eigen::Vector2i uv, sophus::ImageSize size) const -> DynImageView
 Returns subview with shared ownership semantics of whole image. More...
 
auto imageView () const noexcept -> ImageView< TPixel >
 Returns typed image. More...
 
void setViewToEmpty ()
 

Static Public Member Functions

static Expected< DynImage< TPredicate, TAllocator > > tryFromFormat (ImageSize const &size, PixelFormat const &pixel_format)
 Tries to create image from provided size and format. Returns error if format does not satisfy TPredicate. More...
 
static DynImage< TPredicate, TAllocator > fromFormat (ImageSize const &size, PixelFormat const &pixel_format)
 
static DynImage< TPredicate, TAllocator > fromFormat (ImageLayout const &layout, PixelFormat const &pixel_format)
 
static Expected< DynImage< TPredicate, TAllocator > > tryFromFormat (ImageLayout const &layout, PixelFormat const &pixel_format)
 Tries to create image from provided size and format. Returns error if format does not satisfy TPredicate. More...
 
template<class TOtherPredicate >
static auto tryFrom (DynImage< TOtherPredicate, TAllocator > other_image) -> Expected< DynImage< TPredicate, TAllocator >>
 
- Static Public Member Functions inherited from sophus::DynImageView< AnyImagePredicate >
static DynImageView unsafeWrapAndPromiseProperAlignment (ImageLayout const &layout, PixelFormat const &pixel_format, void const *ptr)
 

Protected Member Functions

 DynImage (ImageLayout layout, PixelFormat pixel_format, std::shared_ptr< uint8_t > shared)
 
- Protected Member Functions inherited from sophus::DynImageView< AnyImagePredicate >
 DynImageView ()=default
 
 DynImageView (ImageLayout const &layout, PixelFormat const &pixel_format, void const *ptr)
 

Protected Attributes

std::shared_ptr< uint8_t > shared_
 
- Protected Attributes inherited from sophus::DynImageView< AnyImagePredicate >
ImageLayout layout_
 
PixelFormat pixel_format_
 
uint8_t const * ptr_
 

Friends

template<class TPredicate2 , class TAllocator2T >
class DynImage
 

Detailed Description

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
class sophus::DynImage< TPredicate, TAllocator >

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

Constructor & Destructor Documentation

◆ DynImage() [1/5]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
sophus::DynImage< TPredicate, TAllocator >::DynImage ( )
default

Empty image.

◆ DynImage() [2/5]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPixel >
sophus::DynImage< TPredicate, TAllocator >::DynImage ( Image< TPixel, TAllocator > const &  image)
inline

Create type-erased image from Image.

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

◆ DynImage() [3/5]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPixel >
sophus::DynImage< TPredicate, TAllocator >::DynImage ( MutImage< TPixel > &&  image)
inline

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

◆ DynImage() [4/5]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
sophus::DynImage< TPredicate, TAllocator >::DynImage ( MutDynImage< TPredicate, TAllocator > &&  image)
inline

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

◆ DynImage() [5/5]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
sophus::DynImage< TPredicate, TAllocator >::DynImage ( ImageLayout  layout,
PixelFormat  pixel_format,
std::shared_ptr< uint8_t >  shared 
)
inlineprotected

Member Function Documentation

◆ fromFormat() [1/2]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
static DynImage<TPredicate, TAllocator> sophus::DynImage< TPredicate, TAllocator >::fromFormat ( ImageLayout const &  layout,
PixelFormat const &  pixel_format 
)
inlinestatic

◆ fromFormat() [2/2]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
static DynImage<TPredicate, TAllocator> sophus::DynImage< TPredicate, TAllocator >::fromFormat ( ImageSize const &  size,
PixelFormat const &  pixel_format 
)
inlinestatic

◆ has()

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPixel >
auto sophus::DynImage< TPredicate, TAllocator >::has ( ) const -> bool
inlinenoexcept

Return true is this contains data of type TPixel.

◆ image()

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPixel >
auto sophus::DynImage< TPredicate, TAllocator >::image ( ) const -> Image<TPixel, TAllocator>
inlinenoexcept

Returns typed image.

Precondition: this->has<TPixel>()

◆ reinterpretAs()

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TPixel >
auto sophus::DynImage< TPredicate, TAllocator >::reinterpretAs ( ImageSize  reinterpreted_size) const -> Image<TPixel, TAllocator>
inlinenoexcept

◆ tryFrom()

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
template<class TOtherPredicate >
static auto sophus::DynImage< TPredicate, TAllocator >::tryFrom ( DynImage< TOtherPredicate, TAllocator >  other_image) -> Expected<DynImage<TPredicate, TAllocator>>
inlinestatic

◆ tryFromFormat() [1/2]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
static Expected<DynImage<TPredicate, TAllocator> > sophus::DynImage< TPredicate, TAllocator >::tryFromFormat ( ImageLayout const &  layout,
PixelFormat const &  pixel_format 
)
inlinestatic

Tries to create image from provided size and format. Returns error if format does not satisfy TPredicate.

◆ tryFromFormat() [2/2]

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
static Expected<DynImage<TPredicate, TAllocator> > sophus::DynImage< TPredicate, TAllocator >::tryFromFormat ( ImageSize const &  size,
PixelFormat const &  pixel_format 
)
inlinestatic

Tries to create image from provided size and format. Returns error if format does not satisfy TPredicate.

◆ useCount()

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

Friends And Related Function Documentation

◆ DynImage

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

Member Data Documentation

◆ shared_

template<class TPredicate = AnyImagePredicate, class TAllocator = Eigen::aligned_allocator<uint8_t>>
std::shared_ptr<uint8_t> sophus::DynImage< TPredicate, TAllocator >::shared_
protected

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