IDS peak ICV v1.3.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
121 PEAK_COMMON_NO_DISCARD Image Process(const Image& image) const;
122
123private:
124 friend peak::common::detail::BackendAccessor<ToneMapping>;
125
126 PEAK_COMMON_NO_DISCARD detail::handle_of_t<ToneMapping> GetHandle() const override;
127
128 peak_icv_tone_mapping_handle m_handle{};
129};
130
132{
134 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Create(&m_handle);
135 });
136}
137
139{
140 if (m_handle != nullptr)
141 {
142 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Destroy(m_handle);
143 }
144}
145
147{
148 peak_icv_tone_mapping_algorithm algorithm;
151 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_GetAlgorithm(m_handle, &algorithm);
152 });
153
154 return static_cast<ToneMappingAlgorithm>(algorithm);
155}
156
157inline detail::handle_of_t<ToneMapping> ToneMapping::GetHandle() const
158{
159 return m_handle;
160}
161
162inline Image ToneMapping::Process(const Image& image) const
163{
164 auto* const inputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(image);
165 peak_common_pixel_format outputPixelFormat;
167 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Process_GetOutputPixelFormat(
168 m_handle, peak::common::detail::CppPixelFormatToCPixelFormat(image.GetPixelFormat()), &outputPixelFormat);
169 });
170
171 Image outputImage{ peak::common::detail::CPixelFormatToCppPixelFormat(outputPixelFormat), image.GetSize() };
172 auto* const outputImageHandle = peak::common::detail::BackendAccessor<Image>::BackendHandle(outputImage);
175 return PEAK_ICV_C_ABI_PREFIX peak_icv_ToneMapping_Process(m_handle, inputImageHandle, outputImageHandle);
176 });
177
178 return outputImage;
179}
180
181} // namespace experimental
182} // namespace icv
183} // 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