Go to the documentation of this file.
17 template <
class TPredicate = AnyImagePredicate>
23 template <
class TPixel>
27 static_assert(TPredicate::template isTypeValid<TPixel>());
31 template <
class TPixel>
32 [[nodiscard]]
auto has() const noexcept ->
bool {
33 PixelFormat expected_type = PixelFormat::fromTemplate<TPixel>();
45 return const_cast<uint8_t*
>(this->
rawPtr());
56 const size_t row_offset =
57 uv.x() * this->numBytesPerPixelChannel() * this->
numChannels();
65 template <
class TPixel>
67 if (!this->has<TPixel>()) {
68 PixelFormat expected_type = PixelFormat::fromTemplate<TPixel>();
78 this->
layout_,
reinterpret_cast<TPixel const*
>(this->
ptr_));
99 (uint8_t
const*)view.
rawPtr(),
100 view.
layout().pitchBytes(),
102 this->imageSize().width * this->pixel_format_.numBytesPerPixel());
#define SOPHUS_PANIC(...)
Definition: common.h:50
#define SOPHUS_ASSERT(...)
Definition: common.h:40
MutDynImageView()=default
uint8_t const * ptr_
Definition: dyn_image_view.h:148
auto pitchBytes() const -> size_t
Definition: layout.h:57
auto layout() const -> ImageLayout const &
Definition: dyn_image_view.h:56
auto has() const noexcept -> bool
Return true is this contains data of type TPixel.
Definition: mut_dyn_image_view.h:32
Layout of the image: width, height and pitch in bytes.
Definition: layout.h:23
Image MutImage, owning images types.
Definition: num_diff.h:20
auto pixelFormat() const -> PixelFormat
Definition: dyn_image_view.h:75
auto imageSize() const -> ImageSize const &
Definition: dyn_image_view.h:58
auto mutSubview(Eigen::Vector2i uv, sophus::ImageSize size) const -> MutDynImageView
Returns subview with shared ownership semantics of whole image.
Definition: mut_dyn_image_view.h:49
auto isEmpty() const -> bool
Definition: dyn_image_view.h:71
MutDynImageView(ImageLayout const &layout, PixelFormat const &pixel_format, void const *ptr)
Definition: mut_dyn_image_view.h:106
MutDynImageView(MutImageView< TPixel > const &image)
Create type-erased image view from ImageView.
Definition: mut_dyn_image_view.h:24
ImageLayout layout_
Definition: dyn_image_view.h:146
auto numChannels() const -> int
Definition: dyn_image_view.h:78
PixelFormat pixel_format_
Definition: dyn_image_view.h:147
auto pitchBytes() const -> size_t
Definition: dyn_image_view.h:65
#define SOPHUS_ASSERT_EQ(...)
Definition: common.h:41
#define SOPHUS_ASSERT_LE(...)
Definition: common.h:44
auto mutImageView() const noexcept -> MutImageView< TPixel >
Returns typed image view.
Definition: mut_dyn_image_view.h:66
void copyDataFrom(DynImageView< TPredicate > view) const
Copies data from view into this.
Definition: mut_dyn_image_view.h:88
View of a mutable image, which does not own the data.
Definition: mut_image_view.h:61
auto rawPtr() const -> uint8_t const *
Definition: dyn_image_view.h:54
auto rawMutPtr() const -> uint8_t *
Definition: mut_dyn_image_view.h:44
Image size, hence its width and height.
Definition: image_size.h:21
Definition: mut_dyn_image_view.h:18
auto rawMutRowPtr(int v) const -> uint8_t *
Returns v-th row pointer.
Definition: mut_dyn_image_view.h:40
Definition: dyn_image_view.h:29