26#include <core/exception.h>
27#include <fvfilters/threshold.h>
33#elif defined(HAVE_OPENCV)
34# include <opencv2/opencv.hpp>
36# error "Neither IPP nor OpenCV available"
56 unsigned char min_replace,
58 unsigned char max_replace)
63 this->min_replace = min_replace;
64 this->max_replace = max_replace;
65#if defined(HAVE_OPENCV)
66 if (min_replace != 0) {
67 throw fawkes::Exception(
"OpenCV-based threshold filter only allows min_replace=0");
80 unsigned char min_replace,
82 unsigned char max_replace)
86 this->min_replace = min_replace;
87 this->max_replace = max_replace;
108 if (status == ippStsNoErr) {
128 if (status == ippStsNoErr) {
141 if (status != ippStsNoErr) {
145#elif defined(HAVE_OPENCV)
150 cv::Mat srcm(
src_roi[0]->height,
164 cv::threshold(srcm, dstm, max, max_replace, cv::THRESH_BINARY);
165 cv::threshold(srcm, dstm, min, 0, cv::THRESH_TOZERO);
Base class for exceptions in Fawkes.
void set_thresholds(unsigned char min, unsigned char min_replace, unsigned char max, unsigned char max_replace)
Set new thresholds.
virtual void apply()
Apply the filter.
FilterThreshold(unsigned char min=128, unsigned char min_replace=0, unsigned char max=127, unsigned char max_replace=255)
Constructor.
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned char * dst
Destination buffer.
ROI * dst_roi
Destination ROI.
unsigned int height
ROI height.
fawkes::upoint_t start
ROI start.
unsigned int line_step
line step
unsigned int width
ROI width.
unsigned int pixel_step
pixel step
unsigned int x
x coordinate
unsigned int y
y coordinate