Class XPhotoInvoke
Class that contains entry points for the XPhoto module.
public static class XPhotoInvoke
- Inheritance
-
XPhotoInvoke
- Inherited Members
Methods
ApplyChannelGains(IInputArray, IOutputArray, float, float, float)
Implements an efficient fixed-point approximation for applying channel gains, which is the last step of multiple white balance algorithms.
public static void ApplyChannelGains(IInputArray src, IOutputArray dst, float gainB, float gainG, float gainR)
Parameters
src
IInputArrayInput three-channel image in the BGR color space (either CV_8UC3 or CV_16UC3)
dst
IOutputArrayOutput image of the same size and type as src.
gainB
floatGain for the B channel
gainG
floatGain for the G channel
gainR
floatGain for the R channel
Bm3dDenoising(IInputArray, IInputOutputArray, IOutputArray, float, int, int, int, int, int, int, float, NormType, Bm3dSteps, TransformTypes)
Performs image denoising using the Block-Matching and 3D-filtering algorithm with several computational optimizations. Noise expected to be a gaussian white noise.
public static void Bm3dDenoising(IInputArray src, IInputOutputArray dstStep1, IOutputArray 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, NormType normType = NormType.L2, Bm3dSteps step = Bm3dSteps.All, TransformTypes transformType = TransformTypes.Haar)
Parameters
src
IInputArrayInput 8-bit or 16-bit 1-channel image.
dstStep1
IInputOutputArrayOutput image of the first step of BM3D with the same size and type as src.
dstStep2
IOutputArrayOutput image of the second step of BM3D with the same size and type as src.
h
floatParameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
templateWindowSize
intSize in pixels of the template patch that is used for block-matching. Should be power of 2.
searchWindowSize
intSize 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.
blockMatchingStep1
intBlock 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.
blockMatchingStep2
intBlock 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.
groupSize
intMaximum size of the 3D group for collaborative filtering.
slidingStep
intSliding step to process every next reference block.
beta
floatKaiser 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.
normType
NormTypeNorm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results.
step
Bm3dStepsStep of BM3D to be executed. Possible variants are: step 1, step 2, both steps.
transformType
TransformTypesType of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported.
Remarks
Bm3dDenoising(IInputArray, IOutputArray, float, int, int, int, int, int, int, float, NormType, Bm3dSteps, TransformTypes)
Performs image denoising using the Block-Matching and 3D-filtering algorithm with several computational optimizations. Noise expected to be a gaussian white noise.
public static void Bm3dDenoising(IInputArray src, IOutputArray 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, NormType normType = NormType.L2, Bm3dSteps step = Bm3dSteps.All, TransformTypes transformType = TransformTypes.Haar)
Parameters
src
IInputArrayInput 8-bit or 16-bit 1-channel image.
dst
IOutputArrayOutput image with the same size and type as src.
h
floatParameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
templateWindowSize
intSize in pixels of the template patch that is used for block-matching. Should be power of 2.
searchWindowSize
intSize 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.
blockMatchingStep1
intBlock 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.
blockMatchingStep2
intBlock 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.
groupSize
intMaximum size of the 3D group for collaborative filtering.
slidingStep
intSliding step to process every next reference block.
beta
floatKaiser 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.
normType
NormTypeNorm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results.
step
Bm3dStepsStep 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.
transformType
TransformTypesType of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported.
Remarks
DctDenoising(Mat, Mat, double, int)
The function implements simple dct-based denoising, link: http://www.ipol.im/pub/art/2011/ys-dct/.
public static void DctDenoising(Mat src, Mat dst, double sigma, int psize = 16)
Parameters
src
MatSource image
dst
MatDestination image
sigma
doubleExpected noise standard deviation
psize
intSize of block side where dct is computed
Inpaint(Mat, Mat, Mat, InpaintType)
The function implements different single-image inpainting algorithms
public static void Inpaint(Mat src, Mat mask, Mat dst, XPhotoInvoke.InpaintType algorithmType)
Parameters
src
Matsource 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.
mask
Matmask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted
dst
Matdestination image
algorithmType
XPhotoInvoke.InpaintTypealgorithm type
OilPainting(IInputArray, IOutputArray, int, int, ColorConversion)
Oil Painting effect
public static void OilPainting(IInputArray src, IOutputArray dst, int size, int dynRatio, ColorConversion code = ColorConversion.Bgr2Gray)
Parameters
src
IInputArrayInput three-channel or one channel image (either CV_8UC3 or CV_8UC1)
dst
IOutputArrayOutput image of the same size and type as src.
size
intNeighbouring size is 2-size+1
dynRatio
intImage is divided by dynRatio before histogram processing
code
ColorConversionColor space conversion code(see ColorConversionCodes). Histogram will used only first plane