Rudin-Osher-Fatemi Total Variation Denoising using Split Bregman
|
tvreg options handling and internal definitions More...
#include "tvreg.h"
Go to the source code of this file.
Data Structures | |
struct | numvec2 |
2D vector with num components More... | |
struct | tag_tvregopt |
Options handling for TvRestore. More... | |
struct | tag_tvregsolver |
TvRestore solver state. More... | |
Macros | |
#define | ALGSTRING_SIZE 128 |
Size of the string buffer for holding the algorithm description. | |
#define | _TVREG_CONCAT(A, B) A ## B |
Token concatenation macro. More... | |
#define | FFT(S) _TVREG_CONCAT(fftw_,S) |
Typedefs | |
typedef num | numcomplex [2] |
Complex value type. | |
typedef struct tag_tvregsolver | tvregsolver |
TvRestore solver state. More... | |
typedef num(* | usolver )(tvregsolver *) |
typedef void(* | zsolver )(tvregsolver *) |
Enumerations | |
enum | noisemodel { NOISEMODEL_L2, NOISEMODEL_L1, NOISEMODEL_POISSON } |
Enum of the noise models supported by TvRestore. | |
Functions | |
static int | TvRestoreChooseAlgorithm (int *UseZ, int *DeconvFlag, int *DctFlag, usolver *USolveFun, zsolver *ZSolveFun, const tvregopt *Opt) |
int | TvRestoreSimplePlot (int State, int Iter, num Delta, ATTRIBUTE_UNUSED const num *u, ATTRIBUTE_UNUSED int Width, ATTRIBUTE_UNUSED int Height, ATTRIBUTE_UNUSED int NumChannels, ATTRIBUTE_UNUSED void *Param) |
tvregopt * | TvRegNewOpt () |
Create a new tvregopt options object. More... | |
void | TvRegFreeOpt (tvregopt *Opt) |
Free tvregopt options object. More... | |
void | TvRegSetLambda (tvregopt *Opt, num Lambda) |
Specify fidelity weight lambda. More... | |
void | TvRegSetVaryingLambda (tvregopt *Opt, const num *VaryingLambda, int LambdaWidth, int LambdaHeight) |
Specify spatially varying fidelity weight. More... | |
void | TvRegSetKernel (tvregopt *Opt, const num *Kernel, int KernelWidth, int KernelHeight) |
Specify kernel for a deconvolution problem. More... | |
void | TvRegSetTol (tvregopt *Opt, num Tol) |
Specify convergence tolerance. More... | |
void | TvRegSetGamma1 (tvregopt *Opt, num Gamma1) |
Specify d = grad u penalty weight. More... | |
void | TvRegSetGamma2 (tvregopt *Opt, num Gamma2) |
Specify z = Ku constraint weight. More... | |
void | TvRegSetMaxIter (tvregopt *Opt, int MaxIter) |
Specify the maximum number of iterations. More... | |
int | TvRegSetNoiseModel (tvregopt *Opt, const char *NoiseModel) |
Specify noise model. More... | |
void | TvRegSetPlotFun (tvregopt *Opt, int(*PlotFun)(int, int, num, const num *, int, int, int, void *), void *PlotParam) |
Specify plotting function. More... | |
void | TvRegPrintOpt (const tvregopt *Opt) |
Debugging function that prints the current options. More... | |
const char * | TvRegGetAlgorithm (const tvregopt *Opt) |
Get a string description of the selected restoration algorithm. More... | |
Variables | |
tvregopt | TvRegDefaultOpt |
Default options struct. More... | |
tvreg options handling and internal definitions
Copyright (c) 2010-2012, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file tvregopt.h.
#define _TVREG_CONCAT | ( | A, | |
B | |||
) | A ## B |
Token concatenation macro.
This extra level of indirection is needed so that macros expand before token pasting. The use of this concatenation is for a name mangling macro FFT(S) for using num with the FFTW library. The macro is defined such that FFT(functionname) expands to fftwf_functionname if num is single, or fftw_functionname if num is double, according to whether NUM_SINGLE is defined.
Definition at line 41 of file tvregopt.h.
typedef struct tag_tvregsolver tvregsolver |
TvRestore solver state.
This struct represents the TvRestore solver state. It holds all variables and parameters to be passed between TvRestore() and the solver subroutines.
void TvRegFreeOpt | ( | tvregopt * | Opt | ) |
Free tvregopt options object.
Opt | tvregopt options object |
Definition at line 203 of file tvregopt.h.
const char* TvRegGetAlgorithm | ( | const tvregopt * | Opt | ) |
Get a string description of the selected restoration algorithm.
Opt | tvregopt options object |
This routine calls TvRestoreChooseAlgorithm() and translates the result to a text string. The string is stored in a small buffer within the tvregopt and does not need to be released separately.
Definition at line 484 of file tvregopt.h.
tvregopt* TvRegNewOpt | ( | ) |
Create a new tvregopt options object.
This routine creates a new tvregopt options object and initializes it to default values. It is the caller's responsibility to call TvRegFreeOpt() to free the tvregopt object when done.
Definition at line 182 of file tvregopt.h.
void TvRegPrintOpt | ( | const tvregopt * | Opt | ) |
Debugging function that prints the current options.
Opt | tvregopt options object |
Definition at line 420 of file tvregopt.h.
void TvRegSetGamma1 | ( | tvregopt * | Opt, |
num | Gamma1 | ||
) |
Specify d = grad u penalty weight.
Opt | tvregopt options object |
Gamma1 | penalty (positive scalar) |
Definition at line 299 of file tvregopt.h.
void TvRegSetGamma2 | ( | tvregopt * | Opt, |
num | Gamma2 | ||
) |
Specify z = Ku constraint weight.
Opt | tvregopt options object |
Gamma1 | penalty (positive scalar) |
Definition at line 311 of file tvregopt.h.
void TvRegSetKernel | ( | tvregopt * | Opt, |
const num * | Kernel, | ||
int | KernelWidth, | ||
int | KernelHeight | ||
) |
Specify kernel for a deconvolution problem.
Opt | tvregopt options object |
Kernel | pointer to convolution kernel |
KernelWidth,KernelHeight | dimensions of the kernel |
Kernel should be a contiguous array of size KernelWidth by KernelHeight in row-major order, Kernel[x + KernelWidth*y] = K(x,y). If Kernel = NULL, then no deconvolution is performed.
Definition at line 270 of file tvregopt.h.
void TvRegSetLambda | ( | tvregopt * | Opt, |
num | Lambda | ||
) |
Specify fidelity weight lambda.
Opt | tvregopt options object |
Lambda | fidelity weight (positive scalar) |
Definition at line 219 of file tvregopt.h.
void TvRegSetMaxIter | ( | tvregopt * | Opt, |
int | MaxIter | ||
) |
Specify the maximum number of iterations.
Opt | tvregopt options object |
MaxIter | maximum number of iterations |
Definition at line 323 of file tvregopt.h.
int TvRegSetNoiseModel | ( | tvregopt * | Opt, |
const char * | NoiseModel | ||
) |
Specify noise model.
Opt | tvregopt options object |
NoiseModel | string |
NoiseModel should be a string specifying one of the following:
Definition at line 346 of file tvregopt.h.
void TvRegSetPlotFun | ( | tvregopt * | Opt, |
int(*)(int, int, num, const num *, int, int, int, void *) | PlotFun, | ||
void * | PlotParam | ||
) |
Specify plotting function.
Opt | tvregopt options object |
PlotFun | plotting function |
PlotParam | void pointer for passing addition parameters |
Specifying the plotting function gives control over how TvRestore displays information. Setting PlotFun = NULL disables all normal display (error messages are still displayed).
An example PlotFun is
The State argument is either 0, 1, or 2, and indicates TvRestore's status. Iter is the number of Bregman iterations completed, Delta is the change in the solution Delta = ||u^cur - u^prev||_2 / ||f||_2. Argument u gives a pointer to the current solution, which can be used to plot an animated display of the solution progress. PlotParam is a void pointer that can be used to pass additional information to PlotFun if needed.
Definition at line 404 of file tvregopt.h.
void TvRegSetTol | ( | tvregopt * | Opt, |
num | Tol | ||
) |
Specify convergence tolerance.
Opt | tvregopt options object |
Tol | convergence tolerance (positive scalar) |
Definition at line 287 of file tvregopt.h.
void TvRegSetVaryingLambda | ( | tvregopt * | Opt, |
const num * | VaryingLambda, | ||
int | LambdaWidth, | ||
int | LambdaHeight | ||
) |
Specify spatially varying fidelity weight.
Opt | tvregopt options object |
VaryingLambda | pointer to Lambda array |
LambdaWidth,LambdaHeight | dimensions of the array |
VaryingLambda should be a contiguous array of size LambdaWidth by LambdaHeight in row-major order of nonnegative values, VaryingLambda[x + Width*y] = fidelity weight at pixel (x,y). Smaller VaryingLambda at a point implies stronger denoising, and a value of zero specifies that the point should be inpainted.
If VaryingLambda = NULL, the constant Lambda value is used.
For inpainting, set VaryingLambda as VaryingLambda[x + Width*y] = 0 if pixel (x,y) is unknown, VaryingLambda[x + Width*y] = C if pixel (x,y) is known, where C is a positive constant. Unknown pixels are inpainted (interpolated). Known pixels are denoised (and deconvolved, if a kernel is also set). To keep the known pixels (approximately) unchanged, set C to a large value.
Definition at line 247 of file tvregopt.h.
tvregopt TvRegDefaultOpt |
Default options struct.
Definition at line 134 of file tvregopt.h.