Go to the documentation of this file.
17 template <
class TChannel>
18 using Pixel2 = Eigen::Matrix<TChannel, 2, 1>;
23 template <
class TChannel>
24 using Pixel3 = Eigen::Matrix<TChannel, 3, 1>;
29 template <
class TChannel>
30 using Pixel4 = Eigen::Matrix<TChannel, 4, 1>;
43 static_assert(concepts::ImageView<ImageViewF32>);
49 static_assert(concepts::ImageView<MutImageViewF32>);
51 template <
class TChannel>
57 static_assert(concepts::ImageView<ImageView3F32>);
59 template <
class TChannel>
65 static_assert(concepts::ImageView<MutImageView3F32>);
67 template <
class TChannel>
73 template <
class TChannel>
91 template <
class TChannel>
97 template <
class TChannel>
103 template <
class TChannel>
109 template <
class TChannel>
123 std::is_floating_point_v<ChannelT> || std::is_unsigned_v<ChannelT>);
126 template <
class TT,
int kNumChannelsT>
129 using TPixel = Eigen::Matrix<TT, kNumChannels, 1>;
132 std::is_floating_point_v<ChannelT> || std::is_unsigned_v<ChannelT>);
138 template <
class TPixel>
141 lhs, rhs, [](TPixel lhs, TPixel rhs) {
return lhs == rhs; });
147 template <
class TPixel>
150 lhs, rhs, [](TPixel lhs, TPixel rhs) {
return lhs < rhs; });
156 template <
class TPixel>
160 lhs, rhs, [](TPixel lhs, TPixel rhs) {
return lhs > rhs; });
166 template <
class TPixel>
172 lhs, rhs, [thr](TPixel lhs, TPixel rhs) {
173 return MaxMetric(lhs, rhs) <= thr;
199 -> std::optional<Eigen::Vector2i>;
209 #define SOPHUS_ASSERT_IMAGE_EQ(left_image, right_image, ...) \
211 (left_image).imageSize(), \
212 (right_image).imageSize(), \
213 "Inside: SOPHUS_ASSERT_IMAGE_EQ."); \
215 if (!(left_image).hasSameData(right_image)) { \
216 ::sophus::MutImageBool mask = isEqualMask((left_image), (right_image)); \
217 FARM_IMPL_LOG_HEADER("SOPHUS_ASSERT_IMAGE_EQ failed"); \
218 FARM_IMPL_LOG_PRINTLN( \
219 "Number of pixel failing: {} / {}", \
221 mask.imageSize().area()); \
222 auto maybe_uv = firstFalsePixel(mask); \
223 ::Eigen::Vector2i uv = SOPHUS_UNWRAP(maybe_uv); \
226 FARM_IMPL_LOG_PRINTLN( \
227 "First failed pixel: ({},{}).\nLeft:\n{}\nRigth:\n{}", \
231 right_image(u, v)); \
232 FARM_IMPL_LOG_PRINTLN(__VA_ARGS__); \
Pixel2< uint16_t > Pixel2U16
Definition: image_types.h:20
TT ChannelT
Definition: image_types.h:130
auto isGreaterMask(ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.h:157
auto isAllTrue(ImageViewBool mask) -> bool
Returns true if all pixels are true.
Definition: image_types.cpp:25
ImageView< bool > ImageViewBool
Definition: image_types.h:36
Image read-only access to pixels and shared ownership, hence cheap to copy. Type is nullable.
Definition: image.h:31
Image MutImage, owning images types.
Definition: num_diff.h:20
Eigen::Matrix< TT, kNumChannels, 1 > TPixel
Definition: image_types.h:129
auto firstPixel(ImageViewBool mask, bool truth_value) -> std::optional< Eigen::Vector2i >
Returns first pixel of mask which equals truth_value, nullopt otherwise.
Definition: image_types.cpp:53
A view of an (immutable) image, which does not own the data.
Definition: image_view.h:55
Eigen::Matrix< TChannel, 3, 1 > Pixel3
Definition: image_types.h:24
Eigen::Matrix< TChannel, 2, 1 > Pixel2
Definition: image_types.h:18
static auto makeFromTransform(ImageView< TOtherPixel > view, TUnaryOperation const &unary_op) -> MutImage
Creates new MutImage given view and unary transform function.
Definition: mut_image.h:135
auto isLessMask(ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.h:148
auto isNearMask(ImageView< TPixel > lhs, ImageView< TPixel > rhs, typename ImageTraits< TPixel >::ChannelT thr) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.h:167
Pixel3< uint8_t > Pixel3U8
Definition: image_types.h:25
Eigen::Matrix< TChannel, 4, 1 > Pixel4
Definition: image_types.h:30
Pixel3< float > Pixel3F32
Definition: image_types.h:27
TPixel ChannelT
Definition: image_types.h:121
auto isEqualMask(ImageView< TPixel > lhs, ImageView< TPixel > rhs) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.h:139
Pixel4< float > Pixel4F32
Definition: image_types.h:33
Number type.
Definition: image_types.h:118
A image with write access to pixels and exclusive ownership. There is no copy constr / copy assignmen...
Definition: image_view.h:32
MutImage< bool > MutImageBool
Definition: image_types.h:81
auto neg(ImageViewBool mask) -> MutImageBool
Returns boolean image with the result per pixel:
Definition: image_types.cpp:49
auto count(ImageViewBool mask, bool truth_value) -> int
Returns number of pixels equal truth_value in mask.
Definition: image_types.cpp:13
Pixel2< float > Pixel2F32
Definition: image_types.h:21
auto firstTruePixel(ImageViewBool mask) -> std::optional< Eigen::Vector2i >
Returns first true pixel, nullopt otherwise.
Definition: image_types.cpp:66
auto isAnyTrue(ImageViewBool mask) -> bool
Returns true if at least one pixel is true.
Definition: image_types.cpp:37
TT TPixel
Definition: image_types.h:120
auto countTrue(ImageViewBool mask) -> int
Returns number of true pixels in mask.
Definition: image_types.cpp:21
Pixel2< uint8_t > Pixel2U8
Definition: image_types.h:19
auto countFalse(ImageViewBool mask) -> int
Returns number of false pixels in mask.
Definition: image_types.cpp:23
View of a mutable image, which does not own the data.
Definition: mut_image_view.h:61
Pixel3< uint16_t > Pixel3U16
Definition: image_types.h:26
Pixel4< uint8_t > Pixel4U8
Definition: image_types.h:31
auto firstFalsePixel(ImageViewBool mask) -> std::optional< Eigen::Vector2i >
Returns first false pixel, nullopt otherwise.
Definition: image_types.cpp:70
static const int kNumChannels
Definition: image_types.h:119
Pixel4< uint16_t > Pixel4U16
Definition: image_types.h:32