Image Quality Assessment (IQA) 1.1.2
A fast, accurate, and reliable C library for measuring image quality.
Functions
source/convolve.c File Reference
#include "convolve.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

float KBND_SYMMETRIC (const float *img, int w, int h, int x, int y, float bnd_const)
float KBND_REPLICATE (const float *img, int w, int h, int x, int y, float bnd_const)
float KBND_CONSTANT (const float *img, int w, int h, int x, int y, float bnd_const)
static float _calc_scale (const struct _kernel *k)
void _iqa_convolve (float *img, int w, int h, const struct _kernel *k, float *result, int *rw, int *rh)
 Applies the specified kernel to the image. The kernel will be applied to all areas where it fits completely within the image. The resulting image will be smaller by half the kernel width and height (w - kw/2 and h - kh/2).
int _iqa_img_filter (float *img, int w, int h, const struct _kernel *k, float *result)
float _iqa_filter_pixel (const float *img, int w, int h, int x, int y, const struct _kernel *k, const float kscale)

Function Documentation

static float _calc_scale ( const struct _kernel k) [static]

Definition at line 64 of file convolve.c.

void _iqa_convolve ( float *  img,
int  w,
int  h,
const struct _kernel k,
float *  result,
int *  rw,
int *  rh 
)

Applies the specified kernel to the image. The kernel will be applied to all areas where it fits completely within the image. The resulting image will be smaller by half the kernel width and height (w - kw/2 and h - kh/2).

Parameters:
imgImage to modify
wImage width
hImage height
kThe kernel to apply
resultBuffer to hold the resulting image ((w-kw)*(h-kh), where kw and kh are the kernel width and height). If 0, the result will be written to the original image buffer.
rwOptional. The width of the resulting image will be stored here.
rhOptional. The height of the resulting image will be stored here.

Definition at line 81 of file convolve.c.

float _iqa_filter_pixel ( const float *  img,
int  w,
int  h,
int  x,
int  y,
const struct _kernel k,
const float  kscale 
)

Returns the filtered version of the specified pixel. If no kernel is given, the raw pixel value is returned.

Parameters:
imgSource image
wImage width
hImage height
xThe x location of the pixel to filter
yThe y location of the pixel to filter
kOptional. The convolution kernel to apply to the pixel.
kscaleThe scale of the kernel (for normalization). 1 for normalized kernels. Required if 'k' is not null.
Returns:
The filtered pixel value.

Definition at line 157 of file convolve.c.

int _iqa_img_filter ( float *  img,
int  w,
int  h,
const struct _kernel k,
float *  result 
)

The same as _iqa_convolve() except the kernel is applied to the entire image. In other words, the kernel is applied to all areas where the top-left corner of the kernel is in the image. Out-of-bound pixel value (off the right and bottom edges) are chosen based on the 'bnd_opt' and 'bnd_const' members of the kernel structure. The resulting array is the same size as the input image.

Parameters:
imgImage to modify
wImage width
hImage height
kThe kernel to apply
resultBuffer to hold the resulting image ((w-kw)*(h-kh), where kw and kh are the kernel width and height). If 0, the result will be written to the original image buffer.
Returns:
0 if successful. Non-zero otherwise.

Definition at line 120 of file convolve.c.

float KBND_CONSTANT ( const float *  img,
int  w,
int  h,
int  x,
int  y,
float  bnd_const 
)

Out-of-bounds array values are set to 'bnd_const'

Definition at line 55 of file convolve.c.

float KBND_REPLICATE ( const float *  img,
int  w,
int  h,
int  x,
int  y,
float  bnd_const 
)

Out-of-bounds array values are set to the nearest border value

Definition at line 46 of file convolve.c.

float KBND_SYMMETRIC ( const float *  img,
int  w,
int  h,
int  x,
int  y,
float  bnd_const 
)

Out-of-bounds array values are a mirrored reflection of the border values

Definition at line 37 of file convolve.c.

 All Data Structures Files Functions Variables Typedefs Defines


Copyright (c) 2011 by Tom Distler