Total Variation Deconvolution using Split Bregman
Data Structures | Macros | Typedefs | Enumerations | Functions
imblur.c File Reference

Image blurring command line program. More...

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <fftw3.h>
#include "cliio.h"
#include "kernels.h"
#include "randmt.h"

Go to the source code of this file.

Data Structures

struct  programparams
 Program parameters struct. More...
 

Macros

#define MIN(a, b)   (((a) <= (b)) ? (a) : (b))
 
#define _CONCAT(A, B)   A ## B
 
#define FFT(S)   _CONCAT(fftw_,S)
 

Typedefs

typedef num numcomplex [2]
 Complex value type.
 

Enumerations

enum  noisetype { NOISE_GAUSSIAN, NOISE_LAPLACE, NOISE_POISSON }
 

Functions

static void PrintHelpMessage ()
 Print program information and usage message.
 
int ParseParams (programparams *Params, int argc, const char *argv[])
 Parse command line arguments.
 
static num WSymExtension (const num *Data, int Width, int Height, int x, int y)
 Boundary handling function for whole-sample symmetric extension. More...
 
numcomplexComputePaddedDFT (num *PadTemp, int PadWidth, int PadHeight, const num *Src, int SrcWidth, int SrcHeight, int IsKernelFlag)
 Pad an image and compute Fourier transform. More...
 
int ComputePaddedIDFT (num *Dest, int DestWidth, int DestHeight, num *PadTemp, int PadWidth, int PadHeight, numcomplex *Src)
 Invert Fourier transform and trim padding. More...
 
int BlurImage (num *Image, int ImageWidth, int ImageHeight, int NumChannels, const num *Kernel, int KernelWidth, int KernelHeight)
 Convolve an image with a kernel. More...
 
void GenerateNoise (num *Data, long NumEl, noisetype NoiseType, num Sigma)
 Simulate noise of a specified type and standard deviation. More...
 
int main (int argc, char **argv)
 
static int ReadNoise (programparams *Params, const char *String)
 Parse noise command line argument.
 

Detailed Description

Image blurring command line program.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.gmail.nosp@m..com

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 with this program. If not, see http://www.opensource.org/licenses/bsd-license.html.

Definition in file imblur.c.

Function Documentation

int BlurImage ( num *  Image,
int  ImageWidth,
int  ImageHeight,
int  NumChannels,
const num *  Kernel,
int  KernelWidth,
int  KernelHeight 
)

Convolve an image with a kernel.

Parameters
Imagethe image data in row-major planar order
ImageWidth,ImageHeight,NumChannelsthe image dimensions
Kernelthe convolution kernel
KernelWidth,KernelHeightthe kernel dimensions
Returns
1 on success, 0 on failure

Definition at line 235 of file imblur.c.

numcomplex* ComputePaddedDFT ( num *  PadTemp,
int  PadWidth,
int  PadHeight,
const num *  Src,
int  SrcWidth,
int  SrcHeight,
int  IsKernelFlag 
)

Pad an image and compute Fourier transform.

Parameters
PadTemptemporary buffer
PadWidth,PadHeightdimensions of the padded image
Srcthe source image
SrcWidth,SrcHeightdimensions of Src
IsKernelFlagnonzero if Src is a convolution kernel
Returns
the Fourier transform of the padded image, or NULL on failure

Definition at line 132 of file imblur.c.

int ComputePaddedIDFT ( num *  Dest,
int  DestWidth,
int  DestHeight,
num *  PadTemp,
int  PadWidth,
int  PadHeight,
numcomplex Src 
)

Invert Fourier transform and trim padding.

Parameters
Destdestination buffer
DestWidth,DestHeightdimensions of Dest
PadTemptemporary buffer
PadWidth,PadHeightdimensions of the padded image
Srcthe transformed image
Returns
1 on succes, 0 on failure

Definition at line 198 of file imblur.c.

void GenerateNoise ( num *  Data,
long  NumEl,
noisetype  NoiseType,
num  Sigma 
)

Simulate noise of a specified type and standard deviation.

Parameters
Datathe image data upon which noise is simulated
NumElnumber of elements in Data
NoiseTypetype of noise (Gaussian, Laplace, or Poisson)
Sigmastandard deviation of the noise

Definition at line 325 of file imblur.c.

static num WSymExtension ( const num *  Data,
int  Width,
int  Height,
int  x,
int  y 
)
static

Boundary handling function for whole-sample symmetric extension.

Parameters
Datapointer to a contiguous 2D array in row-major order
Width,Heightsize of the data
x,ysampling location
Returns
extrapolated value

Definition at line 96 of file imblur.c.