18 #include <type_traits> 70 uint8_t xSamplingInterval{ 1 };
71 uint8_t ySamplingInterval{ 1 };
107 *
this = std::move(other);
115 m_backendHandle = other.m_backendHandle;
116 other.m_backendHandle =
nullptr;
133 double calculated_value;
137 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &calculated_value);
140 return calculated_value;
157 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
158 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
161 return isPixelFormatSupported > 0;
175 m_backendHandle,
nullptr, &sizeOfData);
178 std::vector<PixelFormatName> formats(sizeOfData);
181 m_backendHandle, reinterpret_cast<PEAK_IPL_PIXEL_FORMAT*>(formats.data()), &sizeOfData);
196 m_backendHandle, static_cast<PEAK_IPL_SHARPNESS_ALGORITHM>(algorithm));
212 m_backendHandle, reinterpret_cast<PEAK_IPL_SHARPNESS_ALGORITHM*>(&algorithm));
243 std::vector<PEAK_IPL_SHARPNESS_ROI> sharpness_rois{};
245 std::transform(std::cbegin(rois), std::cend(rois), std::back_inserter(sharpness_rois), [](
const auto roi) {
247 { roi.rect.
size().
width, roi.rect.size().height } },
248 roi.xSamplingInterval, roi.ySamplingInterval,
249 static_cast<std::underlying_type_t<SharpnessROIWeight>
>(roi.weight) };
253 m_backendHandle, sharpness_rois.data(), sharpness_rois.size());
289 size_t roiListSize{};
293 std::vector<PEAK_IPL_SHARPNESS_ROI> sharpness_rois(roiListSize);
296 m_backendHandle, sharpness_rois.data(), &roiListSize);
302 std::cbegin(sharpness_rois), std::cend(sharpness_rois), std::back_inserter(rois), [](
const auto roi) {
304 roi.rect.size.height },
305 roi.xSamplingInterval, roi.ySamplingInterval,
static_cast<SharpnessROIWeight>(roi.weight) };
319 return !(lhs == rhs);
Configure and measure the sharpness of a given image.
Definition: peak_ipl_sharpness.hpp:40
void SetROI(const SharpnessROI &roi)
Set ROI in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:263
Size2D ROIMinSize() const
Gets the minimum size of a ROI, in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:224
~Sharpness()
Definition: peak_ipl_sharpness.hpp:100
SharpnessAlgorithm
Definition: peak_ipl_sharpness.hpp:52
PEAK_IPL_SIZE_2D size
Definition: peak_ipl_backend.h:245
#define PEAK_IPL_C_ABI_PREFIX
Definition: peak_ipl_dll_defines.h:16
Sharpness()
Definition: peak_ipl_sharpness.hpp:95
PixelFormatName
Enum holding the possible pixel format names.
Definition: peak_ipl_simple_types.hpp:38
double Measure(const Image &image)
Measures the sharpness of the given image. The higher the value, the better the sharpness.
Definition: peak_ipl_sharpness.hpp:131
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:16
Rect2D rect
Definition: peak_ipl_sharpness.hpp:69
void SetROIs(const SharpnessROIList &rois)
Sets region of interests in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:240
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition: peak_ipl_exception.hpp:182
2D size of an image.
Definition: peak_ipl_simple_types.hpp:163
Stores the pixel format, width and height of an image and the pointer to the image buffer...
Definition: peak_ipl_image.hpp:37
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_SetROIs(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_SHARPNESS_ROI *roiList, size_t roiListSize)
Sets ROIs in which the sharpness is measured.
bool operator!=(const Sharpness::SharpnessROI &lhs, const Sharpness::SharpnessROI &rhs)
Definition: peak_ipl_sharpness.hpp:317
Definition: peak_ipl_sharpness.hpp:67
struct PEAK_IPL_SHARPNESS * PEAK_IPL_SHARPNESS_HANDLE
Definition: peak_ipl_backend.h:322
SharpnessROIList ROIs() const
Gets ROIs in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:287
uint8_t ySamplingInterval
Definition: peak_ipl_sharpness.hpp:71
SharpnessROIWeight
Definition: peak_ipl_sharpness.hpp:60
SharpnessROIWeight weight
Definition: peak_ipl_sharpness.hpp:72
Definition: peak_ipl_backend.h:242
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_SetAlgorithm(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_SHARPNESS_ALGORITHM algorithm)
Sets the algorithm to use for measurement calculation.
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_Measure(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_IMAGE_HANDLE imageHandle, double *calculated_value)
Measures the relative sharpness of the given image.
int8_t PEAK_IPL_BOOL8
Definition: peak_ipl_backend.h:25
size_t width
Definition: peak_ipl_backend.h:238
std::vector< PixelFormatName > SupportedPixelFormats() const
Returns a list of supported pixel formats which can be used for shaprness measurement.
Definition: peak_ipl_sharpness.hpp:170
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_GetIsPixelFormatSupported(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isPixelFormatSupported)
Asks the given sharpness measurement whether it supports the given pixel format.
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_Construct(PEAK_IPL_SHARPNESS_HANDLE *handle)
Creates a sharpness measurement.
Definition: peak_ipl_backend.h:265
std::vector< SharpnessROI > SharpnessROIList
Definition: peak_ipl_sharpness.hpp:75
bool operator==(const Sharpness::SharpnessROI &lhs, const Sharpness::SharpnessROI &rhs)
Definition: peak_ipl_sharpness.hpp:311
void SetAlgorithm(SharpnessAlgorithm algorithm)
Sets the algorithm to use for measurement calculation.
Definition: peak_ipl_sharpness.hpp:192
Sharpness & operator=(const Sharpness &)=delete
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_Destruct(PEAK_IPL_SHARPNESS_HANDLE handle)
Destroys the sharpness measurement associated with the given handle.
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_GetSupportedPixelFormatList(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_PIXEL_FORMAT *pixelFormatList, size_t *pixelFormatListSize)
Queries the supported pixel formats.
SharpnessAlgorithm Algorithm() const
Returns the used algorithm for the sharpness measurement.
Definition: peak_ipl_sharpness.hpp:206
size_t width
Definition: peak_ipl_simple_types.hpp:165
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Checks if the given pixel format can be used for sharpness measurement.
Definition: peak_ipl_sharpness.hpp:151
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_GetROIs(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_SHARPNESS_ROI *roiList, size_t *roiListSize)
Returns the ROIs in which the sharpness is measured.
uint8_t xSamplingInterval
Definition: peak_ipl_sharpness.hpp:70
Rectangle.
Definition: peak_ipl_rect.hpp:30
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_GetROIMinimumSize(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_SIZE_2D *min_size)
Returns the minimum size of a ROI to use for measurement calculation.
Definition: peak_ipl_backend.h:236
PEAK_IPL_C_API PEAK_IPL_ImageSharpness_GetAlgorithm(PEAK_IPL_SHARPNESS_HANDLE handle, PEAK_IPL_SHARPNESS_ALGORITHM *algorithm)
Returns the algorithm to use for measurement calculation.
constexpr Size2D size() const
Definition: peak_ipl_rect.hpp:52