16#include <peak_icv_c/algorithms/preprocessing/peak_icv_image_converter.h>
134 PEAK_COMMON_NO_DISCARD
bool IsEnabled()
const override;
143 PEAK_COMMON_NO_DISCARD
const char*
GetType()
const override;
214 static constexpr int moduleVersion{ 1 };
215 static constexpr auto outputPixelFormatKey{
"OutputPixelFormat" };
218 bool m_enabled{
true };
219 peak_icv_image_converter_handle m_handle{};
225 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Create(&m_handle);
231 if (m_handle !=
nullptr)
233 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Destroy(m_handle);
239 m_outputPixelFormat = other.m_outputPixelFormat;
240 m_enabled = other.m_enabled;
241 std::swap(m_handle, other.m_handle);
248 m_outputPixelFormat = other.m_outputPixelFormat;
249 m_enabled = other.m_enabled;
250 std::swap(m_handle, other.m_handle);
259 archive.
SetInt(
"Version", moduleVersion);
266 const auto version = archive.
GetInt(
"Version");
275 m_outputPixelFormat = format;
280 return m_outputPixelFormat;
300 return "PixelFormatConversion";
319 if (inputFormat == m_outputPixelFormat)
324 auto*
const inputImageHandle = peak::common::detail::BackendAccessor<peak::icv::Image>::BackendHandle(inputImage);
328 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Convert(
332 return peak::common::Any(peak::common::detail::BackendAccessor<peak::icv::Image>::CreateInstance(outputHandle));
338 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_ReleaseBuffers(m_handle);
A type-erased container for any copyable value.
T & AnyCast()
Casts the stored value to the specified type.
Interface for a hierarchical key-value archive system.
virtual void SetBool(const std::string &key, bool value)=0
Stores a boolean value.
virtual void SetInt(const std::string &key, int64_t value)=0
Stores a 64-bit signed integer.
virtual int64_t GetInt(const std::string &key) const =0
Retrieves a 64-bit signed integer by key.
virtual std::string GetString(const std::string &key) const =0
Retrieves a string value by key.
virtual bool GetBool(const std::string &key) const =0
Retrieves a boolean value by key.
virtual void SetString(const std::string &key, const std::string &value)=0
Stores a UTF-8 string.
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
peak::common::PixelFormat GetPixelFormat() const
Provides the pixel format of the image.
Interface for a module used within a pipeline.
PixelFormat
Enum listing all supported pixel formats and their internal IDs.
@ RGB8
RGB 8-Bit pixel format.
constexpr peak_common_pixel_format CppPixelFormatToCPixelFormat(PixelFormat pixelFormat) noexcept
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
void ValidateVersion(int64_t version, const std::string &moduleName)
peak_icv_image * peak_icv_image_handle