Individual pixel modifications

Gray-scale examples

Load gray-scale image

img = ReadImage["cat256x256.ppm"] ; RowBox[{RowBox[{scale,  , =,  , 1.5}], ;}]

Display image

ShowImage[img, scale] ;

[Graphics:../HTMLFiles/index_13.gif]

Define some f : ℛ^1ℛ^1such that i^* = f(i)

f1[v_, exp_] := 255 (v/255)^exp ; f1a[v_] := f1[v, .25] ; f1b[v_] := f1[v, 4] ; f2[v_] := 255  ... v, ,, 1.}], ]}]}], ;}] RowBox[{RowBox[{f3b[v_], :=, RowBox[{f3, [, RowBox[{v, ,, 2.}], ]}]}], ;}]

Plot and apply scalar function (1)

ftst = f1a ;

Plot[ftst[v], {v, 0, 255}, PlotStyle {Red, Thickness[.01]}, AspectRatio1, PlotRangeAll] ;

[Graphics:../HTMLFiles/index_19.gif]

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_21.gif]

Plot and apply scalar function (2)

ftst = f1b ;

Plot[ftst[v], {v, 0, 255}, PlotStyle {Red, Thickness[.01]}, AspectRatio1, PlotRangeAll] ;

[Graphics:../HTMLFiles/index_24.gif]

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_26.gif]

Plot and apply scalar function (3)

ftst = f2 ;

Plot[ftst[v], {v, 0, 255}, PlotStyle {Red, Thickness[.01]}, AspectRatio1, PlotRangeAll] ;

[Graphics:../HTMLFiles/index_29.gif]

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_31.gif]

Plot and apply scalar function (4)

ftst = f3a ;

Plot[ftst[v], {v, 0, 255}, PlotStyle {Red, Thickness[.01]}, AspectRatio1, PlotRangeAll] ;

[Graphics:../HTMLFiles/index_34.gif]

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_36.gif]

Plot and apply scalar function (5)

ftst = f3b ;

Plot[ftst[v], {v, 0, 255}, PlotStyle {Red, Thickness[.01]}, AspectRatio1, PlotRangeAll] ;

[Graphics:../HTMLFiles/index_39.gif]

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_41.gif]

Color examples

Load color image

img = ReadImage["flowers256x256.ppm"] ; RowBox[{RowBox[{scale,  , =,  , 1.5}], ;}]

Display image

ShowImage[img, scale] ;

[Graphics:../HTMLFiles/index_44.gif]

Define some f : ℛ^3ℛ^3such that (r^*, g^*, b^*) = f(r, g, b)

Single-channel functions

f1[v_, exp_] := 255 (v/255)^exp ; f1a[v_] := f1[v, .25] ; f1b[v_] := f1[v, 4] ; f2[v_] := 255  ... v, ,, 1.}], ]}]}], ;}] RowBox[{RowBox[{f3b[v_], :=, RowBox[{f3, [, RowBox[{v, ,, 2.}], ]}]}], ;}]

Color functions

g1a[v_] := f1a/@ v ; g1b[v_] := f1b/@v ; g2[v_] := f2 /@ v ; g3[v_] := f3a /@ v ;

Apply  function (1)

ftst = g1a ;

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_51.gif]

Apply  function (2)

ftst = g1b ;

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_54.gif]

Apply  function (3)

ftst = g2 ;

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_57.gif]

Apply  function (4)

ftst = g3 ;

tmp = PixelModification[img, ftst] ; ShowImage[tmp, scale] ;

[Graphics:../HTMLFiles/index_60.gif]


Created by Mathematica  (February 5, 2004)