73 return "HistogramVariance";
120 if (algorithm ==
"Auto")
124 if (algorithm ==
"Tenengrad")
128 if (algorithm ==
"Sobel")
132 if (algorithm ==
"MeanScore")
136 if (algorithm ==
"HistogramVariance")
141 throw peak::common::InvalidParameterException(
"The given focus sharpness algorithm " + algorithm +
" is unknown!");
160 throw peak::common::InternalErrorException(
"Invalid focus sharpness algorithm!");
179 throw peak::common::InternalErrorException(
"Invalid focus sharpness algorithm!");
229 : m_controller{ std::move(controller) }
254 m_controller->SetSharpnessAlgorithm(detail::ToCType(value));
276 return detail::ToFocusSharpnessAlgorithm(m_controller->GetSharpnessAlgorithm());
299 const auto cAlgorithms = m_controller->GetSharpnessAlgorithmList();
300 std::vector<FocusSharpnessAlgorithm> algorithms;
301 algorithms.reserve(cAlgorithms.size());
303 std::transform(std::cbegin(cAlgorithms), std::cend(cAlgorithms), std::back_inserter(algorithms),
304 [](
const auto& value) {
return detail::ToFocusSharpnessAlgorithm(value); });
344 Set(detail::ToFocusSharpnessAlgorithm(archive.
GetString(
"SharpnessAlgorithm")));
355 std::shared_ptr<peak::afl::Controller> m_controller;
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:50
Interface for a hierarchical key-value archive system.
Definition peak_common_iarchive.hpp:59
virtual PEAK_COMMON_NO_DISCARD 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:171
SharpnessAlgorithm(std::shared_ptr< peak::afl::Controller > controller)
Constructs a SharpnessAlgorithm feature with the specified controller.
Definition peak_afl_sharpness_algorithm.hpp:228
PEAK_COMMON_NO_DISCARD std::vector< FocusSharpnessAlgorithm > GetList() const override
Gets the list of supported focus sharpness algorithms.
Definition peak_afl_sharpness_algorithm.hpp:297
void Set(const FocusSharpnessAlgorithm &value) override
Sets the focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:252
void Serialize(peak::common::serialization::IArchive &archive) const override
Serializes the current sharpness algorithm to an archive.
Definition peak_afl_sharpness_algorithm.hpp:322
void Deserialize(const peak::common::serialization::IArchive &archive) override
Deserializes the sharpness algorithm from an archive.
Definition peak_afl_sharpness_algorithm.hpp:342
PEAK_COMMON_NO_DISCARD FocusSharpnessAlgorithm Get() const override
Gets the current focus sharpness algorithm.
Definition peak_afl_sharpness_algorithm.hpp:274
PEAK_COMMON_NO_DISCARD std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:79
FocusSharpnessAlgorithm
Focus sharpness algorithm enumeration.
Definition peak_afl_sharpness_algorithm.hpp:40
@ 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:42
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.hpp:91
peak_afl_controller_sharpness_algorithm
Focus sharpness calculation algorithms.
Definition peak_afl.h:541
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_MEAN_SCORE
Mean score algorithm.
Definition peak_afl.h:583
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_SOBEL
Sobel edge detection algorithm.
Definition peak_afl.h:572
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_AUTO
Automatic algorithm selection.
Definition peak_afl.h:550
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_HISTOGRAM_VARIANCE
Histogram variance algorithm.
Definition peak_afl.h:594
@ PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD
Tenengrad gradient-based algorithm.
Definition peak_afl.h:561
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