Hue

From Avisynth wiki
Jump to: navigation, search
Abstract
Author Wilbert Dijkhof
Version v1.0
Download Hue_v10.zip
Category Color Adjustment filters
License GPLv2
Discussion Doom9 Forum

Contents

Description

This plugin is a port of Donald Graft's VirtualDub Hue filter.

Requirements


Syntax and Parameters

Hue (clip, float "hue", float "sat", float "intensity", string "channels")


clip   =
Input clip, must be RGB.


float  hue = 0.0
The hue is the color flavor (restricted here to the ones listed in the "channels" parameter).
Example:
# should change pixels with red hue into yellows, but it doesn't
ColorBars(300,200).ConvertToRGB32()
Hue(hue=60, channels="R")

# should rotate all six hue 60 degrees (thus red into yellow, yellow into green, green into cyan,
# cyan into blue, blue into magenta and magenta into red), but it doesn't
ColorBars(300,200).ConvertToRGB32()
Hue(hue=60, channels="RYGCBM")
A pixel is called red if the hue of a pizel is red. It is defined here as follows:
  • Assuming blue is the minimum: around the color wheel we get red, yellow, green. red + green makes yellow. So it is broken up as 1/3, 1/3, 1/3. If g < 2/3 r then the hue of the pixel is red. If r < 2/3 g then the pixel is green. Else it is both, so it is yellow.
  • Assuming green is the minimum: around the color wheel we get red, magenta, blue. red + blue makes magenta. So it is broken up as 1/3, 1/3, 1/3. If b < 2/3 r then the hue of the pixel is red. If r < 2/3 b then the pixel is blue. Else it is both, so it is magenta.
The same holds for the hue of the other colors.


float  sat = 1.0
The saturation (sat) is the dominance of the hue in the color. It should be noted that this is NOT the same as the saturation in the HSV color format. Setting the saturation to zero converts the clip to (R,G,B) = (Y,Y,Y) where Y is the luminance (ie Y = 0.3086*R + 0.6094*G + 0.0820*B) of the clip [*]. Setting it to one leaves the clip untouched. For values inside [0,1] it just performs linear interpolation, and for values outside [0,1] it performs linear extrapolation.
Example:
# decreases the red pixels of the clip to match the luminance
ColorBars(300,200).ConvertToRGB32()
Hue(sat=0, channels="R")

# doesn't do anything
ColorBars(300,200).ConvertToRGB32()
Hue(sat=1, channels="R")

# increases the red pixels of the clip to 255
ColorBars(300,200).ConvertToRGB32()
Hue(sat=1.5, channels="R")


float  intensity = 1.0
The intensity indicates how light or dark a color is. Setting it to zero will decrease the red pixels (if you asked for the red color flavor) to black, and setting it to one will leave the clip untouched. Setting it higher than one will increase the red pixels to white.
[*] Usually the luminance is defined as Y = 0.299*R + 0.587*G + 0.114*B (using Rec.601 coefficients), but according Haeberli the used transformation is better for linear RGB colors.


string  channels = "RYGCBM"
The selectable color flavors: red (R), yellow (Y), green (G), cyan (C), blue (B), magenta (M) and combinations (GCM, etc.).


Examples

Hue with default settings:

AviSource("blah.avi")
Hue(hue=0.0, sat=1.0, intensity=1.0, channels="RYGCBM")


Changelog

Version      Date            Changes
v1.0 2005/01/02 - initial release


Archived Downloads

Version Download Mirror
v1.0 Hue_v10.zip Hue_v10.zip


External Links




Back to External Filters

Personal tools