Professional Documents
Culture Documents
Introduction To Dig Ital Image Processi NG (DIP) : Prepared By: Laily Azyan Binti Ramlan
Introduction To Dig Ital Image Processi NG (DIP) : Prepared By: Laily Azyan Binti Ramlan
Vector Raster
Types of image
Image Types
Vector Raster
• Vector programs best for creating logos, drawings and Raster programs best for editing photos and creating
illustrations, technical drawings. For images that will be continuous tone images with soft color blends
applied to physical products.
• Vector art can be used for many processes and easily Some processes cannot use raster formats
rasterized to be used for all processes
Source: https://www.radiantvisionsystems.com
Concept of Bits Per Pixel
• The number of different colors in an image depends on the depth of color or bits per
pixel.
Bits per pixel Number of colors
1 bpp 2 colors
Formula :-
2 bpp 4 colors
3 bpp 8 colors
4 bpp 16 colors
5 bpp 32 colors
6 bpp 64 colors
7 bpp 128 colors
8 bpp 256 colors
10 bpp 1024 colors
64 Gray Levels 32 Gray Levels 16 Gray Levels
Eg: Assuming an image has 1024 rows and 1024 columns. And since it is a gray
scale image, it has 256 different shades of gray or it has 8 bits per pixel. Then
putting these values in the formula, we get
Size of an image = rows x cols x bpp
= 1024 x 1024 x 8
= 8388608 bits.
But since its not a standard answer that we recognize, so will convert it into our
format.
Converting it into bytes = 8388608 / 8 = 1048576 bytes.
Converting into kilo bytes = 1048576 / 1024 = 1024kb.
Converting into Mega bytes = 1024 / 1024 = 1 Mb.
MATLAB Environment
RGB Image
I = imread ('flowers.jpg');
imshow (I);
whos
info = imfinfo('flowers.jpg');
info.BitDepth
Identify Bit Depth of the image
Grayscale Image
I = imread ('flowers.jpg’);
Ig = rgb2gray (I);
imshow (Ig);
whos
Save Grayscale Image
Grayscale Image
I = imread ('flowers.jpg’);
Ig = rgb2gray (I);
imshow (Ig);
whos
imwrite (Ig, ‘flowers_gray.png’);
Save to excel:
I = imread ('flowers_gray.png’);
filename = flowers_gray.xlsx
xlswrite (filename, I);
Bit Depth of Grayscale Image
imtool function
The Image Viewer provides all the image display capabilities of imshow, which optimizes figure, axes, and image
object property settings for image display. The Image Viewer also provides access to several tools for navigating
and exploring images, such as the Pixel Region tool, Image Information tool, and the Adjust Contrast tool.
Resizing Image
Specify the Magnification Value
I = imread('flowers.jpg');
Reduced size
J = imresize(I,0.25); %reduce size
K = imresize(I,1.25); %magnify size
figure
imshow(I);
figure
imshow(J);
figure
imshow(K);
Magnified size
Original image
Specify the Size of the Output Image
- Pass imresize a vector that contains the number of rows and columns in the output image
I = imread('flowers.jpg');
figure
imshow(I);
L = imresize(I,[100 150]);
figure
imshow(L)
Image Rotation
I = imread(‘flowers.jpg’);
subplot (121), imshow (I);
J = imrotate(I,35);
subplot (122), imshow (J);
Crop a Rotated Image
I = imread(‘flowers.jpg’);
subplot (121), imshow (I);
J = imrotate(I,35, ‘crop’);
subplot (122), imshow (J);
Negative of an Image
I = imread('flowers.jpg');
subplot (121), imshow (I);
J = imcomplement(I);
subplot (122), imshow (J);
Type of Noises in Image
I = imread('flowers.jpg');
Ig = rgb2gray(I);