3#include "../_cexports/c_minos.h"
5#include "search_result.hpp"
7#include "../global.hpp"
56 inline void VerifyFilterInput(
const Image &image)
77 Private::VerifyFilterInput(image);
78 return Internal::DoBoolCallObjectOut<Image>(
79 [&](
void *&resimg) {
return CVB_CALL_CAPI(FilterLaplace(image.
Handle(), resimg)); });
93 Private::VerifyFilterInput(image);
94 return Internal::DoBoolCallObjectOut<Image>(
95 [&](
void *&resimg) {
return CVB_CALL_CAPI(FilterSharpen(image.
Handle(), resimg)); });
107 Private::VerifyFilterInput(image);
108 return Internal::DoBoolCallObjectOut<Image>(
109 [&](
void *&resimg) {
return CVB_CALL_CAPI(FilterDilate(image.
Handle(), resimg)); });
121 Private::VerifyFilterInput(image);
122 return Internal::DoBoolCallObjectOut<Image>(
123 [&](
void *&resimg) {
return CVB_CALL_CAPI(FilterErode(image.
Handle(), resimg)); });
142 Private::VerifyFilterInput(image);
143 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
144 return CVB_CALL_CAPI(ButterWorth(image.
Handle(),
static_cast<short>(1), gain, offset,
145 static_cast<CExports::cvbval_t
>(order), cutOff, resimg));
162 Private::VerifyFilterInput(image);
163 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
164 return CVB_CALL_CAPI(ButterWorth(image.
Handle(),
static_cast<short>(0), 1.0, 0,
165 static_cast<CExports::cvbval_t
>(order), cutOff, resimg));
181 Private::VerifyFilterInput(image);
182 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
186 return CVB_CALL_CAPI(FilterLow2x2(image.
Handle(), resimg));
188 return CVB_CALL_CAPI(FilterLow3x3(image.
Handle(), resimg));
190 return CVB_CALL_CAPI(FilterLow5x5(image.
Handle(), resimg));
209 Private::VerifyFilterInput(image);
210 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
214 return CVB_CALL_CAPI(FilterEdge2x2(image.
Handle(), resimg));
216 return CVB_CALL_CAPI(FilterEdge3x3(image.
Handle(), resimg));
235 Private::VerifyFilterInput(image);
236 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
240 return CVB_CALL_CAPI(FilterPyramid3x3(image.
Handle(), resimg));
242 return CVB_CALL_CAPI(FilterPyramid4x4(image.
Handle(), resimg));
244 return CVB_CALL_CAPI(FilterPyramid5x5(image.
Handle(), resimg));
271 template <
class RANGE>
272 inline typename TypedRange<std::unique_ptr<Image>, double, RANGE>::type
275 Private::VerifyFilterInput(image);
276 size_t kernelWidthHeight =
static_cast<size_t>(kernelSize);
277 auto kernelRange = MakeRangeAdapter<double>(kernel, kernelWidthHeight * kernelWidthHeight);
278 CExports::TFilterDef filterDef = {};
279 return Internal::DoBoolCallObjectOut<Image>([&](
void *&resimg) {
287 return CVB_CALL_CAPI(FilterUser2x2(image.
Handle(), filterDef, resimg));
299 return CVB_CALL_CAPI(FilterUser3x3(image.
Handle(), filterDef, resimg));
312 filterDef.cLL00 =
std::lround(kernel[10] * 1000.0);
313 filterDef.c0L00 =
std::lround(kernel[11] * 1000.0);
314 filterDef.c0000 =
std::lround(kernel[12] * 1000.0);
315 filterDef.c0R00 =
std::lround(kernel[13] * 1000.0);
316 filterDef.cRR00 =
std::lround(kernel[14] * 1000.0);
317 filterDef.cLL0B =
std::lround(kernel[15] * 1000.0);
318 filterDef.c0L0B =
std::lround(kernel[16] * 1000.0);
319 filterDef.c000B =
std::lround(kernel[17] * 1000.0);
320 filterDef.c0R0B =
std::lround(kernel[18] * 1000.0);
321 filterDef.cRR0B =
std::lround(kernel[19] * 1000.0);
322 filterDef.cLLBB =
std::lround(kernel[20] * 1000.0);
323 filterDef.c0LBB =
std::lround(kernel[21] * 1000.0);
324 filterDef.c00BB =
std::lround(kernel[22] * 1000.0);
325 filterDef.c0RBB =
std::lround(kernel[23] * 1000.0);
326 filterDef.cRRBB =
std::lround(kernel[24] * 1000.0);
327 return CVB_CALL_CAPI(FilterUser5x5(image.
Handle(), filterDef, resimg));
int BitsPerPixel() const noexcept
Number of actually valid bits per pixel.
Definition data_type.hpp:322
bool IsSignedInteger() const noexcept
Gets whether the pixels of the plane have signed integer values.
Definition data_type.hpp:354
The Common Vision Blox image.
Definition decl_image.hpp:45
ImagePlane Plane(int plane) const
Indexed access to the individual plane information.
Definition detail_image.hpp:58
void * Handle() const noexcept
Classic API image handle.
Definition decl_image.hpp:232
class DataType DataType() const noexcept override
Data type descriptor for this array.
Definition detail_image_plane.hpp:337
Namespace for the Minos package.
Definition classifier.hpp:29
std::unique_ptr< Image > Pyramid(const Image &image, KernelSize kernelSize)
Apply a pyramid filter to the input image.
Definition minos_filter.hpp:233
std::unique_ptr< Image > Dilate(const Image &image)
Apply a 3x3 dilation filter to the input image.
Definition minos_filter.hpp:105
std::unique_ptr< Image > Edge(const Image &image, KernelSize kernelSize)
Apply an edge filter to the input image.
Definition minos_filter.hpp:207
FilterOrder
Order of the ButterworthLowPass or ButterworthHighPass filter to be applied.
Definition minos_filter.hpp:47
@ Order2nd
2nd order filter.
Definition minos_filter.hpp:51
@ Order1st
1st order filter.
Definition minos_filter.hpp:49
std::unique_ptr< Image > ButterworthHighPass(const Image &image, double gain, int offset, double cutOff, FilterOrder order)
Apply a Butterworth high pass filter to the image.
Definition minos_filter.hpp:139
std::unique_ptr< Image > LowPass(const Image &image, KernelSize kernelSize)
Apply a low pass filter to the input image.
Definition minos_filter.hpp:179
KernelSize
Available kernel sizes for the filter functions exported by the Minos library.
Definition minos_filter.hpp:34
@ Kernel4x4
Kernel with 4x4 elements.
Definition minos_filter.hpp:40
@ Kernel5x5
Kernel with 5x5 elements.
Definition minos_filter.hpp:42
@ Kernel2x2
Kernel with 2x2 elements.
Definition minos_filter.hpp:36
@ Kernel3x3
Kernel with 3x3 elements.
Definition minos_filter.hpp:38
std::unique_ptr< Image > Erode(const Image &image)
Apply a 3x3 erosion filter to the input image.
Definition minos_filter.hpp:119
std::unique_ptr< Image > ButterworthLowPass(const Image &image, double cutOff, FilterOrder order)
Apply a Butterworth low pass filter to the image.
Definition minos_filter.hpp:160
std::unique_ptr< Image > Sharpen(const Image &image)
Apply a 3x3 sharpen filter to the input image.
Definition minos_filter.hpp:91
std::unique_ptr< Image > Laplace(const Image &image)
Apply a 3x3 Laplace filter to the input image.
Definition minos_filter.hpp:75
TypedRange< std::unique_ptr< Image >, double, RANGE >::type UserFilter(const Image &image, KernelSize kernelSize, const RANGE &kernel)
Apply a user-defined filter to the input image.
Definition minos_filter.hpp:273
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17