OpenCV  4.0.0-beta
Open Source Computer Vision
Classes | Enumerations | Functions
Additional photo processing algorithms

Classes

class  cv::xphoto::GrayworldWB
 Gray-world white balance algorithm. More...
 
class  cv::xphoto::LearningBasedWB
 More sophisticated learning-based automatic white balance algorithm. More...
 
class  cv::xphoto::SimpleWB
 A simple white balance algorithm that works by independently stretching each of the input image channels to the specified range. For increased robustness it ignores the top and bottom \(p\%\) of pixel values. More...
 
class  cv::xphoto::WhiteBalancer
 The base class for auto white balance algorithms. More...
 

Enumerations

enum  cv::xphoto::Bm3dSteps {
  cv::xphoto::BM3D_STEPALL = 0,
  cv::xphoto::BM3D_STEP1 = 1,
  cv::xphoto::BM3D_STEP2 = 2
}
 BM3D algorithm steps. More...
 
enum  cv::xphoto::InpaintTypes { cv::xphoto::INPAINT_SHIFTMAP = 0 }
 various inpainting algorithms More...
 
enum  cv::xphoto::TransformTypes { cv::xphoto::HAAR = 0 }
 BM3D transform types. More...
 

Functions

void cv::xphoto::applyChannelGains (InputArray src, OutputArray dst, float gainB, float gainG, float gainR)
 Implements an efficient fixed-point approximation for applying channel gains, which is the last step of multiple white balance algorithms. More...
 
void cv::xphoto::bm3dDenoising (InputArray src, InputOutputArray dstStep1, OutputArray dstStep2, float h=1, int templateWindowSize=4, int searchWindowSize=16, int blockMatchingStep1=2500, int blockMatchingStep2=400, int groupSize=8, int slidingStep=1, float beta=2.0f, int normType=cv::NORM_L2, int step=cv::xphoto::BM3D_STEPALL, int transformType=cv::xphoto::HAAR)
 Performs image denoising using the Block-Matching and 3D-filtering algorithm http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf with several computational optimizations. Noise expected to be a gaussian white noise. More...
 
void cv::xphoto::bm3dDenoising (InputArray src, OutputArray dst, float h=1, int templateWindowSize=4, int searchWindowSize=16, int blockMatchingStep1=2500, int blockMatchingStep2=400, int groupSize=8, int slidingStep=1, float beta=2.0f, int normType=cv::NORM_L2, int step=cv::xphoto::BM3D_STEPALL, int transformType=cv::xphoto::HAAR)
 Performs image denoising using the Block-Matching and 3D-filtering algorithm http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf with several computational optimizations. Noise expected to be a gaussian white noise. More...
 
Ptr< GrayworldWBcv::xphoto::createGrayworldWB ()
 Creates an instance of GrayworldWB. More...
 
Ptr< LearningBasedWBcv::xphoto::createLearningBasedWB (const String &path_to_model=String())
 Creates an instance of LearningBasedWB. More...
 
Ptr< SimpleWBcv::xphoto::createSimpleWB ()
 Creates an instance of SimpleWB. More...
 
void cv::xphoto::dctDenoising (const Mat &src, Mat &dst, const double sigma, const int psize=16)
 The function implements simple dct-based denoising. More...
 
void cv::xphoto::inpaint (const Mat &src, const Mat &mask, Mat &dst, const int algorithmType)
 The function implements different single-image inpainting algorithms. More...
 
void cv::xphoto::oilPainting (InputArray src, OutputArray dst, int size, int dynRatio, int code)
 oilPainting See the book [31] for details. More...
 
void cv::xphoto::oilPainting (InputArray src, OutputArray dst, int size, int dynRatio)
 oilPainting See the book [31] for details. More...
 

Detailed Description

Enumeration Type Documentation

§ Bm3dSteps

BM3D algorithm steps.

Enumerator
BM3D_STEPALL 
Python: cv.xphoto.BM3D_STEPALL

Execute all steps of the algorithm

BM3D_STEP1 
Python: cv.xphoto.BM3D_STEP1

Execute only first step of the algorithm

BM3D_STEP2 
Python: cv.xphoto.BM3D_STEP2

Execute only second step of the algorithm

§ InpaintTypes

various inpainting algorithms

Enumerator
INPAINT_SHIFTMAP 
Python: cv.xphoto.INPAINT_SHIFTMAP

This algorithm searches for dominant correspondences (transformations) of image patches and tries to seamlessly fill-in the area to be inpainted using this transformations

§ TransformTypes

BM3D transform types.

Enumerator
HAAR 
Python: cv.xphoto.HAAR

Un-normalized Haar transform

Function Documentation

§ applyChannelGains()

void cv::xphoto::applyChannelGains ( InputArray  src,
OutputArray  dst,
float  gainB,
float  gainG,
float  gainR 
)
Python:
dst=cv.xphoto.applyChannelGains(src, gainB, gainG, gainR[, dst])

Implements an efficient fixed-point approximation for applying channel gains, which is the last step of multiple white balance algorithms.

Parameters
srcInput three-channel image in the BGR color space (either CV_8UC3 or CV_16UC3)
dstOutput image of the same size and type as src.
gainBgain for the B channel
gainGgain for the G channel
gainRgain for the R channel

§ bm3dDenoising() [1/2]

void cv::xphoto::bm3dDenoising ( InputArray  src,
InputOutputArray  dstStep1,
OutputArray  dstStep2,
float  h = 1,
int  templateWindowSize = 4,
int  searchWindowSize = 16,
int  blockMatchingStep1 = 2500,
int  blockMatchingStep2 = 400,
int  groupSize = 8,
int  slidingStep = 1,
float  beta = 2.0f,
int  normType = cv::NORM_L2,
int  step = cv::xphoto::BM3D_STEPALL,
int  transformType = cv::xphoto::HAAR 
)
Python:
dstStep1, dstStep2=cv.xphoto.bm3dDenoising(src, dstStep1[, dstStep2[, h[, templateWindowSize[, searchWindowSize[, blockMatchingStep1[, blockMatchingStep2[, groupSize[, slidingStep[, beta[, normType[, step[, transformType]]]]]]]]]]]])
dst=cv.xphoto.bm3dDenoising(src[, dst[, h[, templateWindowSize[, searchWindowSize[, blockMatchingStep1[, blockMatchingStep2[, groupSize[, slidingStep[, beta[, normType[, step[, transformType]]]]]]]]]]]])

Performs image denoising using the Block-Matching and 3D-filtering algorithm http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf with several computational optimizations. Noise expected to be a gaussian white noise.

Parameters
srcInput 8-bit or 16-bit 1-channel image.
dstStep1Output image of the first step of BM3D with the same size and type as src.
dstStep2Output image of the second step of BM3D with the same size and type as src.
hParameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
templateWindowSizeSize in pixels of the template patch that is used for block-matching. Should be power of 2.
searchWindowSizeSize in pixels of the window that is used to perform block-matching. Affect performance linearly: greater searchWindowsSize - greater denoising time. Must be larger than templateWindowSize.
blockMatchingStep1Block matching threshold for the first step of BM3D (hard thresholding), i.e. maximum distance for which two blocks are considered similar. Value expressed in euclidean distance.
blockMatchingStep2Block matching threshold for the second step of BM3D (Wiener filtering), i.e. maximum distance for which two blocks are considered similar. Value expressed in euclidean distance.
groupSizeMaximum size of the 3D group for collaborative filtering.
slidingStepSliding step to process every next reference block.
betaKaiser window parameter that affects the sidelobe attenuation of the transform of the window. Kaiser window is used in order to reduce border effects. To prevent usage of the window, set beta to zero.
normTypeNorm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results.
stepStep of BM3D to be executed. Possible variants are: step 1, step 2, both steps.
transformTypeType of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported.

This function expected to be applied to grayscale images. Advanced usage of this function can be manual denoising of colored image in different colorspaces.

See also
fastNlMeansDenoising

§ bm3dDenoising() [2/2]

void cv::xphoto::bm3dDenoising ( InputArray  src,
OutputArray  dst,
float  h = 1,
int  templateWindowSize = 4,
int  searchWindowSize = 16,
int  blockMatchingStep1 = 2500,
int  blockMatchingStep2 = 400,
int  groupSize = 8,
int  slidingStep = 1,
float  beta = 2.0f,
int  normType = cv::NORM_L2,
int  step = cv::xphoto::BM3D_STEPALL,
int  transformType = cv::xphoto::HAAR 
)
Python:
dstStep1, dstStep2=cv.xphoto.bm3dDenoising(src, dstStep1[, dstStep2[, h[, templateWindowSize[, searchWindowSize[, blockMatchingStep1[, blockMatchingStep2[, groupSize[, slidingStep[, beta[, normType[, step[, transformType]]]]]]]]]]]])
dst=cv.xphoto.bm3dDenoising(src[, dst[, h[, templateWindowSize[, searchWindowSize[, blockMatchingStep1[, blockMatchingStep2[, groupSize[, slidingStep[, beta[, normType[, step[, transformType]]]]]]]]]]]])

Performs image denoising using the Block-Matching and 3D-filtering algorithm http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf with several computational optimizations. Noise expected to be a gaussian white noise.

Parameters
srcInput 8-bit or 16-bit 1-channel image.
dstOutput image with the same size and type as src.
hParameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
templateWindowSizeSize in pixels of the template patch that is used for block-matching. Should be power of 2.
searchWindowSizeSize in pixels of the window that is used to perform block-matching. Affect performance linearly: greater searchWindowsSize - greater denoising time. Must be larger than templateWindowSize.
blockMatchingStep1Block matching threshold for the first step of BM3D (hard thresholding), i.e. maximum distance for which two blocks are considered similar. Value expressed in euclidean distance.
blockMatchingStep2Block matching threshold for the second step of BM3D (Wiener filtering), i.e. maximum distance for which two blocks are considered similar. Value expressed in euclidean distance.
groupSizeMaximum size of the 3D group for collaborative filtering.
slidingStepSliding step to process every next reference block.
betaKaiser window parameter that affects the sidelobe attenuation of the transform of the window. Kaiser window is used in order to reduce border effects. To prevent usage of the window, set beta to zero.
normTypeNorm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results.
stepStep of BM3D to be executed. Allowed are only BM3D_STEP1 and BM3D_STEPALL. BM3D_STEP2 is not allowed as it requires basic estimate to be present.
transformTypeType of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported.

This function expected to be applied to grayscale images. Advanced usage of this function can be manual denoising of colored image in different colorspaces.

See also
fastNlMeansDenoising

§ createGrayworldWB()

Ptr<GrayworldWB> cv::xphoto::createGrayworldWB ( )
Python:
retval=cv.xphoto.createGrayworldWB()

Creates an instance of GrayworldWB.

§ createLearningBasedWB()

Ptr<LearningBasedWB> cv::xphoto::createLearningBasedWB ( const String path_to_model = String())
Python:
retval=cv.xphoto.createLearningBasedWB([, path_to_model])

Creates an instance of LearningBasedWB.

Parameters
path_to_modelPath to a .yml file with the model. If not specified, the default model is used

§ createSimpleWB()

Ptr<SimpleWB> cv::xphoto::createSimpleWB ( )
Python:
retval=cv.xphoto.createSimpleWB()

Creates an instance of SimpleWB.

§ dctDenoising()

void cv::xphoto::dctDenoising ( const Mat src,
Mat dst,
const double  sigma,
const int  psize = 16 
)
Python:
None=cv.xphoto.dctDenoising(src, dst, sigma[, psize])

The function implements simple dct-based denoising.

http://www.ipol.im/pub/art/2011/ys-dct/.

Parameters
srcsource image
dstdestination image
sigmaexpected noise standard deviation
psizesize of block side where dct is computed
See also
fastNlMeansDenoising

§ inpaint()

void cv::xphoto::inpaint ( const Mat src,
const Mat mask,
Mat dst,
const int  algorithmType 
)
Python:
None=cv.xphoto.inpaint(src, mask, dst, algorithmType)

The function implements different single-image inpainting algorithms.

See the original paper [83] for details.

Parameters
srcsource image, it could be of any type and any number of channels from 1 to 4. In case of 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first color component shows intensity, while second and third shows colors. Nonetheless you can try any colorspaces.
maskmask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted
dstdestination image
algorithmTypesee xphoto::InpaintTypes

§ oilPainting() [1/2]

void cv::xphoto::oilPainting ( InputArray  src,
OutputArray  dst,
int  size,
int  dynRatio,
int  code 
)
Python:
dst=cv.xphoto.oilPainting(src, size, dynRatio, code[, dst])
dst=cv.xphoto.oilPainting(src, size, dynRatio[, dst])

oilPainting See the book [31] for details.

Parameters
srcInput three-channel or one channel image (either CV_8UC3 or CV_8UC1)
dstOutput image of the same size and type as src.
sizeneighbouring size is 2-size+1
dynRatioimage is divided by dynRatio before histogram processing
codecolor space conversion code(see ColorConversionCodes). Histogram will used only first plane

§ oilPainting() [2/2]

void cv::xphoto::oilPainting ( InputArray  src,
OutputArray  dst,
int  size,
int  dynRatio 
)
Python:
dst=cv.xphoto.oilPainting(src, size, dynRatio, code[, dst])
dst=cv.xphoto.oilPainting(src, size, dynRatio[, dst])

oilPainting See the book [31] for details.

Parameters
srcInput three-channel or one channel image (either CV_8UC3 or CV_8UC1)
dstOutput image of the same size and type as src.
sizeneighbouring size is 2-size+1
dynRatioimage is divided by dynRatio before histogram processing