15#include <peak_icv_c/algorithms/filters/peak_icv_median_filter.h>
16#include <peak_icv_c/algorithms/preprocessing/peak_icv_hotpixel_correction.h>
95 PEAK_COMMON_NO_DISCARD std::vector<peak::common::Point>
Detect(
const Image& image)
const;
148 peak_icv_hotpixel_correction_handle m_handle{};
149 uint32_t m_sensitivity = 3;
150 float m_gainFactor = 1.0F;
156 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_Detect(
157 m_handle, peak::common::detail::BackendAccessor<Image>::BackendHandle(image), m_sensitivity, m_gainFactor);
160 size_t hotpixelCount{};
162 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_GetList_GetCount(m_handle, &hotpixelCount);
165 if (hotpixelCount == 0)
170 std::vector<peak_common_point> hotpixelsC(hotpixelCount);
172 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_GetList(m_handle, hotpixelsC.data(), hotpixelCount);
175 std::vector<peak::common::Point> hotpixelsCpp;
176 hotpixelsCpp.reserve(hotpixelCount);
177 std::transform(hotpixelsC.begin(), hotpixelsC.end(), std::back_inserter(hotpixelsCpp), [](peak_common_point pointC) {
178 return peak::common::detail::BackendAccessor<peak::common::Point>::CreateInstance(pointC);
187 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_Create(&m_handle);
194 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_IncreaseUseCount(other.m_handle);
196 m_handle = other.m_handle;
197 m_gainFactor = other.m_gainFactor;
198 m_sensitivity = other.m_sensitivity;
203 m_handle = other.m_handle;
204 other.m_handle =
nullptr;
206 m_sensitivity = std::move(other.m_sensitivity);
207 m_gainFactor = std::move(other.m_gainFactor);
212 if (m_handle != other.m_handle)
214 if (m_handle !=
nullptr)
217 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_Destroy(m_handle);
222 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_IncreaseUseCount(other.m_handle);
224 m_handle = other.m_handle;
225 m_gainFactor = other.m_gainFactor;
226 m_sensitivity = other.m_sensitivity;
234 if (m_handle != other.m_handle)
236 if (m_handle !=
nullptr)
239 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_Destroy(m_handle);
243 m_handle = other.m_handle;
244 other.m_handle =
nullptr;
245 m_sensitivity = std::move(other.m_sensitivity);
246 m_gainFactor = std::move(other.m_gainFactor);
254 if (m_handle !=
nullptr)
256 std::ignore = PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_Destroy(m_handle);
264 if (sensitivity < range.GetMinimum() || sensitivity > range.GetMaximum())
266 throw OutOfRangeException(
"The given sensitivity is out of range. Check GetSensitivityRange() function for the valid range.");
269 m_sensitivity = sensitivity;
274 return m_sensitivity;
279 peak_common_interval_u sensitivityRange;
281 return PEAK_ICV_C_ABI_PREFIX peak_icv_Preprocessing_HotpixelCorrection_GetSensitivityRange(m_handle, &sensitivityRange);
284 return peak::common::detail::BackendAccessor<peak::common::IntervalU>::CreateInstance(sensitivityRange);
289 m_gainFactor = gainFactor;
Represents a continuous numeric interval with inclusive lower and upper bounds.
Detects hot pixels in images taken by a camera by identifying anomalies in the pixels intensities.
float GetGainFactor() const
Gets the current gain factor.
peak::common::IntervalU GetSensitivityRange()
Retrieves the valid range of sensitivity values.
HotpixelDetection()
Constructs a new HotpixelDetection instance.
void SetGainFactor(float gainFactor)
Sets the gain factor used during detection.
void SetSensitivity(uint32_t sensitivity)
Sets the sensitivity used during hot pixel detection.
std::vector< peak::common::Point > Detect(const Image &image) const
Detects hot pixels in the provided image.
HotpixelDetection & operator=(const HotpixelDetection &other)
uint32_t GetSensitivity() const
Returns the currently configured detection sensitivity.
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
Thrown when a value is outside the allowed range.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)