IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
peak_icv_tone_mapping.hpp
Go to the documentation of this file.
1
11#pragma once
12
15#include <peak_icv_c/algorithms/hdr/peak_icv_tone_mapping.h>
16#include <utility>
17
18namespace peak
19{
20namespace icv
21{
22namespace experimental
23{
39{
47 Reinhard = 0,
48};
49
70{
71public:
80 explicit ToneMapping();
81
89 ~ToneMapping() override;
90
101 PEAK_COMMON_NO_DISCARD ToneMappingAlgorithm GetAlgorithm() const;
102
119 PEAK_COMMON_NO_DISCARD Image Process(const Image& image) const;
120
121private:
122 friend peak::common::detail::BackendAccessor<ToneMapping>;
123
124 PEAK_COMMON_NO_DISCARD detail::handle_of_t<ToneMapping> GetHandle() const override;
125
126 peak_icv_tone_mapping_handle m_handle{};
127};
128
130{
132 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Create(&m_handle);
133 });
134}
135
137{
138 if (m_handle != nullptr)
139 {
140 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Destroy(m_handle);
141 }
142}
143
145{
146 peak_icv_tone_mapping_algorithm algorithm;
147
149 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_GetAlgorithm(m_handle, &algorithm);
150 });
151
152 return static_cast<ToneMappingAlgorithm>(algorithm);
153}
154
155inline detail::handle_of_t<ToneMapping> ToneMapping::GetHandle() const
156{
157 return m_handle;
158}
159
160inline Image ToneMapping::Process(const Image& image) const
161{
162 auto* const inputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
163 peak_common_pixel_format outputPixelFormat;
165 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Process_GetOutputPixelFormat(
166 m_handle, peak::common::detail::CppPixelFormatToCPixelFormat(image.GetPixelFormat()), &outputPixelFormat);
167 });
168
169 Image outputImage{ peak::common::detail::CPixelFormatToCppPixelFormat(outputPixelFormat), image.GetSize() };
170 auto* const outputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(outputImage);
171
173 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Process(m_handle, inputImageHandle, outputImageHandle);
174 });
175
176 return outputImage;
177}
178
179} // namespace experimental
180} // namespace icv
181} // namespace peak
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
peak::common::Size GetSize() const
Provides the size of the image in pixels.
peak::common::PixelFormat GetPixelFormat() const
Provides the pixel format of the image.
Performs tone mapping on HDR images.
Image Process(const Image &image) const
Applies tone mapping to an HDR image.
ToneMappingAlgorithm GetAlgorithm() const
Returns the tone mapping algorithm used by this object.
~ToneMapping() override
Destroys the tone mapping object.
ToneMapping()
Constructs a tone mapping object.
ToneMappingAlgorithm
Specifies the tone mapping algorithm.
@ Reinhard
Reinhard tone mapping operator.
constexpr peak_common_pixel_format CppPixelFormatToCPixelFormat(PixelFormat pixelFormat) noexcept
constexpr PixelFormat CPixelFormatToCppPixelFormat(peak_common_pixel_format pixelFormat) noexcept
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
peak::common::detail::c_type_of_t< Type > * handle_of_t