Image Interpolation with Contour Stencils
Defines | Functions

fitsten.c File Reference

Select the best-fitting contour stencils. More...

#include <stdlib.h>
#include "fitsten.h"
Include dependency graph for fitsten.c:

Go to the source code of this file.

Defines

#define PIXEL_STRIDE   3
#define W_MU   (1.060660171779821)
#define W_PI_2   (6.0)
#define W_PI_4   (5.656854249492381)
#define W_PI_8   (23.086554390135440)

Functions

int FitStencils (int *Stencil, int32_t *Image, int Width, int Height, int StencilMul)
 Select the best-fitting contour stencils.

Detailed Description

Select the best-fitting contour stencils.

Author:
Pascal Getreuer <getreuer@gmail.com>

Copyright (c) 2010-2011, 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 fitsten.c.


Define Documentation

#define PIXEL_STRIDE   3

Definition at line 20 of file fitsten.c.

#define W_MU   (1.060660171779821)

Definition at line 24 of file fitsten.c.

#define W_PI_2   (6.0)

Definition at line 26 of file fitsten.c.

#define W_PI_4   (5.656854249492381)

Definition at line 28 of file fitsten.c.

#define W_PI_8   (23.086554390135440)

Definition at line 30 of file fitsten.c.


Function Documentation

int FitStencils ( int *  Stencil,
int32_t *  Image,
int  Width,
int  Height,
int  StencilMul 
)

Select the best-fitting contour stencils.

Parameters:
Stencilpointer to array of size Width by Height to be filled with the best-fitting stencil for each pixels
Imagethe input RGB image
Width,Heightimage dimensions
StencilMulmultiply the stencil index by this factor

FitStencils finds the best-fitting stencil at each pixel of the input image

\[ \mathcal{S}^\star(k) = \arg\min_{\mathcal{S}\in\Sigma} \tfrac{1}{|\mathcal{S}|} (\mathcal{S} \star [v])(k) \]

to estimate the local contour orientation. The result Stencil is a two-dimensional array with the index (0, 1, ..., or 7) of the best-fitting stencil for each pixel. The stencil TV estimates $(\mathcal{S} \star [v])(k)$ are filtered by [1,2,1; 2,4,2; 1,2,1]/16 to improve reliability.

For efficiency in CWFirstPass and CWCorrectionPass, the stencil indices are multiplied by StencilMul (so that the index may be used directly as an offset into the samples table).

Definition at line 70 of file fitsten.c.

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines