farm-ng-core
image.h
Go to the documentation of this file.
1 // Copyright (c) 2011, Hauke Strasdat
2 // Copyright (c) 2012, Steven Lovegrove
3 // Copyright (c) 2021, farm-ng, inc.
4 //
5 // Use of this source code is governed by an MIT-style
6 // license that can be found in the LICENSE file or at
7 // https://opensource.org/licenses/MIT.
8 
9 #pragma once
10 #include "sophus/common/enum.h"
11 #include "sophus/concepts/params.h"
12 
13 namespace sophus {
14 
15 struct ImageSize;
16 class ImageLayout;
17 struct PixelFormat;
18 
19 SOPHUS_ENUM(NumberType, (fixed_point, floating_point));
20 
21 namespace concepts {
22 
23 template <class TT>
24 concept ImageSizeTrait = requires(TT self) {
25  // group operations
26  { self.width() } -> SameAs<int>;
27 
28  { self.height() } -> SameAs<int>;
29 
30  { self.area() } -> SameAs<size_t>;
31 };
32 
33 // Ideally, the LieSubgroupFunctions is not necessary and all these
34 // properties can be deduced.
35 template <class TT>
36 concept ImageLayoutTrait = ImageSizeTrait<TT> && requires(TT self) {
37  { self.sizeBytes() } -> SameAs<size_t>;
38 
39  { self.pitchBytes() } -> SameAs<size_t>;
40 
41  { self.isEmpty() } -> SameAs<bool>;
42 
43  { self.imageSize() } -> ConvertibleTo<sophus::ImageSize>;
44 };
45 
46 template <class TT>
47 concept ImageView = ImageLayoutTrait<TT> && requires(TT self) {
48  { self.layout() } -> ConvertibleTo<sophus::ImageLayout>;
49 };
50 
51 template <class TT>
52 concept DynImageView = ImageLayoutTrait<TT> && requires(TT self) {
53  { self.layout() } -> ConvertibleTo<sophus::ImageLayout>;
54  { self.pixelFormat() } -> ConvertibleTo<PixelFormat>;
55 };
56 
57 } // namespace concepts
58 } // namespace sophus
sophus::DynImageView::layout
auto layout() const -> ImageLayout const &
Definition: dyn_image_view.h:56
sophus
Image MutImage, owning images types.
Definition: num_diff.h:20
sophus::concepts::ImageSizeTrait
concept ImageSizeTrait
Definition: image.h:24
sophus::ImageView
A view of an (immutable) image, which does not own the data.
Definition: image_view.h:55
sophus::ImageView::layout
auto layout() const -> ImageLayout const &
Returns ImageLayout. It is {{0,0}, 0} is view is empty.
Definition: image_view.h:86
sophus::concepts::ImageLayoutTrait
concept ImageLayoutTrait
Definition: image.h:36
sophus::SOPHUS_ENUM
SOPHUS_ENUM(NumberType,(fixed_point, floating_point))
params.h
enum.h
sophus::DynImageView
Definition: dyn_image_view.h:29