C481 B581 Computer Graphics
Dana Vrajitoru
Image Manipulation
Color Manipulation
Generally, a loop like this
for (x=0; x < width; ++x)
  for (y=0; y < height; ++y)
    color[y][x]=Change(color[y][x]);

The change can be

Color Inverting - Negative
Color inversion

Change(r,g,b)=(max-r,max-g,max-b);
where max is the maximum value in the range (1 or 255 or 65535).
This is locally defined.

Curves
Value change (based on HSV):

(h,s,v)=HSV(r,g,b);
v1 = -0.879 v2 + 1.879 v;
Change(r,g,b)=RGB(h,s,v1);
If the user changes 2 points, we need an equation of 3rd degree for v1
This can also apply to one particular channel (r, g, b) .
It is also locally defined.

Contrast
Based on making the light colors lighter and dark colors darker.
Can be locally defined.
Some operations like Auto Contrast in PhotoShop take into consideration the global distribution of gray levels in the image.

Linear Contrast

if (v<0.375)
  v1 = v/3;
else if (v<0.625)
  v1 = 3v-1;
else 
  v1 = v/3+2/3;
The formula can be generalized to depend on a parameter.

Image Histogram
A graph of the number of occurrences of each value in the image.
If the values are discretized between 0 and 255 (levels of gray), then we can plot
Pv=nv/n, for 0 < v < 255 where nv is the number of pixels having the value equal to v and n is the total number of pixels (width * height).

Histogram Transformations

Auto contrast. Finding an optimum curve for the contrast such that there is a balance between the low and high value levels.

Histogram equalization. Applying a transformation to the colors such that all the levels in the histogram look equal.

Color balancing. Transforming the color such that there is a balance between the R, G, B levels.

Filters
Neighborhood processing.
It applies a transformation to the pixel based on the values of the pixels in a given radius around the point.
Let M be a matrix of (2r+1) x (2r+1), where r is the radius of the transformation neighborhood and (px,y) the image. Then

Examples

Smoothing

Sharpening

Edge-detecting (negative values become 0).

Emboss