Read@CVL
rdf::IP Class Reference

#include <ImageProcessor.h>

Public Types

enum  MorphShape { morph_square = 0, morph_disk }
 
enum  MorphBorder { border_zero = 0, border_flip }
 

Static Public Member Functions

static cv::Mat createStructuringElement (int seSize, int shape)
 Creates the structuring element for morphological operations. More...
 
static cv::Mat dilateImage (const cv::Mat &bwImg, int seSize, MorphShape shape=IP::morph_square, int borderValue=0)
 Dilates the image bwImg with a given structuring element. More...
 
static cv::Mat erodeImage (const cv::Mat &bwImg, int seSize, MorphShape shape=IP::morph_square, int borderValue=255)
 Erodes the image bwimg with a given structuring element. More...
 
static cv::Mat convolveIntegralImage (const cv::Mat &src, const int kernelSizeX, const int kernelSizeY=0, MorphBorder norm=IP::border_zero)
 Convolves an integral image by means of box filters. This functions applies box filtering. It is specifically useful for the computation of image sums, mean filtering and standard deviation with big kernel sizes. More...
 
static cv::Mat get1DGauss (double sigma, int kernelsize=-1)
 Computes a 1D Gaussian filter kernel. The kernel's size is adjusted to the standard deviation. More...
 
static cv::Mat threshOtsu (const cv::Mat &srcImg, int thType=CV_THRESH_BINARY_INV)
 Threshold an image using Otsu as threshold. More...
 
static double getThreshOtsu (const cv::Mat &hist, const double otsuThresh=0)
 Gets the Otsu threshold based on a certain histogram. More...
 
static void setBorderConst (cv::Mat &src, float val=0.0f)
 Sets the border to a constant value (1 pixel width). More...
 
static void invertImg (cv::Mat &srcImg, cv::Mat mask=cv::Mat())
 Inverts the img. More...
 
static cv::Mat preFilterArea (const cv::Mat &img, int minArea, int maxArea=-1)
 Prefilters an binary image according to the blob size. Should be done to remove small blobs and to reduce the runtime of cvFindContours. More...
 
static cv::Mat computeHist (const cv::Mat img, const cv::Mat mask=cv::Mat())
 Computes the histogram of an image. More...
 
static cv::Mat estimateMask (const cv::Mat &src, bool preFilter=true)
 Estimates the mask. More...
 
static void mulMask (cv::Mat &src, cv::Mat mask=cv::Mat())
 Applies a mask to the image. More...
 
static QPointF calcRotationSize (double angleRad, const QPointF &srcSize)
 Calculates the image size of the rotated image. More...
 
static cv::Mat rotateImage (const cv::Mat &src, double angleRad, int interpolation=cv::INTER_CUBIC, cv::Scalar borderValue=cv::Scalar(0))
 Rotates an image according to the angle obtained. The new image bounds are minimized with respect to the angle obtained. positive angle values mean counterclockwise rotation More...
 
static cv::Mat invert (const cv::Mat &src)
 
static cv::Mat grayscale (const cv::Mat &src)
 Returns the Luminance channel of Luv which is better than the RGB2Gray. More...
 
static cv::Mat computeHist (const cv::Mat &data, int width, int numElements=-1, double *maxBin=0)
 Computes the histogram of data. Data can be any type (it will be reduced to CV_32F). More...
 
static void draw (const std::vector< cv::Point > &pts, cv::Mat &img, unsigned char val=255)
 
static double statMomentMat (const cv::Mat &src, const cv::Mat &mask=cv::Mat(), double momentValue=0.5, int maxSamples=10000, int area=-1)
 Computes robust statistical moments of an image. The quantiles of an image (or median) are computed. More...
 
static QColor statMomentColor (const cv::Mat &src, const cv::Mat &mask=cv::Mat(), double momentValue=0.5)
 
static void normalize (cv::Mat &src)
 

Member Enumeration Documentation

Enumerator
border_zero 
border_flip 
Enumerator
morph_square 
morph_disk 

Member Function Documentation

QPointF rdf::IP::calcRotationSize ( double  angleRad,
const QPointF &  srcSize 
)
static

Calculates the image size of the rotated image.

Parameters
angleRadThe angle in radians.
srcSizeSize of the source image.
Returns
The Size of the rotated image.
cv::Mat rdf::IP::computeHist ( const cv::Mat  img,
const cv::Mat  mask = cv::Mat() 
)
static

Computes the histogram of an image.

Parameters
imgThe source img CV_32FC1.
maskThe mask CV_8UC1 or CV_32FC1.
Returns
The histogram of the img as cv::mat CV_32FC1.
cv::Mat rdf::IP::computeHist ( const cv::Mat &  data,
int  width,
int  numElements = -1,
double *  maxBin = 0 
)
static

Computes the histogram of data. Data can be any type (it will be reduced to CV_32F).

Parameters
dataThe data.
widthThe length of the resulting histogram.
numElementsThe number elements if data has more elements, it will be downsampled accordingly.
maxBinThe maximal bin of the resulting histogram.
Returns
A 1xN CV_32F. Each element represents a bin computed from data.
cv::Mat rdf::IP::convolveIntegralImage ( const cv::Mat &  src,
const int  kernelSizeX,
const int  kernelSizeY = 0,
MorphBorder  norm = IP::border_zero 
)
static

Convolves an integral image by means of box filters. This functions applies box filtering. It is specifically useful for the computation of image sums, mean filtering and standard deviation with big kernel sizes.

Parameters
srcThe integral image CV_64FC1.
kernelSizeXThe box filter's size.
kernelSizeYThe box filter's size.
normIf BORDER_ZERO an image sum is computed, if BORDER_FLIP a mean filtering is applied.
Returns
The convolved image CV_32FC1.
cv::Mat rdf::IP::createStructuringElement ( int  seSize,
int  shape 
)
static

Creates the structuring element for morphological operations.

Parameters
seSizeSize of the structuring element.
shapeThe shape (either Square or Disk).
Returns
A cvMat containing the structuring element (CV_8UC1).
cv::Mat rdf::IP::dilateImage ( const cv::Mat &  bwImg,
int  seSize,
MorphShape  shape = IP::morph_square,
int  borderValue = 0 
)
static

Dilates the image bwImg with a given structuring element.

Parameters
bwImgThe bwImg: a grayscale image CV_8U (or CV_32F [0 1] but slower).
seSizeThe structuring element's size.
shapeThe shape (either Square or Disk).
borderValueThe border value.
Returns
An dilated image (CV_8U or CV_32F).
void rdf::IP::draw ( const std::vector< cv::Point > &  pts,
cv::Mat &  img,
unsigned char  val = 255 
)
static
cv::Mat rdf::IP::erodeImage ( const cv::Mat &  bwImg,
int  seSize,
MorphShape  shape = IP::morph_square,
int  borderValue = 255 
)
static

Erodes the image bwimg with a given structuring element.

Parameters
bwImgThe bwimg: a grayscale image CV_8U (or CV_32F [0 1] but slower).
seSizeThe structuring element's size.
shapeThe shape (either Square or Disk).
borderValueThe border value.
Returns
An eroded image (CV_8U or CV_32F).
cv::Mat rdf::IP::estimateMask ( const cv::Mat &  src,
bool  preFilter = true 
)
static

Estimates the mask.

Parameters
srcThe source image.
Returns
The estimated mask.
cv::Mat rdf::IP::get1DGauss ( double  sigma,
int  kernelsize = -1 
)
static

Computes a 1D Gaussian filter kernel. The kernel's size is adjusted to the standard deviation.

Parameters
sigmaThe standard deviation of the Gaussian.
Returns
The Gaussian kernel CV_32FC1
double rdf::IP::getThreshOtsu ( const cv::Mat &  hist,
const double  otsuThresh = 0 
)
static

Gets the Otsu threshold based on a certain histogram.

Parameters
histThe histogram CV_32FC1.
otsuThreshThe otsu threshold - deprecated.
Returns
The computed threshold.
cv::Mat rdf::IP::grayscale ( const cv::Mat &  src)
static

Returns the Luminance channel of Luv which is better than the RGB2Gray.

Parameters
srcThe source.
Returns
cv::Mat rdf::IP::invert ( const cv::Mat &  src)
static
void rdf::IP::invertImg ( cv::Mat &  srcImg,
cv::Mat  mask = cv::Mat() 
)
static

Inverts the img.

Parameters
srcImgThe source img CV_32FC1 [0 1] or CV_8UC1.
maskThe mask.
void rdf::IP::mulMask ( cv::Mat &  src,
cv::Mat  mask = cv::Mat() 
)
static

Applies a mask to the image.

Parameters
srcThe source img CV_8U or CV_32F.
maskThe optional mask CV_8U or CV_32F.
void rdf::IP::normalize ( cv::Mat &  src)
static
cv::Mat rdf::IP::preFilterArea ( const cv::Mat &  img,
int  minArea,
int  maxArea = -1 
)
static

Prefilters an binary image according to the blob size. Should be done to remove small blobs and to reduce the runtime of cvFindContours.

Parameters
imgThe source img CV_8UC1.
minAreaThe blob size threshold in pixel.
maxAreaThe maximum area.
Returns
A CV_8UC1 binary image with all blobs smaller than minArea removed.
cv::Mat rdf::IP::rotateImage ( const cv::Mat &  src,
double  angleRad,
int  interpolation = cv::INTER_CUBIC,
cv::Scalar  borderValue = cv::Scalar(0) 
)
static

Rotates an image according to the angle obtained. The new image bounds are minimized with respect to the angle obtained. positive angle values mean counterclockwise rotation

Parameters
srcThe source image.
angleRadThe angle in RAD.
interpolationThe interpolation.
borderValueThe border value.
Returns
The rotated image.
void rdf::IP::setBorderConst ( cv::Mat &  src,
float  val = 0.0f 
)
static

Sets the border to a constant value (1 pixel width).

Parameters
srcThe source image CV_32F or CV_8U.
valThe border value.
QColor rdf::IP::statMomentColor ( const cv::Mat &  src,
const cv::Mat &  mask = cv::Mat(),
double  momentValue = 0.5 
)
static
double rdf::IP::statMomentMat ( const cv::Mat &  src,
const cv::Mat &  mask = cv::Mat(),
double  momentValue = 0.5,
int  maxSamples = 10000,
int  area = -1 
)
static

Computes robust statistical moments of an image. The quantiles of an image (or median) are computed.

Parameters
srcThe source image CV_32FC1.
maskThe mask CV_32FC1 or CV_8UC1.
momentValueThe moment (e.g. 0.5 for median, 0.25 or 0.75 for quartiles).
maxSamplesThe maximum number of samples (speed up).
areaThe mask's area (speed up).
Returns
The statistical moment.
cv::Mat rdf::IP::threshOtsu ( const cv::Mat &  srcImg,
int  thType = CV_THRESH_BINARY_INV 
)
static

Threshold an image using Otsu as threshold.

Parameters
srcImgThe source img CV_8UC1 or CV_8UC3.
Returns
A binary image CV_8UC1

The documentation for this class was generated from the following files: