23MCI1E1-Multimedia Unit 2
23MCI1E1-Multimedia Unit 2
Images:
An image consists of a rectangular array of dots called pixels.
The size of the image is specified in terms of width X height, in numbers of the
pixels.
The physical size of the image, in inches or centimeters, depends on the
resolution of the device on which the image is displayed.
The resolution is usually measured in DPI (Dots Per Inch). An image will appear
smaller on a device with a higher resolution than on one with a lower resolution.
For color images, one needs enough bits per pixel to represent all the colors in
the image. The number of the bits per pixel is called the depth of the image.
Image Data Types
Images can be created by using different techniques of representation of data called
data type like monochrome and colored images.
Monochrome image is created by using single color whereas colored image is
created by using multiple colors. Some important data types of images are following:
1-bit images
An image is a set of pixels. Note that a pixel is a picture element in digital image. In
1-bit images, each pixel is stored as a single bit (0 or 1). A bit has only two states either on
or off, white or black, true or false. Therefore, such an image is also referred to as a binary
image, since only two states are available. 1-bit image is also known as 1-bit monochrome
images because it contains one color that is black for off state and white for on state.
A 1-bit image with resolution 640*480 needs a storage space of 640*480 bits.
640 x 480 bits. = (640 x 480) / 8 bytes = (640 x 480) / (8 x 1024) KB= 37.5KB.
The clarity or quality of 1-bit image is very low.
8-bit Gray Level Images
Each pixel of 8-bit gray level image is represented by a single byte (8 bits).
Therefore each pixel of such image can hold 2 8=256 values between 0 and 255. Therefore
each pixel has a brightness value on a scale from black (0 for no brightness or intensity) to
white (255 for full brightness or intensity). For example, a dark pixel might have a value of
15 and a bright one might be 240.
A grayscale digital image is an image in which the value of each pixel is a single
sample, which carries intensity information. Images are composed exclusively of gray
shades, which vary from black being at the weakest intensity to white being at the
strongest. Grayscale images carry many shades of gray from black to white. Grayscale
images are also called monochromatic, denoting the presence of only one (mono) color
(chrome). An image is represented by bitmap. A bitmap is a simple matrix of the tiny dots
(pixels) that form an image and are displayed on a computer screen or printed.
A 8-bit image with resolution 640 x 480 needs a storage space of 640 x 480 bytes=(640
x 480)/1024 KB= 300KB. Therefore an 8-bit image needs 8 times more storage space than
1-bit image.
24-bit Color Images
In 24-bit color image, each pixel is represented by three bytes, usually representing
RGB (Red, Green and Blue). Usually true color is defined to mean 256 shades of RGB
(Red, Green and Blue) for a total of 16777216 color variations. It provides a method of
representing and storing graphical image information an RGB color space such that a
colors, shades and hues in large number of variations can be displayed in an image such as
in high quality photo graphic images or complex graphics.
Many 24-bit color images are stored as 32-bit images, and an extra byte for each pixel
used to store an alpha value representing special effect information.
A 24-bit color image with resolution 640 x 480 needs a storage space of 640 x 480 x 3
bytes = (640 x 480 x 3) / 1024=900KB without any compression. Also 32-bit color image
with resolution 640 x 480 needs a storage space of 640 x 480 x 4 bytes= 1200KB without
any compression.
Disadvantages
Require large storage space
Many monitors can display only 256 different colors at any one time. Therefore, in
this case it is wasteful to store more than 256 different colors in an image.
8-bit Color Images
8-bit color graphics is a method of storing image information in a computer's memory
or in an image file, where one byte (8 bits) represents each pixel. The maximum number of
colors that can be displayed at once is 256. 8-bit color graphics are of two forms. The first
form is where the image stores not color but an 8-bit index into the color map for each
pixel, instead of storing the full 24-bit color value. Therefore, 8-bit image formats consists
of two parts: a color map describing what colors are present in the image and the array of
index values for each pixel in the image. In most color maps each color is usually chosen
from a palette of 16,777,216 colors (24 bits: 8 red, 8green, 8 blue).
The other form is where the 8-bits use 3 bits for red, 3 bits for green and 2 bits for
blue. This second form is often called 8-bit true color as it does not use a palette at
all. When a 24-bit full color image is turned into an 8-bit image, some of the colors
have to be eliminated, known as color quantization process.
A 8-bit color image with resolution 640 x 480 needs a storage space of 640 x 480
bytes=(640 x 480) / 1024KB= 300KB without any compression.
Color Lookup Tables
A color loop-up table (LUT) is a mechanism used to transform a range of input
colors into another range of colors. Color look-up table will convert the logical color
numbers stored in each pixel of video memory into physical colors, represented as RGB
triplets, which can be displayed on a computer monitor. Each pixel of image stores only
index value or logical color number. For example if a pixel stores the value 30, the meaning
is to go to row 30 in a color look-up table (LUT). The LUT is often called a Palette.
Characteristic of LUT are following:
The number of entries in the palette determines the maximum number of colors
which can appear on screen simultaneously.
The width of each entry in the palette determines the number of colors which the
wider full palette can represent.
A common example would be a palette of 256 colors that is the number of entries is 256
and thus each entry is addressed by an 8-bit pixel value. Each color can be chosen from a
full palette, with a total of 16.7 million colors that is the each entry is of 24 bits and 8 bits
per channel which sets the total combinations of 256 levels for each of the red, green and
blue components 256 x 256 x 256 =16,777,216 colors.
RGB: The RGB colour model is the most common colour model used in Digital image
processing and openCV. The colour image consists of 3 channels. One channel each for
one colour. Red, Green and Blue are the main colour components of this model. All
other colours are produced by the proportional ratio of these three colours only. 0
represents the black and as the value increases the colour intensity increases.
Properties:
This is an additive colour model. The colours are added to the black.
3 main channels: Red, Green and Blue.
Used in DIP, openCV and online logos.
Colour combination:
Green(255) + Red(255) = Yellow
Green(255) + Blue(255) = Cyan
Red(255) + Blue(255) = Magenta
Red(255) + Green(255) + Blue(255) = White
CMYK: CMYK colour model is widely used in printers. It stands for Cyan, Magenta,
Yellow and Black (key). It is a subtractive colour model. 0 represents the primary
colour and 1 represents the lightest colour. In this model, point (1, 1, 1) represents
black, and (0,0,0) represents white. It is a subtractive model thus the value is subtracted
from 1 to vary from least intense to a most intense colour value.
1-RGB = CMY
Cyan is negative of Red.
Magenta is negative of Green.
Yellow is negative of Blue.
HSV: The image consists of three channels. Hue, Saturation and Value are three
channels. This colour model does not use primary colours directly. It uses colour in the
way humans perceive them. HSV colour when is represented by a cone.
o Hue is a colour component. Since the cone represents the HSV model, the hue
represents different colours in different angle ranges.
HSV model is used in histogram equalization and converting grayscale images to RGB
colour images.
YIQ: YIQ is the most widely colour model used in Television broadcasting. Y stands
for luminance part and IQ stands for chrominance part. In the black and white
television, only the luminance part (Y) was broadcast. The y value is similar to the
grayscale part. The colour information is represented by the IQ part.
There exist a formula to convert RGB into YIQ and vice-versa.
YIQ model is used in the conversion of grayscale images to RGB colour images.
Colour Palette
A colour palette, in the digital world, refers to the full range of colours that can be
displayed on a device screen or other interface, or in some cases, a collection of colours and
tools for use in paint and illustration programs.
In the traditional RYB colour wheel, the primary colours are red, yellow, and blue.
You can create secondary colours—orange, green, and purple—by mixing primary colours.
Red and yellow create orange. Yellow and blue create green. The colour palette
explains a lot about the design of the device or technology. It can also tell the visual
capabilities for human users.
The palette's in earlier days used hexadecimal values to represent and select the
variety of colours present in the system.
Modern colour palettes are likely to show a colour wheel or a sophisticated tab,
with a variety of colours for users to choose from.
Monochromatic Colour Palette: For keeping things straight and simple, you should go for
a monochromatic palette as it provides the same hue in different shades and tones. It is best
to choose this palette when working with a corporate colour that doesn't need a lot of mix-
ups.
They are impossible to mess up because they're literally the same colour with
different shades, so the chances of messing up are minimal.
Monochromatic Colour Palette
Complementary Colour Palette: It consists of the opposite colours in the colour wheel, so
they are best to use if you want to maintain balance and order. These are very bright and
help to grab the eyes of the viewers. Companies use this palette mainly for logo or
packaging purposes as it's very catchy.
Colour dithering
The basic idea behind dithering is to use a pattern of dots of different colours to
simulate the appearance of a third colour.
For example, to create a shade of green using only black and white pixels, a
dithering algorithm might alternate between black and white pixels to create the impression
of a green hue.
3. Random Dithering: Random dithering involves adding random noise to the image
to approximate colours. This technique is less precise than ordered dithering and
error diffusion, but it can be useful for creating a natural or organic appearance in
certain types of images.
Overall, colour dithering is a useful technique for approximating a larger colour palette
using a smaller one. By creating patterns of dots or pixels of different colours, dithering
algorithms can simulate the appearance of a wide range of colours, even when only a
limited set of colours is available.
Color Palettes and Color Flashing
You set your workspace colors through a color palette. The number of colors in the
palette is determined by your display type and the Number of Colors selection.
You are running applications that are designed to use their own colormaps (thus
placing a burden on the frame buffer)
If you have closed all other graphics-intensive applications and your application is still
experiencing color flashing, the following procedure may help eliminate the problem.
2. Click Color.
The Number of Colors To Use dialog box (see Figure 9–3) is displayed.
5. Click Desktop background and choose a simple workspace background such as Gray
Lt.
6. Make this session your home session by following the procedure in To Set a Home
Session.
8. Login to CDE and re-open the application that previously experienced color
flashing.
If the application no longer experiences color flashing, make a note of the current Style
Manager settings; if it is still experiencing color flashing, the application has probably
specified a list of colormaps to be installed, CDE is only installing the first colormap in this
list, so you will need to cycle through the colormaps as explained in the following steps.
9. Use the following special keyboard keys to cycle through the colormaps.