You’re reading an older version of the Slamcore SDK documenation. The latest one is 23.01.

File const_image_view.hpp

Const Image View wrapper for Image Interface.

namespace slamcore

Main namespace for the SLAMcore public API

Get information about the client library

Helper conversion methods

slamcore::ImageFormat \(\leftrightarrow\) BytesPerPixel

template<class T>
class ConstImageView
#include <const_image_view.hpp>

Convenience constant pixel accessor wrapper for ImageInterface.

Public Functions

inline ConstImageView(const slamcore::ImageInterface &image)

Construct ConstImageView from ImageInterface.

The image format must be suitable for the image view, this means that the bytes per pixel must fit the image view’s pixel type, otherwise a runtime error is thrown.

Parameters

image – The image to construct the view around.

inline T operator()(const std::size_t row, const std::size_t col) const

Access to a specific pixel of the image.

This should never be called with arguments row or column out of bounds, since it would cause undefined behaviour.

Parameters
  • row – Row to access to.

  • col – Column to access to.

inline T at(const std::size_t row, const std::size_t col) const

Access to a specific pixel of the image.

As opposed to operator(), this performs a bounds check, and a runtime error is thrown if the requested row or column are out of bounds.

Parameters
  • row – Row to access to.

  • col – Column to access to.

Private Functions

inline T getImpl(const std::size_t row, const std::size_t col) const

Private Members

const uint8_t *m_data = {nullptr}
const size_t m_width = {0}
const size_t m_height = {0}
const size_t m_pitch = {0}
const size_t m_bytesPerPixel = {0}