16#include <peak_icv_c/algorithms/preprocessing/peak_icv_image_converter.h>
114 PEAK_COMMON_NO_DISCARD
bool IsEnabled()
const override;
123 PEAK_COMMON_NO_DISCARD
const char*
GetType()
const override;
231 PEAK_COMMON_NO_DISCARD
size_t GetOutputBitDepth(
size_t inputBitDepth)
const;
239 peak_icv_image_converter_handle m_handle{};
241 size_t m_targetBitDepth{ 8 };
248 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Create(&m_handle);
254 if (m_handle !=
nullptr)
256 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Destroy(m_handle);
262 std::swap(m_handle, other.m_handle);
269 std::swap(m_handle, other.m_handle);
277 std::ignore = archive;
282 std::ignore = archive;
287 std::ignore = enable;
312 return BayerBGFormat(outputBitDepth);
321 return BayerGBFormat(outputBitDepth);
330 return BayerGRFormat(outputBitDepth);
339 return BayerRGFormat(outputBitDepth);
348 return MonoFormat(outputBitDepth);
428 m_targetBitDepth = 8;
433 m_targetBitDepth = bitDepth;
438 return m_targetBitDepth;
456inline size_t UnpackModule::GetOutputBitDepth(
const size_t inputBitDepth)
const
460 return (std::min)(inputBitDepth, m_targetBitDepth);
464 return (std::max)(inputBitDepth, m_targetBitDepth);
466 return inputBitDepth;
475 const auto outputBitDepth = GetOutputBitDepth(inputBitDepth);
476 const auto outputFormat = GetOutputFormat(inputFormat, outputBitDepth);
478 if (inputFormat == outputFormat)
483 auto*
const inputImageHandle = peak::common::detail::BackendAccessor<peak::icv::Image>::BackendHandle(inputImage);
487 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_ImageConverter_Convert(
491 return peak::common::Any(peak::common::detail::BackendAccessor<peak::icv::Image>::CreateInstance(outputHandle));
497 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.
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.
Unpack is an image pipeline module that converts packed pixel formats into corresponding unpacked Bay...
size_t GetTargetBitDepth() const
Get the target bit depth used during image processing.
UnpackModule()
Creates an instance of class UnpackModule.
const char * GetType() const override
Returns the type of the module for serialization purposes.
void SetEnabled(bool enable) override
Does nothing. The module is always enabled, because otherwise following modules will fail.
void ReleaseBuffers() const
Frees unused internal buffers.
UnpackModule & operator=(const UnpackModule &other)=delete
Copy assignment for class UnpackModule is deleted.
void Serialize(peak::common::serialization::IArchive &archive) const override
This function has no effect on the Unpack module.
peak::icv::Image Process(const peak::icv::Image &input) const
Converts a packed pixel format image into an unpacked Bayer or monochrome format.
ProcessingPolicy GetProcessingPolicy() const
Get the currently configured processing policy.
void Deserialize(const peak::common::serialization::IArchive &archive) override
This function has no effect on the unpack module.
void SetProcessingPolicy(ProcessingPolicy policy)
Set the processing policy.
void ResetToDefault() override
Resets all module settings.
UnpackModule(const UnpackModule &other)=delete
Copy constructor for class UnpackModule is deleted.
void SetTargetBitDepth(size_t bitDepth)
Set the target bit depth.
bool IsEnabled() const override
Returns true since the unpack module is always enabled.
Interface for a module used within a pipeline.
PixelFormat
Enum listing all supported pixel formats and their internal IDs.
@ BayerRG12g24IDS
BayerRG 12-Bit grouped 24-bit (IDS)
@ RGB8
RGB 8-Bit pixel format.
@ Mono12p
Mono 12-Bit packed format.
@ Mono12
Mono 12-Bit pixel format.
@ BayerGB10
BayerGB 10-Bit pixel format.
@ BayerRG12p
BayerRG 12-Bit packed format.
@ BayerBG10
BayerBG 10-Bit pixel format.
@ Mono10g40IDS
Mono 10-Bit grouped 40-bit (IDS)
@ BayerGR10g40IDS
BayerGR 10-Bit grouped 40-bit (IDS)
@ BayerBG10p
BayerBG 10-Bit packed format.
@ BayerGB12p
BayerGB 12-Bit packed format.
@ BayerGR12
BayerGR 12-Bit pixel format.
@ BayerRG10p
BayerRG 10-Bit packed format.
@ BayerRG12
BayerRG 12-Bit pixel format.
@ BayerGR12p
BayerGR 12-Bit packed format.
@ BayerGR8
BayerGR 8-Bit pixel format.
@ BayerBG12p
BayerBG 12-Bit packed format.
@ BayerBG8
BayerBG 8-Bit pixel format.
@ Mono12g24IDS
Mono 12-Bit grouped 24-bit (IDS)
@ BayerRG10
BayerRG 10-Bit pixel format.
@ BayerGB12
BayerGB 12-Bit pixel format.
@ BayerRG8
BayerRG 8-Bit pixel format.
@ BayerGR10p
BayerGR 10-Bit packed format.
@ YUV422_8_UYVY
UYVY 4:2:2 8-Bit format.
@ YUV420_8_YY_VU_SemiplanarIDS
YUV4:2:0 8-Bit YY/VU semiplanar (IDS)
@ BayerGB8
BayerGB 8-Bit pixel format.
@ BayerGR12g24IDS
BayerGR 12-Bit grouped 24-bit (IDS)
@ YUV420_8_YY_UV_SemiplanarIDS
YUV4:2:0 8-Bit YY/UV semiplanar (IDS)
@ BayerGR10
BayerGR 10-Bit pixel format.
@ Mono10
Mono 10-Bit pixel format.
@ Mono8
Mono 8-Bit pixel format.
@ BayerBG12
BayerBG 12-Bit pixel format.
@ BayerBG10g40IDS
BayerBG 10-Bit grouped 40-bit (IDS)
@ BayerGB10p
BayerGB 10-Bit packed format.
@ BayerBG12g24IDS
BayerBG 12-Bit grouped 24-bit (IDS)
@ Mono10p
Mono 10-Bit packed format.
@ BayerRG10g40IDS
BayerRG 10-Bit grouped 40-bit (IDS)
@ BayerGB10g40IDS
BayerGB 10-Bit grouped 40-bit (IDS)
@ BayerGB12g24IDS
BayerGB 12-Bit grouped 24-bit (IDS)
ProcessingPolicy
Specifies the processing policy.
@ Enhanced
Prefer quality.
constexpr peak_common_pixel_format CppPixelFormatToCPixelFormat(PixelFormat pixelFormat) noexcept
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
peak_icv_image * peak_icv_image_handle