MagickCore  7.0.2
enhance.c File Reference
Include dependency graph for enhance.c:

Go to the source code of this file.

Macros

#define BrightnessContastImageTag   "BrightnessContast/Image"
 
#define ClutImageTag   "Clut/Image"
 
#define ColorDecisionListCorrectImageTag   "ColorDecisionList/Image"
 
#define ContrastImageTag   "Contrast/Image"
 
#define MaxRange(color)   ((double) ScaleQuantumToMap((Quantum) (color)))
 
#define ContrastStretchImageTag   "ContrastStretch/Image"
 
#define EnhanceImageTag   "Enhance/Image"
 
#define EnhancePixel(weight)
 
#define EqualizeImageTag   "Equalize/Image"
 
#define GammaCorrectImageTag   "GammaCorrect/Image"
 
#define GrayscaleImageTag   "Grayscale/Image"
 
#define HaldClutImageTag   "Clut/Image"
 
#define LevelImageTag   "Level/Image"
 
#define LevelizeImageTag   "Levelize/Image"
 
#define LevelizeValue(x)
 
#define LinearStretchImageTag   "LinearStretch/Image"
 
#define ModulateImageTag   "Modulate/Image"
 
#define NegateImageTag   "Negate/Image"
 
#define Sigmoidal(a, b, x)   ( 1.0/(1.0+exp((a)*((b)-(x)))) )
 
#define ScaledSigmoidal(a, b, x)
 
#define SigmoidalContrastImageTag   "SigmoidalContrast/Image"
 
#define ScaledSig(x)
 
#define InverseScaledSig(x)
 

Functions

MagickExport MagickBooleanType AutoGammaImage (Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType AutoLevelImage (Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType BrightnessContrastImage (Image *image, const double brightness, const double contrast, ExceptionInfo *exception)
 
MagickExport MagickBooleanType ClutImage (Image *image, const Image *clut_image, const PixelInterpolateMethod method, ExceptionInfo *exception)
 
MagickExport MagickBooleanType ColorDecisionListImage (Image *image, const char *color_correction_collection, ExceptionInfo *exception)
 
static void Contrast (const int sign, double *red, double *green, double *blue)
 
MagickExport MagickBooleanType ContrastImage (Image *image, const MagickBooleanType sharpen, ExceptionInfo *exception)
 
MagickExport MagickBooleanType ContrastStretchImage (Image *image, const double black_point, const double white_point, ExceptionInfo *exception)
 
MagickExport ImageEnhanceImage (const Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType EqualizeImage (Image *image, ExceptionInfo *exception)
 
static double gamma_pow (const double value, const double gamma)
 
MagickExport MagickBooleanType GammaImage (Image *image, const double gamma, ExceptionInfo *exception)
 
MagickExport MagickBooleanType GrayscaleImage (Image *image, const PixelIntensityMethod method, ExceptionInfo *exception)
 
MagickExport MagickBooleanType HaldClutImage (Image *image, const Image *hald_image, ExceptionInfo *exception)
 
static double LevelPixel (const double black_point, const double white_point, const double gamma, const double pixel)
 
MagickExport MagickBooleanType LevelImage (Image *image, const double black_point, const double white_point, const double gamma, ExceptionInfo *exception)
 
MagickExport MagickBooleanType LevelizeImage (Image *image, const double black_point, const double white_point, const double gamma, ExceptionInfo *exception)
 
MagickExport MagickBooleanType LevelImageColors (Image *image, const PixelInfo *black_color, const PixelInfo *white_color, const MagickBooleanType invert, ExceptionInfo *exception)
 
MagickExport MagickBooleanType LinearStretchImage (Image *image, const double black_point, const double white_point, ExceptionInfo *exception)
 
static void ModulateHCL (const double percent_hue, const double percent_chroma, const double percent_luma, double *red, double *green, double *blue)
 
static void ModulateHCLp (const double percent_hue, const double percent_chroma, const double percent_luma, double *red, double *green, double *blue)
 
static void ModulateHSB (const double percent_hue, const double percent_saturation, const double percent_brightness, double *red, double *green, double *blue)
 
static void ModulateHSI (const double percent_hue, const double percent_saturation, const double percent_intensity, double *red, double *green, double *blue)
 
static void ModulateHSL (const double percent_hue, const double percent_saturation, const double percent_lightness, double *red, double *green, double *blue)
 
static void ModulateHSV (const double percent_hue, const double percent_saturation, const double percent_value, double *red, double *green, double *blue)
 
static void ModulateHWB (const double percent_hue, const double percent_whiteness, const double percent_blackness, double *red, double *green, double *blue)
 
static void ModulateLCHab (const double percent_luma, const double percent_chroma, const double percent_hue, double *red, double *green, double *blue)
 
static void ModulateLCHuv (const double percent_luma, const double percent_chroma, const double percent_hue, double *red, double *green, double *blue)
 
MagickExport MagickBooleanType ModulateImage (Image *image, const char *modulate, ExceptionInfo *exception)
 
MagickExport MagickBooleanType NegateImage (Image *image, const MagickBooleanType grayscale, ExceptionInfo *exception)
 
MagickExport MagickBooleanType NormalizeImage (Image *image, ExceptionInfo *exception)
 
static double InverseScaledSigmoidal (const double a, const double b, const double x)
 
MagickExport MagickBooleanType SigmoidalContrastImage (Image *image, const MagickBooleanType sharpen, const double contrast, const double midpoint, ExceptionInfo *exception)
 

Macro Definition Documentation

#define BrightnessContastImageTag   "BrightnessContast/Image"
#define ClutImageTag   "Clut/Image"

Referenced by ClutImage().

#define ColorDecisionListCorrectImageTag   "ColorDecisionList/Image"

Referenced by ColorDecisionListImage().

#define ContrastImageTag   "Contrast/Image"

Referenced by ContrastImage().

#define ContrastStretchImageTag   "ContrastStretch/Image"

Referenced by ContrastStretchImage().

#define EnhanceImageTag   "Enhance/Image"

Referenced by EnhanceImage().

#define EnhancePixel (   weight)
Value:
mean=QuantumScale*((double) GetPixelRed(image,r)+pixel.red)/2.0; \
distance=QuantumScale*((double) GetPixelRed(image,r)-pixel.red); \
distance_squared=(4.0+mean)*distance*distance; \
mean=QuantumScale*((double) GetPixelGreen(image,r)+pixel.green)/2.0; \
distance=QuantumScale*((double) GetPixelGreen(image,r)-pixel.green); \
distance_squared+=(7.0-mean)*distance*distance; \
mean=QuantumScale*((double) GetPixelBlue(image,r)+pixel.blue)/2.0; \
distance=QuantumScale*((double) GetPixelBlue(image,r)-pixel.blue); \
distance_squared+=(5.0-mean)*distance*distance; \
mean=QuantumScale*((double) GetPixelBlack(image,r)+pixel.black)/2.0; \
distance=QuantumScale*((double) GetPixelBlack(image,r)-pixel.black); \
distance_squared+=(5.0-mean)*distance*distance; \
mean=QuantumScale*((double) GetPixelAlpha(image,r)+pixel.alpha)/2.0; \
distance=QuantumScale*((double) GetPixelAlpha(image,r)-pixel.alpha); \
distance_squared+=(5.0-mean)*distance*distance; \
if (distance_squared < 0.069) \
{ \
aggregate.red+=(weight)*GetPixelRed(image,r); \
aggregate.green+=(weight)*GetPixelGreen(image,r); \
aggregate.blue+=(weight)*GetPixelBlue(image,r); \
aggregate.black+=(weight)*GetPixelBlack(image,r); \
aggregate.alpha+=(weight)*GetPixelAlpha(image,r); \
total_weight+=(weight); \
} \
r+=GetPixelChannels(image);
static Quantum GetPixelAlpha(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
static Quantum GetPixelRed(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
static Quantum GetPixelGreen(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
static Quantum GetPixelBlack(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
#define QuantumScale
Definition: magick-type.h:103
static size_t GetPixelChannels(const Image *magick_restrict image)
static Quantum GetPixelBlue(const Image *magick_restrict image, const Quantum *magick_restrict pixel)

Referenced by EnhanceImage().

#define EqualizeImageTag   "Equalize/Image"

Referenced by EqualizeImage().

#define GammaCorrectImageTag   "GammaCorrect/Image"

Referenced by GammaImage().

#define GrayscaleImageTag   "Grayscale/Image"

Referenced by GrayscaleImage().

#define HaldClutImageTag   "Clut/Image"

Referenced by HaldClutImage().

#define InverseScaledSig (   x)
Value:
#define QuantumScale
Definition: magick-type.h:103
static Quantum ClampToQuantum(const MagickRealType value)
Definition: quantum.h:84
static double InverseScaledSigmoidal(const double a, const double b, const double x)
Definition: enhance.c:3734
#define QuantumRange
Definition: magick-type.h:71

Referenced by SigmoidalContrastImage().

#define LevelImageTag   "Level/Image"

Referenced by LevelImage().

#define LevelizeImageTag   "Levelize/Image"

Referenced by LevelizeImage().

#define LevelizeValue (   x)
Value:
(QuantumScale*(x)),gamma))*(white_point-black_point)+black_point)
float_t MagickRealType
Definition: magick-type.h:63
static double gamma_pow(const double value, const double gamma)
Definition: enhance.c:1777
#define QuantumScale
Definition: magick-type.h:103
static Quantum ClampToQuantum(const MagickRealType value)
Definition: quantum.h:84

Referenced by LevelizeImage().

#define LinearStretchImageTag   "LinearStretch/Image"
#define MaxRange (   color)    ((double) ScaleQuantumToMap((Quantum) (color)))

Referenced by ContrastStretchImage().

#define ModulateImageTag   "Modulate/Image"

Referenced by ModulateImage().

#define NegateImageTag   "Negate/Image"

Referenced by NegateImage().

#define ScaledSig (   x)
Value:
ScaledSigmoidal(contrast,QuantumScale*midpoint,QuantumScale*(x))) )
#define QuantumScale
Definition: magick-type.h:103
static Quantum ClampToQuantum(const MagickRealType value)
Definition: quantum.h:84
#define QuantumRange
Definition: magick-type.h:71
#define ScaledSigmoidal(a, b, x)
Definition: enhance.c:3722

Referenced by SigmoidalContrastImage().

#define ScaledSigmoidal (   a,
  b,
 
)
Value:
( \
(Sigmoidal((a),(b),(x))-Sigmoidal((a),(b),0.0)) / \
(Sigmoidal((a),(b),1.0)-Sigmoidal((a),(b),0.0)) )
#define Sigmoidal(a, b, x)
Definition: enhance.c:3703

Definition at line 3722 of file enhance.c.

#define Sigmoidal (   a,
  b,
 
)    ( 1.0/(1.0+exp((a)*((b)-(x)))) )

Definition at line 3703 of file enhance.c.

Referenced by InverseScaledSigmoidal().

#define SigmoidalContrastImageTag   "SigmoidalContrast/Image"

Referenced by SigmoidalContrastImage().

Function Documentation

MagickExport MagickBooleanType AutoLevelImage ( Image image,
ExceptionInfo exception 
)

Definition at line 184 of file enhance.c.

References MinMaxStretchImage().

Referenced by AdaptiveBlurImage(), and AdaptiveSharpenImage().

MagickExport MagickBooleanType BrightnessContrastImage ( Image image,
const double  brightness,
const double  contrast,
ExceptionInfo exception 
)
static void Contrast ( const int  sign,
double *  red,
double *  green,
double *  blue 
)
static

Definition at line 838 of file enhance.c.

References ConvertHSBToRGB(), ConvertRGBToHSB(), and MagickPI.

Referenced by ContrastImage().

static double gamma_pow ( const double  value,
const double  gamma 
)
inlinestatic

Definition at line 1777 of file enhance.c.

Referenced by GammaImage(), and LevelPixel().

static double InverseScaledSigmoidal ( const double  a,
const double  b,
const double  x 
)
inlinestatic

Definition at line 3734 of file enhance.c.

References MagickEpsilon, and Sigmoidal.

static double LevelPixel ( const double  black_point,
const double  white_point,
const double  gamma,
const double  pixel 
)
inlinestatic

Definition at line 2369 of file enhance.c.

References gamma_pow(), and QuantumRange.

Referenced by LevelImage().

static void ModulateHCL ( const double  percent_hue,
const double  percent_chroma,
const double  percent_luma,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 2935 of file enhance.c.

References ConvertHCLToRGB(), and ConvertRGBToHCL().

Referenced by ModulateImage().

static void ModulateHCLp ( const double  percent_hue,
const double  percent_chroma,
const double  percent_luma,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 2958 of file enhance.c.

References ConvertHCLpToRGB(), and ConvertRGBToHCLp().

Referenced by ModulateImage().

static void ModulateHSB ( const double  percent_hue,
const double  percent_saturation,
const double  percent_brightness,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 2981 of file enhance.c.

References ConvertHSBToRGB(), and ConvertRGBToHSB().

Referenced by ModulateImage().

static void ModulateHSI ( const double  percent_hue,
const double  percent_saturation,
const double  percent_intensity,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3004 of file enhance.c.

References ConvertHSIToRGB(), and ConvertRGBToHSI().

Referenced by ModulateImage().

static void ModulateHSL ( const double  percent_hue,
const double  percent_saturation,
const double  percent_lightness,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3027 of file enhance.c.

References ConvertHSLToRGB(), and ConvertRGBToHSL().

Referenced by ModulateImage().

static void ModulateHSV ( const double  percent_hue,
const double  percent_saturation,
const double  percent_value,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3050 of file enhance.c.

References ConvertHSVToRGB(), and ConvertRGBToHSV().

Referenced by ModulateImage().

static void ModulateHWB ( const double  percent_hue,
const double  percent_whiteness,
const double  percent_blackness,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3073 of file enhance.c.

References ConvertHWBToRGB(), and ConvertRGBToHWB().

Referenced by ModulateImage().

static void ModulateLCHab ( const double  percent_luma,
const double  percent_chroma,
const double  percent_hue,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3096 of file enhance.c.

References ConvertLCHabToRGB(), and ConvertRGBToLCHab().

Referenced by ModulateImage().

static void ModulateLCHuv ( const double  percent_luma,
const double  percent_chroma,
const double  percent_hue,
double *  red,
double *  green,
double *  blue 
)
inlinestatic

Definition at line 3119 of file enhance.c.

References ConvertLCHuvToRGB(), and ConvertRGBToLCHuv().

Referenced by ModulateImage().

MagickExport MagickBooleanType NormalizeImage ( Image image,
ExceptionInfo exception 
)