14 #ifndef ECVL_IMGPROC_H_ 15 #define ECVL_IMGPROC_H_ 178 void MultiThreshold(
const Image& src, Image& dst,
const std::vector<int>& thresholds,
int minval = 0,
int maxval = 255);
236 void GaussianBlur(
const Image& src, Image& dst,
int sizeX,
int sizeY,
double sigmaX,
double sigmaY = 0);
237 void GaussianBlur(
const Image& src, Image& dst,
double sigma);
263 void GammaContrast(
const Image& src, Image& dst,
double gamma);
274 void CoarseDropout(
const Image& src, Image& dst,
double p,
double drop_size,
bool per_channel);
297 std::vector<ecvl::Point2i>
GetMaxN(
const Image& src,
size_t n);
314 void FindContours(
const Image& src, std::vector<std::vector<Point2i>>& contours);
321 void Stack(
const std::vector<Image>& src, Image& dst);
328 void HConcat(
const std::vector<Image>& src, Image& dst);
335 void VConcat(
const std::vector<Image>& src, Image& dst);
387 const int& border_value = 0
416 void MeanStdDev(
const Image& src, std::vector<double>& mean, std::vector<double>& stddev);
423 void Transpose(
const Image& src, Image& dst);
439 const std::array<float, 2>& distort_limit = { -0.3f, 0.3f },
442 const int& border_value = 0,
443 const unsigned seed = std::default_random_engine::default_seed
463 const int& border_value = 0,
464 const unsigned seed = std::default_random_engine::default_seed
480 const std::array<float, 2>& distort_limit = { -0.3f, 0.3f },
481 const std::array<float, 2>& shift_limit = { -0.1f, 0.1f },
484 const int& border_value = 0,
485 const unsigned seed = std::default_random_engine::default_seed
496 void Salt(
const Image& src, Image& dst,
double p,
bool per_channel =
false,
const unsigned seed = std::default_random_engine::default_seed);
506 void Pepper(
const Image& src, Image& dst,
double p,
bool per_channel =
false,
const unsigned seed = std::default_random_engine::default_seed);
516 void SaltAndPepper(
const Image& src, Image& dst,
double p,
bool per_channel =
false,
const unsigned seed = std::default_random_engine::default_seed);
649 void Normalize(
const Image& src, Image& dst,
const double& mean,
const double& std);
661 void Normalize(
const Image& src, Image& dst,
const std::vector<double>& mean,
const std::vector<double>& std);
682 void ScaleTo(
const Image& src, Image& dst,
const double& new_min,
const double& new_max);
697 #endif // ECVL_IMGPROC_H_
void ResizeDim(const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &newdims, InterpolationType interp=InterpolationType::linear)
Resizes an Image to the specified dimensions.
void CoarseDropout(const Image &src, Image &dst, double p, double drop_size, bool per_channel)
Sets rectangular areas within an Image to zero.
void GridDistortion(const Image &src, Image &dst, int num_steps=5, const std::array< float, 2 > &distort_limit={ -0.3f, 0.3f }, InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
Randomly stretch or reduce each cell of the grid in which the input Image is divided into....
void ScaleTo(const Image &src, Image &dst, const double &new_min, const double &new_max)
Linearly scale an Image into a new range.
InpaintType
Enum class representing the ECVL inpaint types.
void ChangeColorSpace(const Image &src, Image &dst, ColorType new_type)
Copies the source Image into destination Image changing the color space.
void Morphology(const Image &src, Image &dst, MorphType op, Image &kernel, Point2i anchor={ -1, -1 }, int iterations=1, BorderType border_type=BorderType::BORDER_CONSTANT, const int &border_value=0)
Performs advanced morphological transformations using an erosion and dilation as basic operations.
Use Navier-Stokes based method.
void Inpaint(const Image &src, Image &dst, const Image &inpaintMask, double inpaintRadius, InpaintType flag=InpaintType::INPAINT_TELEA)
Restores the selected region in an image using the region neighborhood.
void CentralMoments(const Image &src, Image &moments, std::vector< double > center, int order=3, DataType type=DataType::float64)
Calculate all central image moments of the source Image up to the specified order.
void ConnectedComponentsLabeling(const Image &src, Image &dst)
Labels connected components in a binary Image.
void VConcat(const std::vector< Image > &src, Image &dst)
Vertical concatenation of images (with the same number of columns)
void CenterCrop(const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &size)
Crops the given image at the center.
void FindContours(const Image &src, std::vector< std::vector< Point2i >> &contours)
Finds contours in a binary image.
DataType
DataType is an enum class which defines data types allowed for images.
ColorType
Enum class representing the ECVL supported color spaces.
InterpolationType
Enum class representing the ECVL interpolation types.
void AdditiveLaplaceNoise(const Image &src, Image &dst, double std_dev)
Adds Laplace distributed noise to an Image.
void SliceTimingCorrection(const Image &src, Image &dst, bool odd=false, bool down=false)
Corrects each voxel's time-series. Slice timing correction works by using (Hanning-windowed) sinc int...
void Threshold(const Image &src, Image &dst, double thresh, double maxval, ThresholdingType thresh_type=ThresholdingType::BINARY)
Applies a fixed threshold to an input Image.
void DrawEllipse(Image &src, ecvl::Point2i center, ecvl::Size2i axes, double angle, const ecvl::Scalar &color, int thickness=1)
Draw an ellipse over the specified Image.
void HConcat(const std::vector< Image > &src, Image &dst)
Horizontal concatenation of images (with the same number of rows)
void Transpose(const Image &src, Image &dst)
Swap rows and columns of an Image.
std::vector< int > OtsuMultiThreshold(const Image &src, int n_thresholds=2)
Calculates the Otsu thresholding values.
iiiiii|abcdefgh|iiiiiii with some specified i
int OtsuThreshold(const Image &src)
Calculates the Otsu thresholding value.
void Salt(const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
Adds salt noise (white pixels) to an Image.
void ResizeScale(const ecvl::Image &src, ecvl::Image &dst, const std::vector< double > &scales, InterpolationType interp=InterpolationType::linear)
Resizes an Image by scaling the dimensions to a given scale factor.
int GetOpenCVInterpolation(InterpolationType interp)
Given an InterpolationType, the GetOpenCVInterpolation function returns the associated OpenCV enum va...
void GaussianBlur(const Image &src, Image &dst, int sizeX, int sizeY, double sigmaX, double sigmaY=0)
Blurs an Image using a Gaussian kernel.
void Normalize(const Image &src, Image &dst, const double &mean, const double &std)
Normalize Image image with mean and standard deviation.
ThresholdingType
Enum class representing the ECVL thresholding types.
void RotateFullImage2D(const ecvl::Image &src, ecvl::Image &dst, double angle, double scale=1.0, InterpolationType interp=InterpolationType::linear)
Rotates an Image resizing the output accordingly.
BorderType
Enum class representing the ECVL border types.
void SeparableFilter2D(const Image &src, Image &dst, const std::vector< double > &kerX, const std::vector< double > &kerY, DataType type=DataType::none)
Convolves an Image with a couple of 1-dimensional kernels.
void MultiThreshold(const Image &src, Image &dst, const std::vector< int > &thresholds, int minval=0, int maxval=255)
Applies multiple thresholds to the input Image.
void SaltAndPepper(const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
Adds salt and pepper noise (white and black pixels) to an Image. White and black pixels are equally l...
void Moments(const Image &src, Image &moments, int order=3, DataType type=DataType::float64)
Calculate all raw image moments of the source Image up to the specified order.
void AdditivePoissonNoise(const Image &src, Image &dst, double lambda)
Adds Poisson distributed noise to an Image.
void Rotate2D(const ecvl::Image &src, ecvl::Image &dst, double angle, const std::vector< double > ¢er={}, double scale=1.0, InterpolationType interp=InterpolationType::linear)
Rotates an Image.
void DropColorChannel(Image &src)
Remove color channel from the input Image.
std::array< int, 2 > Point2i
void Filter2D(const Image &src, Image &dst, const Image &ker, DataType type=DataType::none)
Convolves an Image with a kernel.
void Stack(const std::vector< Image > &src, Image &dst)
Stack a sequence of Images along the depth dimension (images width and height must match)
void OpticalDistortion(const Image &src, Image &dst, const std::array< float, 2 > &distort_limit={ -0.3f, 0.3f }, const std::array< float, 2 > &shift_limit={ -0.1f, 0.1f }, InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
Barrel / pincushion distortion. Based on https://github.com/albumentations-team/albumentations/blob/m...
std::vector< double > Scalar
void NonMaximaSuppression(const Image &src, Image &dst)
Calculate the Non-Maxima suppression of the source Image.
Use the algorithm proposed by Alexandru Telea.
MorphType
Enum class representing the ECVL morphology types.
void GammaContrast(const Image &src, Image &dst, double gamma)
Adjust contrast by scaling each pixel value X to 255 * ((X/255) ** gamma).
void IntegralImage(const Image &src, Image &dst, DataType dst_type=DataType::float64)
Calculate the integral image of the source Image.
void MeanStdDev(const Image &src, std::vector< double > &mean, std::vector< double > &stddev)
Calculates the mean and the standard deviation of an Image.
void Flip2D(const ecvl::Image &src, ecvl::Image &dst)
Flips an Image.
std::vector< ecvl::Point2i > GetMaxN(const Image &src, size_t n)
Get the n maximum values that are in the source Image.
void Pepper(const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
Adds pepper noise (black pixels) to an Image.
void ElasticTransform(const Image &src, Image &dst, double alpha=34., double sigma=4., InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
Elastic deformation of input Image. Based on https://github.com/albumentations-team/albumentations/bl...
void Mirror2D(const ecvl::Image &src, ecvl::Image &dst)
Mirrors an Image.
std::array< int, 2 > Size2i