Class CvXPhoto
cv::xphoto functions
Inheritance
Inherited Members
Namespace: OpenCvSharp.XPhoto
Assembly: OpenCvSharp.dll
Syntax
public static class CvXPhoto
Methods
| Improve this Doc View SourceApplyChannelGains(InputArray, OutputArray, Single, Single, Single)
Implements an efficient fixed-point approximation for applying channel gains, which is the last step of multiple white balance algorithms.
Declaration
public static void ApplyChannelGains(InputArray src, OutputArray dst, float gainB, float gainG, float gainR)
Parameters
Type | Name | Description |
---|---|---|
InputArray | src | Input three-channel image in the BGR color space (either CV_8UC3 or CV_16UC3) |
OutputArray | dst | Output image of the same size and type as src. |
System.Single | gainB | gain for the B channel |
System.Single | gainG | gain for the G channel |
System.Single | gainR | gain for the R channel |
Bm3dDenoising(InputArray, InputOutputArray, OutputArray, Single, Int32, Int32, Int32, Int32, Int32, Int32, Single, NormTypes, Bm3dSteps, TransformTypes)
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.
Declaration
public static void Bm3dDenoising(InputArray src, InputOutputArray dstStep1, OutputArray dstStep2, float h = 1F, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2F, NormTypes normType = NormTypes.L2, Bm3dSteps step = Bm3dSteps.STEPALL, TransformTypes transformType = TransformTypes.HAAR)
Parameters
Type | Name | Description |
---|---|---|
InputArray | src | Input 8-bit or 16-bit 1-channel image. |
InputOutputArray | dstStep1 | Output image of the first step of BM3D with the same size and type as src. |
OutputArray | dstStep2 | Output image of the second step of BM3D with the same size and type as src. |
System.Single | h | Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise. |
System.Int32 | templateWindowSize | Size in pixels of the template patch that is used for block-matching. Should be power of 2. |
System.Int32 | searchWindowSize | Size 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. |
System.Int32 | blockMatchingStep1 | Block 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. |
System.Int32 | blockMatchingStep2 | Block 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. |
System.Int32 | groupSize | Maximum size of the 3D group for collaborative filtering. |
System.Int32 | slidingStep | Sliding step to process every next reference block. |
System.Single | beta | Kaiser 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. |
NormTypes | normType | Norm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results. |
Bm3dSteps | step | Step 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. |
TransformTypes | transformType | Type of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported. |
Bm3dDenoising(InputArray, OutputArray, Single, Int32, Int32, Int32, Int32, Int32, Int32, Single, NormTypes, Bm3dSteps, TransformTypes)
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.
Declaration
public static void Bm3dDenoising(InputArray src, OutputArray dst, float h = 1F, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2F, NormTypes normType = NormTypes.L2, Bm3dSteps step = Bm3dSteps.STEPALL, TransformTypes transformType = TransformTypes.HAAR)
Parameters
Type | Name | Description |
---|---|---|
InputArray | src | Input 8-bit or 16-bit 1-channel image. |
OutputArray | dst | Output image with the same size and type as src. |
System.Single | h | Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise. |
System.Int32 | templateWindowSize | Size in pixels of the template patch that is used for block-matching. Should be power of 2. |
System.Int32 | searchWindowSize | Size 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. |
System.Int32 | blockMatchingStep1 | Block 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. |
System.Int32 | blockMatchingStep2 | Block 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. |
System.Int32 | groupSize | Maximum size of the 3D group for collaborative filtering. |
System.Int32 | slidingStep | Sliding step to process every next reference block. |
System.Single | beta | Kaiser 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. |
NormTypes | normType | Norm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results. |
Bm3dSteps | step | Step 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. |
TransformTypes | transformType | Type of the orthogonal transform used in collaborative filtering step. Currently only Haar transform is supported. |
CreateGrayworldWB()
Creates an instance of GrayworldWB
Declaration
public static GrayworldWB CreateGrayworldWB()
Returns
Type | Description |
---|---|
GrayworldWB |
CreateLearningBasedWB(String)
Creates an instance of LearningBasedWB
Declaration
public static LearningBasedWB CreateLearningBasedWB(string model)
Parameters
Type | Name | Description |
---|---|---|
System.String | model | Path to a .yml file with the model. If not specified, the default model is used |
Returns
Type | Description |
---|---|
LearningBasedWB |
CreateSimpleWB()
Creates an instance of SimpleWB
Declaration
public static SimpleWB CreateSimpleWB()
Returns
Type | Description |
---|---|
SimpleWB |
DctDenoising(Mat, Mat, Double, Int32)
The function implements simple dct-based denoising
Declaration
public static void DctDenoising(Mat src, Mat dst, double sigma, int psize = 16)
Parameters
Type | Name | Description |
---|---|---|
Mat | src | source image |
Mat | dst | destination image |
System.Double | sigma | expected noise standard deviation |
System.Int32 | psize | size of block side where dct is computed |
Remarks
| Improve this Doc View SourceInpaint(Mat, Mat, Mat, InpaintTypes)
The function implements different single-image inpainting algorithms.
Declaration
public static void Inpaint(Mat src, Mat mask, Mat dst, InpaintTypes algorithm)
Parameters
Type | Name | Description |
---|---|---|
Mat | src | source 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. |
Mat | mask | mask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted |
Mat | dst | destination image |
InpaintTypes | algorithm | see OpenCvSharp.XPhoto.InpaintTypes |
OilPainting(InputArray, OutputArray, Int32, Int32, Nullable<ColorConversionCodes>)
oilPainting. See the book @cite Holzmann1988 for details.
Declaration
public static void OilPainting(InputArray src, OutputArray dst, int size, int dynRatio, ColorConversionCodes? code = null)
Parameters
Type | Name | Description |
---|---|---|
InputArray | src | Input three-channel or one channel image (either CV_8UC3 or CV_8UC1) |
OutputArray | dst | Output image of the same size and type as src. |
System.Int32 | size | neighbouring size is 2-size+1 |
System.Int32 | dynRatio | image is divided by dynRatio before histogram processing |
System.Nullable<ColorConversionCodes> | code | color space conversion code(see ColorConversionCodes). Histogram will used only first plane |