Namespaces | Enumerations | Functions
imgproc.h File Reference
#include <random>
#include "image.h"
#include "saturate_cast.h"

Go to the source code of this file.

Namespaces

 ecvl
 

Enumerations

enum  ecvl::ThresholdingType { ecvl::ThresholdingType::BINARY, ecvl::ThresholdingType::BINARY_INV }
 Enum class representing the ECVL thresholding types. More...
 
enum  ecvl::InterpolationType {
  ecvl::InterpolationType::nearest, ecvl::InterpolationType::linear, ecvl::InterpolationType::area, ecvl::InterpolationType::cubic,
  ecvl::InterpolationType::lanczos4
}
 Enum class representing the ECVL interpolation types. More...
 
enum  ecvl::MorphType {
  ecvl::MorphType::MORPH_ERODE, ecvl::MorphType::MORPH_DILATE, ecvl::MorphType::MORPH_OPEN, ecvl::MorphType::MORPH_CLOSE,
  ecvl::MorphType::MORPH_GRADIENT, ecvl::MorphType::MORPH_TOPHAT, ecvl::MorphType::MORPH_BLACKHAT, ecvl::MorphType::MORPH_HITMISS
}
 Enum class representing the ECVL morphology types. More...
 
enum  ecvl::BorderType {
  ecvl::BorderType::BORDER_CONSTANT, ecvl::BorderType::BORDER_REPLICATE, ecvl::BorderType::BORDER_REFLECT, ecvl::BorderType::BORDER_WRAP,
  ecvl::BorderType::BORDER_REFLECT_101, ecvl::BorderType::BORDER_TRANSPARENT
}
 Enum class representing the ECVL border types. More...
 
enum  ecvl::InpaintType { ecvl::InpaintType::INPAINT_NS, ecvl::InpaintType::INPAINT_TELEA }
 Enum class representing the ECVL inpaint types. More...
 

Functions

int ecvl::GetOpenCVInterpolation (InterpolationType interp)
 Given an InterpolationType, the GetOpenCVInterpolation function returns the associated OpenCV enum value. More...
 
void ecvl::ResizeDim (const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &newdims, InterpolationType interp=InterpolationType::linear)
 Resizes an Image to the specified dimensions. More...
 
void ecvl::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. More...
 
void ecvl::Flip2D (const ecvl::Image &src, ecvl::Image &dst)
 Flips an Image. More...
 
void ecvl::Mirror2D (const ecvl::Image &src, ecvl::Image &dst)
 Mirrors an Image. More...
 
void ecvl::Rotate2D (const ecvl::Image &src, ecvl::Image &dst, double angle, const std::vector< double > &center={}, double scale=1.0, InterpolationType interp=InterpolationType::linear)
 Rotates an Image. More...
 
void ecvl::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. More...
 
void ecvl::ChangeColorSpace (const Image &src, Image &dst, ColorType new_type)
 Copies the source Image into destination Image changing the color space. More...
 
void ecvl::Threshold (const Image &src, Image &dst, double thresh, double maxval, ThresholdingType thresh_type=ThresholdingType::BINARY)
 Applies a fixed threshold to an input Image. More...
 
void ecvl::MultiThreshold (const Image &src, Image &dst, const std::vector< int > &thresholds, int minval=0, int maxval=255)
 Applies multiple thresholds to the input Image. More...
 
int ecvl::OtsuThreshold (const Image &src)
 Calculates the Otsu thresholding value. More...
 
std::vector< int > ecvl::OtsuMultiThreshold (const Image &src, int n_thresholds=2)
 Calculates the Otsu thresholding values. More...
 
void ecvl::Filter2D (const Image &src, Image &dst, const Image &ker, DataType type=DataType::none)
 Convolves an Image with a kernel. More...
 
void ecvl::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. More...
 
void ecvl::GaussianBlur (const Image &src, Image &dst, int sizeX, int sizeY, double sigmaX, double sigmaY=0)
 Blurs an Image using a Gaussian kernel. More...
 
void ecvl::GaussianBlur (const Image &src, Image &dst, double sigma)
 
void ecvl::AdditiveLaplaceNoise (const Image &src, Image &dst, double std_dev)
 Adds Laplace distributed noise to an Image. More...
 
void ecvl::AdditivePoissonNoise (const Image &src, Image &dst, double lambda)
 Adds Poisson distributed noise to an Image. More...
 
void ecvl::GammaContrast (const Image &src, Image &dst, double gamma)
 Adjust contrast by scaling each pixel value X to 255 * ((X/255) ** gamma). More...
 
void ecvl::CoarseDropout (const Image &src, Image &dst, double p, double drop_size, bool per_channel)
 Sets rectangular areas within an Image to zero. More...
 
void ecvl::IntegralImage (const Image &src, Image &dst, DataType dst_type=DataType::float64)
 Calculate the integral image of the source Image. More...
 
void ecvl::NonMaximaSuppression (const Image &src, Image &dst)
 Calculate the Non-Maxima suppression of the source Image. More...
 
std::vector< ecvl::Point2iecvl::GetMaxN (const Image &src, size_t n)
 Get the n maximum values that are in the source Image. More...
 
void ecvl::ConnectedComponentsLabeling (const Image &src, Image &dst)
 Labels connected components in a binary Image. More...
 
void ecvl::FindContours (const Image &src, std::vector< std::vector< Point2i >> &contours)
 Finds contours in a binary image. More...
 
void ecvl::Stack (const std::vector< Image > &src, Image &dst)
 Stack a sequence of Images along the depth dimension (images width and height must match) More...
 
void ecvl::HConcat (const std::vector< Image > &src, Image &dst)
 Horizontal concatenation of images (with the same number of rows) More...
 
void ecvl::VConcat (const std::vector< Image > &src, Image &dst)
 Vertical concatenation of images (with the same number of columns) More...
 
void ecvl::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. More...
 
void ecvl::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. More...
 
void ecvl::MeanStdDev (const Image &src, std::vector< double > &mean, std::vector< double > &stddev)
 Calculates the mean and the standard deviation of an Image. More...
 
void ecvl::Transpose (const Image &src, Image &dst)
 Swap rows and columns of an Image. More...
 
void ecvl::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. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1175. More...
 
void ecvl::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/blob/master/albumentations/augmentations/transforms.py#L1235. More...
 
void ecvl::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/master/albumentations/augmentations/transforms.py#L1114. More...
 
void ecvl::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. More...
 
void ecvl::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. More...
 
void ecvl::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 likely. More...
 
void ecvl::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 interpolation to shift each time-series by an appropriate fraction of a TR relative to the middle of the TR period. The default slice order acquisition is from the bottom of the brain to the top. More...
 
void ecvl::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. More...
 
void ecvl::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. More...
 
void ecvl::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. More...
 
void ecvl::DropColorChannel (Image &src)
 Remove color channel from the input Image. More...
 
void ecvl::Normalize (const Image &src, Image &dst, const double &mean, const double &std)
 Normalize Image image with mean and standard deviation. More...
 
void ecvl::Normalize (const Image &src, Image &dst, const std::vector< double > &mean, const std::vector< double > &std)
 Normalize xyc Image image with separate mean and standard deviation for each color channel. More...
 
void ecvl::CenterCrop (const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &size)
 Crops the given image at the center. More...
 
void ecvl::ScaleTo (const Image &src, Image &dst, const double &new_min, const double &new_max)
 Linearly scale an Image into a new range. More...