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.
|  | 
| #define | MIN(a, b)   (((a) <= (b)) ? (a) : (b)) | 
|  | 
| #define | _CONCAT(A, B)   A ## B | 
|  | 
| #define | FFT(S)   _CONCAT(fftw_,S) | 
|  | 
|  | 
| enum | noisetype { NOISE_GAUSSIAN, 
NOISE_LAPLACE, 
NOISE_POISSON
 } | 
|  | 
|  | 
| 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... 
 | 
|  | 
| numcomplex * | ComputePaddedDFT (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. 
 | 
|  | 
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.
      
        
          | int BlurImage | ( | num * | Image, | 
        
          |  |  | int | ImageWidth, | 
        
          |  |  | int | ImageHeight, | 
        
          |  |  | int | NumChannels, | 
        
          |  |  | const num * | Kernel, | 
        
          |  |  | int | KernelWidth, | 
        
          |  |  | int | KernelHeight | 
        
          |  | ) |  |  | 
      
 
Convolve an image with a kernel. 
- Parameters
- 
  
    | Image | the image data in row-major planar order |  | ImageWidth,ImageHeight,NumChannels | the image dimensions |  | Kernel | the convolution kernel |  | KernelWidth,KernelHeight | the 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
- 
  
    | PadTemp | temporary buffer |  | PadWidth,PadHeight | dimensions of the padded image |  | Src | the source image |  | SrcWidth,SrcHeight | dimensions of Src |  | IsKernelFlag | nonzero 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
- 
  
    | Dest | destination buffer |  | DestWidth,DestHeight | dimensions of Dest |  | PadTemp | temporary buffer |  | PadWidth,PadHeight | dimensions of the padded image |  | Src | the 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
- 
  
    | Data | the image data upon which noise is simulated |  | NumEl | number of elements in Data |  | NoiseType | type of noise (Gaussian, Laplace, or Poisson) |  | Sigma | standard 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
- 
  
    | Data | pointer to a contiguous 2D array in row-major order |  | Width,Height | size of the data |  | x,y | sampling location |  
 
- Returns
- extrapolated value 
Definition at line 96 of file imblur.c.