- 3D Imaging: To create images for 3D glasses two images are used.
One image is taken from a slightly different vantage point to simulate the
space between a set of eyes. One image is then tinted red and the other blue.
The two images are then blended into one. When you view the image through
3d glasses the eye looking through the red filter will only see the blue picture
and vice versa. The brain then interprets this as a 3 dimensional image.
Sample Code:
for(x=0,x<imageWidth,x++){
for(y=0,y<imageHeight,y++){
c1=GetPixel(SourceImageLeft,x,y)
c2=GetPixel(SourceImageRight,x,y)
c=RGB((c1.Red+c1.Green+c1.Blue)/3,0,(c2.Red+c2.Green+c2.Blue)/3)
SetPixel(DestinationImage,x,y,c)
}
}
- Stareo Effect: A stareo effect is created by varying the repetition
of objects within a picture horizontally. The brain matches (overlaps) these
repetitions and the space between repetitions becomes the distance or 3rd dimension.
Sample Code:
for(x=0,x<imageWidth,x++){
for(y=0,y<imageHeight,y++){
z=GetDepth(x,y)
SetPixel(image,x,y,GetPixel(image,x+z,y))
}
}
GetDepth is some function to return the depth of the picture at point x,y.
Usually another picture is used to provide these depths (color intensity = depth).
- Mosiac: In a Mosaic you start with one picture
which is represented by a compilation of many other pictures (or tiles etc.)
These pictures are arranged so that the average color of one small picture
is equal to the color of a pixel in the original picture. Since finding a
picture with a particular average color would be very time consuming we cheat
by tinting the picture to that color.
Sample Code:
for(x=0,x<imageWidth,x++){
for(y=0,y<imageHeight,y++){
DrawTintedPicture(DestinationImage,x*scalingFactor,y*scalingFactor,GetPixel(image,x,y))
}
}
scalingFactor is some constant for increasing the size of the original picture.
DrawTintedPicture(image,x,y,c) is some function to draw the image centered at x,y tinted
the color c.
- Image Enhancement: Image enhancement is performed by filling in the spaces
between pixels. It is implemented by averaging the surrounding pixel colors.