farm-ng-core
image_types.h File Reference
Include dependency graph for image_types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sophus::ImageTraits< TT >
 Number type. More...
 
struct  sophus::ImageTraits< Eigen::Matrix< TT, kNumChannelsT, 1 > >
 

Namespaces

 sophus
 Image MutImage, owning images types.
 

Macros

#define SOPHUS_ASSERT_IMAGE_EQ(left_image, right_image, ...)
 If it is false that left_image == right_image, print formatted error message and then panic. More...
 

Typedefs

template<class TChannel >
using sophus::Pixel2 = Eigen::Matrix< TChannel, 2, 1 >
 
using sophus::Pixel2U8 = Pixel2< uint8_t >
 
using sophus::Pixel2U16 = Pixel2< uint16_t >
 
using sophus::Pixel2F32 = Pixel2< float >
 
template<class TChannel >
using sophus::Pixel3 = Eigen::Matrix< TChannel, 3, 1 >
 
using sophus::Pixel3U8 = Pixel3< uint8_t >
 
using sophus::Pixel3U16 = Pixel3< uint16_t >
 
using sophus::Pixel3F32 = Pixel3< float >
 
template<class TChannel >
using sophus::Pixel4 = Eigen::Matrix< TChannel, 4, 1 >
 
using sophus::Pixel4U8 = Pixel4< uint8_t >
 
using sophus::Pixel4U16 = Pixel4< uint16_t >
 
using sophus::Pixel4F32 = Pixel4< float >
 
using sophus::ImageViewBool = ImageView< bool >
 
using sophus::MutImageViewBool = MutImageView< bool >
 
using sophus::ImageViewU8 = ImageView< uint8_t >
 
using sophus::ImageViewU16 = ImageView< uint16_t >
 
using sophus::ImageViewF32 = ImageView< float >
 
using sophus::MutImageViewU8 = MutImageView< uint8_t >
 
using sophus::MutImageViewU16 = MutImageView< uint16_t >
 
using sophus::MutImageViewF32 = MutImageView< float >
 
template<class TChannel >
using sophus::ImageView3 = ImageView< Pixel3< TChannel > >
 
using sophus::ImageView3U8 = ImageView3< uint8_t >
 
using sophus::ImageView3U16 = ImageView3< uint16_t >
 
using sophus::ImageView3F32 = ImageView3< float >
 
template<class TChannel >
using sophus::MutImageView3 = MutImageView< Pixel3< TChannel > >
 
using sophus::MutImageView3U8 = MutImageView3< uint8_t >
 
using sophus::MutImageView3U16 = MutImageView3< uint16_t >
 
using sophus::MutImageView3F32 = MutImageView3< float >
 
template<class TChannel >
using sophus::ImageView4 = ImageView< Pixel4< TChannel > >
 
using sophus::ImageView4U8 = ImageView4< uint8_t >
 
using sophus::ImageView4U16 = ImageView4< uint16_t >
 
using sophus::ImageView4F32 = ImageView4< float >
 
template<class TChannel >
using sophus::MutImageView4 = MutImageView< Pixel4< TChannel > >
 
using sophus::MutImageView4U8 = MutImageView4< uint8_t >
 
using sophus::MutImageView4U16 = MutImageView4< uint16_t >
 
using sophus::MutImageView4F32 = MutImageView4< float >
 
using sophus::ImageBool = Image< bool >
 
using sophus::MutImageBool = MutImage< bool >
 
using sophus::ImageU8 = Image< uint8_t >
 
using sophus::ImageU16 = Image< uint16_t >
 
using sophus::ImageF32 = Image< float >
 
using sophus::MutImageU8 = MutImage< uint8_t >
 
using sophus::MutImageU16 = MutImage< uint16_t >
 
using sophus::MutImageF32 = MutImage< float >
 
template<class TChannel >
using sophus::Image3 = Image< Pixel3< TChannel > >
 
using sophus::Image3U8 = Image3< uint8_t >
 
using sophus::Image3U16 = Image3< uint16_t >
 
using sophus::Image3F32 = Image3< float >
 
template<class TChannel >
using sophus::MutImage3 = MutImage< Pixel3< TChannel > >
 
using sophus::MutImage3U8 = MutImage3< uint8_t >
 
using sophus::MutImage3U16 = MutImage3< uint16_t >
 
using sophus::MutImage3F32 = MutImage3< float >
 
template<class TChannel >
using sophus::Image4 = Image< Pixel4< TChannel > >
 
using sophus::Image4U8 = Image4< uint8_t >
 
using sophus::Image4U16 = Image4< uint16_t >
 
using sophus::Image4F32 = Image4< float >
 
template<class TChannel >
using sophus::MutImage4 = MutImage< Pixel4< TChannel > >
 
using sophus::MutImage4U8 = MutImage4< uint8_t >
 
using sophus::MutImage4U16 = MutImage4< uint16_t >
 
using sophus::MutImage4F32 = MutImage4< float >
 

Functions

template<class TPixel >
auto sophus::isEqualMask (ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
 Returns boolean image with the result per pixel: More...
 
template<class TPixel >
auto sophus::isLessMask (ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
 Returns boolean image with the result per pixel: More...
 
template<class TPixel >
auto sophus::isGreaterMask (ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
 Returns boolean image with the result per pixel: More...
 
template<class TPixel >
auto sophus::isNearMask (ImageView< TPixel > lhs, ImageView< TPixel > rhs, typename ImageTraits< TPixel >::ChannelT thr) -> MutImageBool
 Returns boolean image with the result per pixel: More...
 
auto sophus::count (ImageViewBool mask, bool truth_value) -> int
 Returns number of pixels equal truth_value in mask. More...
 
auto sophus::countTrue (ImageViewBool mask) -> int
 Returns number of true pixels in mask. More...
 
auto sophus::countFalse (ImageViewBool mask) -> int
 Returns number of false pixels in mask. More...
 
auto sophus::isAllTrue (ImageViewBool mask) -> bool
 Returns true if all pixels are true. More...
 
auto sophus::isAnyTrue (ImageViewBool mask) -> bool
 Returns true if at least one pixel is true. More...
 
auto sophus::neg (ImageViewBool mask) -> MutImageBool
 Returns boolean image with the result per pixel: More...
 
auto sophus::firstPixel (ImageViewBool mask, bool truth_value) -> std::optional< Eigen::Vector2i >
 Returns first pixel of mask which equals truth_value, nullopt otherwise. More...
 
auto sophus::firstTruePixel (ImageViewBool mask) -> std::optional< Eigen::Vector2i >
 Returns first true pixel, nullopt otherwise. More...
 
auto sophus::firstFalsePixel (ImageViewBool mask) -> std::optional< Eigen::Vector2i >
 Returns first false pixel, nullopt otherwise. More...
 

Macro Definition Documentation

◆ SOPHUS_ASSERT_IMAGE_EQ

#define SOPHUS_ASSERT_IMAGE_EQ (   left_image,
  right_image,
  ... 
)
Value:
(left_image).imageSize(), \
(right_image).imageSize(), \
"Inside: SOPHUS_ASSERT_IMAGE_EQ."); \
do { \
if (!(left_image).hasSameData(right_image)) { \
::sophus::MutImageBool mask = isEqualMask((left_image), (right_image)); \
FARM_IMPL_LOG_HEADER("SOPHUS_ASSERT_IMAGE_EQ failed"); \
FARM_IMPL_LOG_PRINTLN( \
"Number of pixel failing: {} / {}", \
countFalse(mask), \
mask.imageSize().area()); \
auto maybe_uv = firstFalsePixel(mask); \
::Eigen::Vector2i uv = SOPHUS_UNWRAP(maybe_uv); \
int u = uv[0]; \
int v = uv[1]; \
FARM_IMPL_LOG_PRINTLN( \
"First failed pixel: ({},{}).\nLeft:\n{}\nRigth:\n{}", \
u, \
v, \
left_image(u, v), \
right_image(u, v)); \
FARM_IMPL_LOG_PRINTLN(__VA_ARGS__); \
FARM_IMPL_ABORT(); \
} \
} while (false)

If it is false that left_image == right_image, print formatted error message and then panic.

SOPHUS_UNWRAP
#define SOPHUS_UNWRAP(...)
Definition: common.h:52
sophus::isEqualMask
auto isEqualMask(ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.h:139
sophus::MutImage
A image with write access to pixels and exclusive ownership. There is no copy constr / copy assignmen...
Definition: image_view.h:32
SOPHUS_ASSERT_EQ
#define SOPHUS_ASSERT_EQ(...)
Definition: common.h:41
sophus::countFalse
auto countFalse(ImageViewBool mask) -> int
Returns number of false pixels in mask.
Definition: image_types.cpp:23
sophus::firstFalsePixel
auto firstFalsePixel(ImageViewBool mask) -> std::optional< Eigen::Vector2i >
Returns first false pixel, nullopt otherwise.
Definition: image_types.cpp:70