CVB++ 15.0
panoramic_mapped_image.hpp
1#pragma once
2
3#include "global.hpp"
4#include "image.hpp"
5
6namespace Cvb
7{
8
9 CVB_BEGIN_INLINE_NS
10
11 template <>
12 inline HandleGuard<PanoramicMappedImage>::HandleGuard(void *handle) noexcept
13 : HandleGuard<PanoramicMappedImage>(handle, [](void *handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
14 {
15 }
17
18 class PanoramicMappedImage : public Image
19 {
20 friend class Image;
21
22 public:
24
30 static std::unique_ptr<PanoramicMappedImage> CreateVertical(const Image &top, const Image &bottom)
31 {
32 return Create(top, bottom, PanoramaDirection::Vertical);
33 }
34
36
42 static std::unique_ptr<PanoramicMappedImage> CreateHorizontal(const Image &left, const Image &right)
43 {
44 return Create(left, right, PanoramaDirection::Horizontal);
45 }
46
48
53 {
54 return direction_;
55 }
56
58
66 static std::unique_ptr<PanoramicMappedImage> FromHandle(HandleGuard<PanoramicMappedImage> &&guard,
67 PanoramaDirection direction)
68 {
69 return Image::FromHandle<PanoramicMappedImage>(HandleGuard<Image>(guard.Release()), direction);
70 }
71
72 private:
73 PanoramicMappedImage(HandleGuard<Image> &&guard, PanoramaDirection direction)
74 : Image(std::move(guard))
75 , direction_(direction)
76 {
77 }
78
79 static std::unique_ptr<PanoramicMappedImage> Create(const Image &image1, const Image &image2,
80 PanoramaDirection direction)
81 {
82 return Internal::DoBoolCallObjectOut<PanoramicMappedImage>(
83 [&](void *&handle) {
84 return CVB_CALL_CAPI(CreatePanoramicImageMap(image1.Handle(), image2.Handle(),
85 static_cast<CExports::TPanoramaMode>(direction), handle));
86 },
87 direction);
88 }
89
90 PanoramaDirection direction_;
91 };
92
93 CVB_END_INLINE_NS
94
95} // namespace Cvb
The Common Vision Blox image.
Definition decl_image.hpp:50
static std::unique_ptr< Image > FromHandle(HandleGuard< Image > &&guard)
Creates an image from a classic API handle.
Definition decl_image.hpp:160
Mapped image of two merged source images.
Definition panoramic_mapped_image.hpp:19
static std::unique_ptr< PanoramicMappedImage > CreateHorizontal(const Image &left, const Image &right)
Creates a new horizontal mapped image.
Definition panoramic_mapped_image.hpp:42
static std::unique_ptr< PanoramicMappedImage > CreateVertical(const Image &top, const Image &bottom)
Creates a new vertical mapped image.
Definition panoramic_mapped_image.hpp:30
static std::unique_ptr< PanoramicMappedImage > FromHandle(HandleGuard< PanoramicMappedImage > &&guard, PanoramaDirection direction)
Creates a panoramic mapped image from a classic API handle.
Definition panoramic_mapped_image.hpp:66
PanoramaDirection Direction() const noexcept
Gets the direction of this panoramic map.
Definition panoramic_mapped_image.hpp:52
cvbbool_t CreatePanoramicImageMap(IMG ImageA, IMG ImageB, TPanoramaMode PanoramaMode, IMG &ImageOut)
cvbbool_t ReleaseObject(OBJ &Object)
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
PanoramaDirection
Defines the direction of the panoramic image.
Definition global.hpp:493
@ Vertical
Images are stitched vertically.
Definition global.hpp:497
@ Horizontal
Images are stitched horizontally.
Definition global.hpp:495