19 #include <type_traits> 69 #if !defined(__cpp_aggregate_nsdmi) 72 rect(
std::move(rect)), xSamplingInterval(xSamplingInterval), ySamplingInterval(ySamplingInterval), weight(weight) {}
75 uint8_t xSamplingInterval{ 1 };
76 uint8_t ySamplingInterval{ 1 };
115 *
this = std::move(other);
123 m_backendHandle = other.m_backendHandle;
124 other.m_backendHandle =
nullptr;
141 double calculated_value;
145 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &calculated_value);
148 return calculated_value;
165 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
166 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
169 return isPixelFormatSupported > 0;
183 m_backendHandle,
nullptr, &sizeOfData);
186 std::vector<PixelFormatName> formats(sizeOfData);
189 m_backendHandle, reinterpret_cast<PEAK_IPL_PIXEL_FORMAT*>(formats.data()), &sizeOfData);
204 m_backendHandle, static_cast<PEAK_IPL_SHARPNESS_ALGORITHM>(algorithm));
220 m_backendHandle, reinterpret_cast<PEAK_IPL_SHARPNESS_ALGORITHM*>(&algorithm));
251 std::vector<PEAK_IPL_SHARPNESS_ROI> sharpness_rois{};
253 std::transform(std::cbegin(rois), std::cend(rois), std::back_inserter(sharpness_rois), [](
const auto roi) {
255 { roi.rect.
size().
width, roi.rect.size().height } },
256 roi.xSamplingInterval, roi.ySamplingInterval,
257 static_cast<std::underlying_type_t<SharpnessROIWeight>
>(roi.weight) };
261 m_backendHandle, sharpness_rois.data(), sharpness_rois.size());
297 size_t roiListSize{};
301 std::vector<PEAK_IPL_SHARPNESS_ROI> sharpness_rois(roiListSize);
304 m_backendHandle, sharpness_rois.data(), &roiListSize);
310 std::cbegin(sharpness_rois), std::cend(sharpness_rois), std::back_inserter(rois), [](
const auto roi) {
312 roi.rect.size.height },
313 roi.xSamplingInterval, roi.ySamplingInterval,
static_cast<SharpnessROIWeight>(roi.weight) };
327 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:271
Size2D ROIMinSize() const
Gets the minimum size of a ROI, in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:232
~Sharpness()
Definition: peak_ipl_sharpness.hpp:105
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:100
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:139
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:22
Rect2D rect
Definition: peak_ipl_sharpness.hpp:74
void SetROIs(const SharpnessROIList &rois)
Sets region of interests in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:248
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition: peak_ipl_exception.hpp:182
2D size of an image.
Definition: peak_ipl_simple_types.hpp:177
Stores the pixel format, width and height of an image and the pointer to the image buffer...
Definition: peak_ipl_image.hpp:39
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:325
Definition: peak_ipl_sharpness.hpp:67
struct PEAK_IPL_SHARPNESS * PEAK_IPL_SHARPNESS_HANDLE
Definition: peak_ipl_backend.h:342
SharpnessROIList ROIs() const
Gets ROIs in which the sharpness is measured.
Definition: peak_ipl_sharpness.hpp:295
uint8_t ySamplingInterval
Definition: peak_ipl_sharpness.hpp:76
SharpnessROIWeight
Definition: peak_ipl_sharpness.hpp:60
SharpnessROIWeight weight
Definition: peak_ipl_sharpness.hpp:77
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.
SharpnessROI(Rect2D rect, uint8_t xSamplingInterval, uint8_t ySamplingInterval, SharpnessROIWeight weight)
Definition: peak_ipl_sharpness.hpp:71
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:178
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:277
std::vector< SharpnessROI > SharpnessROIList
Definition: peak_ipl_sharpness.hpp:80
bool operator==(const Sharpness::SharpnessROI &lhs, const Sharpness::SharpnessROI &rhs)
Definition: peak_ipl_sharpness.hpp:319
void SetAlgorithm(SharpnessAlgorithm algorithm)
Sets the algorithm to use for measurement calculation.
Definition: peak_ipl_sharpness.hpp:200
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:214
size_t width
Definition: peak_ipl_simple_types.hpp:179
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Checks if the given pixel format can be used for sharpness measurement.
Definition: peak_ipl_sharpness.hpp:159
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:75
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