Automatic Color Enhancement
|
ACE automatic color enhancement. More...
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <fftw3.h>
Go to the source code of this file.
Functions | |
int | ace_enhance_image_interp (float *u, const float *f, int width, int height, float alpha, const char *omega_string, int num_levels) |
ACE automatic color enhancement using level interpolation. More... | |
int | ace_enhance_image_poly (float *u, const float *f, int width, int height, float alpha, const char *omega_string, int degree) |
ACE automatic color enhancement using a polynomial slope function. More... | |
static int | compute_omega_trans (float *omega_trans, float *omega, int width, int height, const char *omega_string) |
Compute the FFT of omega(x,y) More... | |
static void | get_min_max (float *min_ptr, float *max_ptr, const float *data, size_t num_samples) |
Find the min and max value of an array. More... | |
static void | int_pow (float *dest, const float *src, size_t num_samples, int m) |
Evaluate integer power, hardcoded for degrees 1 to 11. More... | |
static void | stretch (float *image, long num_pixels) |
Stetch image to [0,1]. More... | |
static void | convolve (float *blurred_trans, const float *omega_trans, long num_pixels, fftwf_plan forward_plan, fftwf_plan inverse_plan) |
FFT-based convolution. | |
static int | alloc_buffers_and_plans (float ***buffers_ptr, fftwf_plan(**plans_ptr)[2], int width, int height, int num_buffers) |
Allocate buffers and FFTW plans for DCT transforms. | |
static void | free_buffers_and_plans (float **buffers, fftwf_plan(*plans)[2], int num_buffers) |
Free resources allocated by alloc_buffers_and_plans() | |
static double | binom_coeff (int m, int n) |
Compute binomial coefficient for small m and n. More... | |
static double | factorial (int n) |
Compute small factorial. More... | |
ACE automatic color enhancement.
Copyright (c) 2012, Pascal Getreuer All rights reserved.
This program is free software: you can redistribute it and/or modify it under, at your option, the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version, or the terms of the simplified BSD license.
You should have received a copy of these licenses along with this program. If not, see http://www.gnu.org/licenses/ and http://www.opensource.org/licenses/bsd-license.html.
Definition in file ace.c.
int ace_enhance_image_interp | ( | float * | u, |
const float * | f, | ||
int | width, | ||
int | height, | ||
float | alpha, | ||
const char * | omega_string, | ||
int | num_levels | ||
) |
ACE automatic color enhancement using level interpolation.
u | the enhanced output image |
f | the input image in planar row-major order |
width,height | image dimensions |
alpha | the slope parameter (>=1), larger implies stronger enhancement |
omega_string | string specifying the spatial weighting function |
num_levels | number of interpolation levels (>=2) |
This routine perform ACE enhancement by computing
for fixed levels L. The are then piecewise linearly interpolated to approximate R. The parameter num_levels
determines the number of L values used. Increasing num_levels
improves quality but increases computation time.
If non-null, parameter omega_string
specifies the spatial weighting function . Valid choices are
If OpenMP is enabled, the main computation loop is parallelized.
int ace_enhance_image_poly | ( | float * | u, |
const float * | f, | ||
int | width, | ||
int | height, | ||
float | alpha, | ||
const char * | omega_string, | ||
int | degree | ||
) |
ACE automatic color enhancement using a polynomial slope function.
u | the enhanced output image |
f | the input image in planar row-major order |
width,height | image dimensions |
alpha | the slope parameter (>=1), larger implies stronger enhancement |
omega_string | string specifying the spatial weighting function |
degree | polynomial degree (can be 3, 5, 7, 9, or 11) |
This routine perform ACE enhancement using the fast O(N log N) algorithm of Bertalmio et al. The slope parameter must be an integer or half-integer between 1 and 8 (1, 1.5, 2, 2.5, ..., 7.5, 8). The slope function is approximated by an -optimal polynomial of degree degree
.
If non-null, parameter omega_string
specifies the spatial weighting function . Valid choices are
If OpenMP is enabled, the main computation loop is parallelized.
note: In the parallel computation, values are summed in a nondeterministic order (i.e., in whichever order threads complete). Due to rounding effects, addition is not exactly associative and the output varies slightly between runs (+/- 1 intensity level).
|
static |
Compute binomial coefficient for small m and n.
m,n | binomial arguments |
Uses factorial() to compute the binomial coefficient
|
static |
|
static |
|
static |
|
static |