42 Auto PEAK_AFL_DEPRECATED_ENUM_ATTR,
68 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
73 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
77 return "HistogramVariance";
124 if (algorithm ==
"Auto")
127 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
129 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
132 if (algorithm ==
"Tenengrad")
136 if (algorithm ==
"Sobel")
140 if (algorithm ==
"MeanScore")
144 if (algorithm ==
"HistogramVariance")
149 throw peak::afl::error::InvalidParameterException(
156 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
170 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
173 throw peak::afl::error::InternalErrorException(
"Invalid focus sharpness algorithm!",
PEAK_AFL_STATUS_ERROR);
179 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
193 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
196 throw peak::afl::error::InternalErrorException(
"Invalid focus sharpness algorithm!",
PEAK_AFL_STATUS_ERROR);
245 : m_controller{ std::move(controller) }
270 m_controller->SetSharpnessAlgorithm(detail::ToCType(value));
292 return detail::ToFocusSharpnessAlgorithm(m_controller->GetSharpnessAlgorithm());
313 PEAK_COMMON_NO_DISCARD std::vector<FocusSharpnessAlgorithm>
GetList()
const override
315 const auto cAlgorithms = m_controller->GetSharpnessAlgorithmList();
316 std::vector<FocusSharpnessAlgorithm> algorithms;
317 algorithms.reserve(cAlgorithms.size());
319 std::transform(std::cbegin(cAlgorithms), std::cend(cAlgorithms), std::back_inserter(algorithms),
320 [](
const auto& value) {
return detail::ToFocusSharpnessAlgorithm(value); });
360 Set(detail::ToFocusSharpnessAlgorithm(archive.
GetString(
"SharpnessAlgorithm")));
371 std::shared_ptr<peak::afl::Controller> m_controller;
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:436
Interface for a hierarchical key-value archive system.
Definition peak_common_iarchive.hpp:54
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:165
SharpnessAlgorithm(std::shared_ptr< peak::afl::Controller > controller)
Constructs a SharpnessAlgorithm feature with the specified controller.
Definition peak_afl_sharpness_algorithm.hpp:244
void Set(const FocusSharpnessAlgorithm &value) override
Sets the focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:268
void Serialize(peak::common::serialization::IArchive &archive) const override
Serializes the current sharpness algorithm to an archive.
Definition peak_afl_sharpness_algorithm.hpp:338
std::vector< FocusSharpnessAlgorithm > GetList() const override
Gets the list of supported focus sharpness algorithms.
Definition peak_afl_sharpness_algorithm.hpp:313
void Deserialize(const peak::common::serialization::IArchive &archive) override
Deserializes the sharpness algorithm from an archive.
Definition peak_afl_sharpness_algorithm.hpp:358
FocusSharpnessAlgorithm Get() const override
Gets the current focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:290
peak_afl_controller_sharpness_algorithm
Focus sharpness calculation algorithms.
Definition peak_afl.h:805
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_MEAN_SCORE
Mean score algorithm.
Definition peak_afl.h:848
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_SOBEL
Sobel edge detection algorithm.
Definition peak_afl.h:837
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_AUTO
Automatic algorithm selection.
Definition peak_afl.h:815
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_HISTOGRAM_VARIANCE
Histogram variance algorithm.
Definition peak_afl.h:859
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD
Tenengrad gradient-based algorithm.
Definition peak_afl.h:826
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:416
@ PEAK_AFL_STATUS_ERROR
General error occurred.
Definition peak_afl.h:396
std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:74
FocusSharpnessAlgorithm
Focus sharpness algorithm enumeration.
Definition peak_afl_sharpness_algorithm.hpp:35
@ Auto
Automatic algorithm selection - controller chooses the best algorithm.
Definition peak_afl_sharpness_algorithm.hpp:42
@ HistogramVariance
Histogram variance algorithm - variance-based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:50
@ Tenengrad
Tenengrad algorithm - gradient-based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:44
@ Sobel
Sobel algorithm - edge detection based sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:46
@ MeanScore
Mean score algorithm - statistical sharpness measurement.
Definition peak_afl_sharpness_algorithm.hpp:48
@ Auto
Automatic algorithm selection - default algorithm.
Definition peak_afl_search_algorithm.hpp:43
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:35
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:33