46 Auto PEAK_AFL_DEPRECATED_ENUM_ATTR,
72 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
77 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
81 return "HistogramVariance";
128 if (algorithm ==
"Auto")
131 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
133 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
136 if (algorithm ==
"Tenengrad")
140 if (algorithm ==
"Sobel")
144 if (algorithm ==
"MeanScore")
148 if (algorithm ==
"HistogramVariance")
153 throw peak::afl::error::InvalidParameterException(
160 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
174 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
177 throw peak::afl::error::InternalErrorException(
"Invalid focus sharpness algorithm!",
PEAK_AFL_STATUS_ERROR);
183 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
197 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
200 throw peak::afl::error::InternalErrorException(
"Invalid focus sharpness algorithm!",
PEAK_AFL_STATUS_ERROR);
249 : m_controller{ std::move(controller) }
274 m_controller->SetSharpnessAlgorithm(detail::ToCType(value));
296 return detail::ToFocusSharpnessAlgorithm(m_controller->GetSharpnessAlgorithm());
319 const auto cAlgorithms = m_controller->GetSharpnessAlgorithmList();
320 std::vector<FocusSharpnessAlgorithm> algorithms;
321 algorithms.reserve(cAlgorithms.size());
323 std::transform(std::cbegin(cAlgorithms), std::cend(cAlgorithms), std::back_inserter(algorithms),
324 [](
const auto& value) {
return detail::ToFocusSharpnessAlgorithm(value); });
364 Set(detail::ToFocusSharpnessAlgorithm(archive.
GetString(
"SharpnessAlgorithm")));
375 std::shared_ptr<peak::afl::Controller> m_controller;
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:391
Interface for a hierarchical key-value archive system.
Definition peak_common_iarchive.hpp:59
virtual std::string GetString(const std::string &key) const =0
Retrieves a string value by key.
virtual void SetString(const std::string &key, const std::string &value)=0
Stores a UTF-8 string.
Interface for features that have a list of valid values.
Definition peak_afl_ifeature.hpp:169
SharpnessAlgorithm(std::shared_ptr< peak::afl::Controller > controller)
Constructs a SharpnessAlgorithm feature with the specified controller.
Definition peak_afl_sharpness_algorithm.hpp:248
void Set(const FocusSharpnessAlgorithm &value) override
Sets the focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:272
void Serialize(peak::common::serialization::IArchive &archive) const override
Serializes the current sharpness algorithm to an archive.
Definition peak_afl_sharpness_algorithm.hpp:342
std::vector< FocusSharpnessAlgorithm > GetList() const override
Gets the list of supported focus sharpness algorithms.
Definition peak_afl_sharpness_algorithm.hpp:317
void Deserialize(const peak::common::serialization::IArchive &archive) override
Deserializes the sharpness algorithm from an archive.
Definition peak_afl_sharpness_algorithm.hpp:362
FocusSharpnessAlgorithm Get() const override
Gets the current focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:294
peak_afl_controller_sharpness_algorithm
Focus sharpness calculation algorithms.
Definition peak_afl.h:808
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_MEAN_SCORE
Mean score algorithm.
Definition peak_afl.h:851
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_SOBEL
Sobel edge detection algorithm.
Definition peak_afl.h:840
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_AUTO
Automatic algorithm selection.
Definition peak_afl.h:818
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_HISTOGRAM_VARIANCE
Histogram variance algorithm.
Definition peak_afl.h:862
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD
Tenengrad gradient-based algorithm.
Definition peak_afl.h:829
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:419
@ PEAK_AFL_STATUS_ERROR
General error occurred.
Definition peak_afl.h:399
std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:78
FocusSharpnessAlgorithm
Focus sharpness algorithm enumeration.
Definition peak_afl_sharpness_algorithm.hpp:39
@ Auto
Automatic algorithm selection - controller chooses the best algorithm.
Definition peak_afl_sharpness_algorithm.hpp:46
@ HistogramVariance
Histogram variance algorithm - variance-based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:54
@ Tenengrad
Tenengrad algorithm - gradient-based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:48
@ Sobel
Sobel algorithm - edge detection based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:50
@ MeanScore
Mean score algorithm - statistical sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:52
@ Auto
Automatic algorithm selection - default algorithm.
Definition peak_afl_search_algorithm.hpp:47
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.h:86
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:39
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:37