You are on page 1of 3

GRAPHING AND VISUALIZATION

Color Image Processing

Arithmetic on a matrix provides for a wide variety of image processing techniques. The vectorize operator f ( M) applies a function to an entire image at once. Image coordinates allow more complicated transformations and synthetic constructions. Some of these matrix operations can be conveniently performed via the Picture toolbar instead. D := READRGB "dog") ( cols( D) 3 rdog := submatrixD , 0 , rows( D) 1 , 0 , w 1) ( w := gdog := submatrixD , 0 , rows( D) 1 , w , 2 w 1) ( bdog := submatrixD , 0 , rows( D) 1 , 2 w , 3 w 1) (

rdog , gdog , bdog For example, divide all the blue pixel values by 2:

Yellowish tone emerges, since less blue is now added.

rdog , gdog ,

bdog 2

Switch around red and green:

Fur appears to be green and purple.

gdog , rdog , bdog Apply logarithm function to red component (via vectorize):

log ( rdog) , gdog , bdog Here is another use of the vectorize operator in allowing us to visualize a particular complex matrix. lo := 0 hi := 1 N := 200 . . . size of the matrix . . . range of the region in the complex plane

i := 0 .. N 1 . . . range-variables for matrix j := 0 .. N 1 del := hi lo

step :=

del N1

Ci , j := ( lo + j step) + ( hi i step) i . . . generate the matrix args ( z) := arg ( z) if z > 0 0 otherwise color ( M) := N rows ( M) Args args ( M) R sin ( Args) 255 GN1 , N1 0 B cos ( Args) 255 . . . a safe arg function (returning zero if given a zero rather than aborting)

. . . define colorizing function: red dominates for angles close to 0, blue for angles close to /2 and green is null

R G B
P := color ( C)

P0 , P1 , P2

You might also like