1.
Introduction to Digital Image
I. Image Formation
1
2
3
Structure of the Human Eye (See Chapter 2, G-W)
4
Brightness Adaptation and Discrimination
5
Image Sensing and Acquisition
a) Single Image Sensor; b) Line Sensor and c) Array Sensor
6
The intensity of a monochrome image at any point P(x,y) is called gray level of the image
at the point P:
ℓ = f(x, y)
The range [Lmin, Lmax], where Lmin ≤ ℓ ≤ Lmax, is called the gray scale.
Some Basic Relationships Between Pixels
Neighbors of a Pixel
Let P is a pixel at coordinate (x, y).
Then, P has two horizontal and two vertical neighbors at
(x+1, y), (x-1, y), (x, y-1), (x, y+1) (1)
The set (1) is called 4-neighbors of P.
The four diagonal neighbors of P:
(x-1, y-1), (x-1, y+1), (x+1, y-1), (x+1, y+1) (2)
The set (2), denoted by N8(P), is called 8-neighbors of P.
7
Pixels
• Let p(x, y) is some (discrete) point in the image, and f(p) is vector value of
point p, eg., f(p) = [R(p), G(p), B(p)] if I is the color image and, f(p) is called
intensity or gray level if I is dark-gray image (image have dark gray-level
distributions)
• The pair (p, f(p)) is called a pixel (stand for picture element). Usually, used
note f(x, y) to sign a pixel, where x, y are spatial coordinates.
8
How to practice and what is more reading?
File of Image (BMP, IPG, PCX, TIF,...,)
A typical BMP file usually contains the following blocks of data:
BMP File Header Stores general information about the BMP file.
Bitmap Information
Stores detailed information about the bitmap image.
(DIB header)
Stores the definition of the colors being used for indexed
Color Palette
color bitmaps.
Bitmap Data Stores the actual image, pixel by pixel.
1. BMP File Header: 14 byte in size
This block of bytes is at the start of the file and is used to identify the file.
start size name stdvalue Purpose
must always be set to 'BM' to declare that
1 2 bfType 19778
this is a .bmp-file.
3 4 bfSize ?? specifies the size of the file in bytes.
7 2 bfReserved1 0 must always be set to zero.
9 2 bfReserved2 0 must always be set to zero.
specifies the offset from the beginning of
11 4 bfOffBits 1078
the file to the bitmap data.
2. Bitmap Information (40 byte)
start size name stdvalue Purpose
specifies the size of the
15 4 biSize 40 BITMAPINFOHEADER structure, in
bytes.
specifies the width of the image, in
19 4 biWidth 100
pixels.
specifies the height of the image, in
23 4 biHeight 100
pixels.
specifies the number of planes of the
27 2 biPlanes 1
target device, must be set to zero.
29 2 biBitCount 8 specifies the number of bits per pixel.
Specifies the type of compression,
31 4 biCompression 0
usually set to zero (no compression).
specifies the size of the image data, in
35 4 biSizeImage 0
bytes. If there is no compression, it is
9
valid to set this member to zero.
specifies the the horizontal pixels per
39 4 biXPelsPerMeter 0 meter on the designated targer device,
usually set to zero.
specifies the the vertical pixels per
43 4 biYPelsPerMeter 0 meter on the designated targer device,
usually set to zero.
specifies the number of colors used in
the bitmap, if set to zero the number
47 4 biClrUsed 0
of colors is calculated using the
biBitCount member.
specifies the number of color that are
51 4 biClrImportant 0 'important' for the bitmap, if set to
zero, all colors are important.
Note that biBitCount actually specifies the color resolution of the bitmap.
The possible values are:
o 1 (black/white);
o 4 (16 colors);
o 8 (256 colors);
o 24 (16.7 million colors).
The biBitCount data element also decides if there is a color table in the file and
how it looks like:
o In 1-bit mode the color table has to contain 2 entries (white, black).
o In 4-bit mode the color table must contain 16 colors.
o In 8-bit mode the color table contains 256 entries.
o In 24-bit mode, the palette is omitted.
3. Color Palette
The following table shows a single RGBQUAD structure:
start size name stdvalue purpose
1 1 rgbBlue - specifies the blue part of the color.
2 1 rgbGreen - specifies the green part of the color.
3 1 rgbRed - specifies the red part of the color.
4 1 rgbReserved - must always be set to zero.
The color palette appeared if biBitCount is 1, 4 or 8.
Bitmap Data:
It depens on the BMP File Header structure how the pixel data is to be interpreted.
Another important thing is that the number of bytes in one row must always be
adjusted to fit into the border of a multiple of four. You simply append zero bytes
until the number of bytes in a row reaches a multiple of four, an example:
10
6 bytes that represent a row in the bitmap: A0 37 F2 8B 31 C4
must be saved as: A0 37 F2 8B 31 C4 00 00
to reach the multiple of four which is the next higher after six (eight). If you keep
these few rules in mind while working with .bmp files it should be easy for you, to
master it.
o In 1-bit mode every byte in the image data represents eight pixels.
They are arranged from higher to lower bit for pixels from left to
right.
o In 4-bit mode every byte in the image data represents two pixels.
The byte is split into the higher 4 bits and the lower 4 bits and each
value of them points to a palette entry.
o In 8-bit mode every byte represents a pixel. The value points to an
entry in the color table.
o In 24-bit mode, three bytes represent
one pixel. The first byte represents the No Color
red part, the second the green and the Table
third the blue part.
Represent the Image on the Screen
Reference
1) R.C. Gonzalez, R. E. Woods, Digital Image Processing (2nd Edition), Prentice, 2002
2) Nick Effort, Digital Image Processing – A practical Introduction using Java, Pearson
Addison Wesley (ISBN: 0–201-59623-7), 2000
3) R.C. Gonzalez, R. E. Woods, S. L. Eddins, Digital Image Processing using Matlab,
Pearson Prentice Hall (ISBN: 0–13-008519-7), 2004
4) David C. Key & John R. Levine, Graphics File Formats, Windcrest/ M-H,
1995.
5) I.T. Young, J.J. Gerbrands, L,J, van Vliet, Fundamentals of Image
Processing, [Link]
[Link].
11