Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Multimedia

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Multimedia Lab

06420902712

MULTIMEDIA
TECHNOLOGY
LAB FILE

ETCS-360

Made By:

Submitted To:

RAVI KUMAR

Ms. Priyanka

09120902712

Multimedia Lab

06420902712

INDEX
S.No.

AIM

PAGE DATE
OF DATE
OF TEACHERS
NO.
PRACTICAL SUBMISSION SIGNATURE

Multimedia Lab

06420902712

Experiment No. 1
Objective: Introduction to MATLAB and basic operations on images
1. What is MATLAB?
MATLAB stands for MATrix LABoratory, is a high-performance language for technical
computing. It integrates computation, visualization, and programming environment.
Furthermore, MATLAB is a modern programming language environment: it has
sophisticated data structures, contains built-in editing and debugging tools, and supports
object-oriented programming. Its ideal for research and data analysis purposes.
MATLAB has many advantages compared to conventional computer languages (e.g., C,
FORTRAN) for solving technical problems.
It has powerful built-in routines that enable a very wide variety of computations. It also has
easy to use graphics commands that make the visualization of results immediately available.
Specific applications are collected in packages referred to as toolbox. There are toolboxes
for signal processing, symbolic computation, control theory, simulation, image procesing,
and several other fields of applied science and engineering.
2. Image Processing Toolbox provides a comprehensive set of reference-standard

algorithms, functions, and apps for image processing, analysis, visualization, and
algorithm development.
This Toolbox provides image manipulation capabilities, handles a wide range of image
formats and allows creation of contours or histograms.

3. Basic Image Handling Functions


S.No.

Function Name

Syntax

Description

imread()

A = imread(filename, fmt)

This function reads a gray-scale


or coloured image from the file
path specified by a string named
filename.

Multimedia Lab

06420902712
fmt refers to the format in which
the file exists at the
corresponding location.
Supported types include:
'gif','bmp' etc.
The return value A is an array
containing the image data. If the
file contains a grayscale
image, A is an M-by-N array.

imshow()

figure

clc, clear, clear all

imshow(I,[low high])

imshow(I,[low high]) displays


the grayscale image I,
where [low high] ,an optional
argument,a two-element vector
that specifies the display range
for I. The value low (and any
value less than low) displays as
black and the value high (and
any value greater than high)
displays as white.
Figure creates a new figure
window using default property
values. This new figure window
becomes the current figure, and
it displays on top of all other
figures on the screen. The title of
the figure is an integer value that
is not already used by an existing
figure.

clear var;

clc clears all input and output


from the Command Window
display, giving you a "clean
screen."
After using clc, you cannot use
the scroll bar to see the history of
functions, but you still can use
the up arrow key, to recall
statements from the command
history.
clear, is used to clear the
contents of the variable whose
name is specified thereafter.
clear all clears all the variable
names.

size()

[m,n] = size(X)

It returns the size of matrix X in


separate dimensions m and n.

Multimedia Lab

06420902712

Source Code:
%Created By Abhineet Saxena
%Date: 02-Feb-2015
%File_1--Introduction To Image Processing
%-------------------------clc
%Clears all input and output from command window display
I='rice.png';
% A char variable which stores a path to a file.
Img_read=imread(I);
%imread() function belongs to Image Processing Toolkit,used for reading in
%an image.
figure(1),imshow(Img_read)
%Displays the specified image,in a figure window
[r,c]=size(Img_read);

Multimedia Lab

06420902712

Outputs:

Multimedia Lab

06420902712

Experiment No. 2
Objective: To perform bit-plane slicing of an image and create subplots based on the
output produced.
Theory:
Bit Plane Slicing
Instead of highlighting gray level images, highlighting the contribution made to total image
appearance by specific bits might be desired. Suppose that each pixel in an image is represented by
8 bits. Imagine the image is composed of 8, 1-bit planes ranging from bit plane1-0 (LSB)to bit
plane 7 (MSB).
In terms of 8-bits bytes, plane 0 contains all lowest order bits in the bytes comprising the pixels in
the image and plane 7 contains all high order bits.

This technique of image slicing is helpful in image compression,and in differentially analysing the
contribution made by each bit to the overall image.

S.No.

Function/Command Name

Syntax

Description

title()

title(str)

title(str) adds the title


consisting of a string, str, at the
top and in the center of the
current axes.

plot()

plot(I),plot(X,Y)

Plot() function plots/draws 2-D


line plot of the graphical
objects on the screen supplied
as argument(s).
plot(Y) creates a 2-D line plot
of the data in Y versus the
index of each value.

subplot()

subplot(m,n,p)

Subplot divides the figure into


an m cross n grid and creates
axes for subplot at position
specified at p.

reshape()

logical()

reshape(A,size1,size2,.. It reshapes the given array A,


sizeN)
into an array of dimensions
size1,size2,..sizeN), where
size1,size2..sizeN indicates the
size of each dimension.
L=logical(A)

L = logical(A) converts
numeric input A into an array

Multimedia Lab

06420902712
of logical values. Any nonzero
element of input A is converted
to logical 1 (true) and zeros are
converted to logical 0 (false).

histogram()

bitget()

max(A),min(A)

histogram(X),histogram Histogram function is used to


(X,nbins)
create a hitogram using the
values provided by array or
vector X. If 'nbins' not
specified, an automatic binning
algorithm creates bins of
uniform width chosen to cover
the range in X. Else, explicitly
specified using nbins
argument.
c=bitget(A, bit)

This returns the bits at


positions specified by 'bit' in
'A'.
Return the maximum and
minimum element respectively
in array A.

Source Code:
%Created by Abhineet Saxena
%Date: 9 February 2015
%~~To display bit-slicing capabilities of MATLAB and to plot the values by
%reshaping them.
%% Bit Slicing and display of subplots
figure(1);
%To Read-in the image: %
ipath='rice.png';
I=imread(ipath);
[r, c]= size(I);
%Displaying the maximum and minimum pixel number value in the scanned image%
mymax=max(I);
mymin=min(I);
%Extracting the corresponding bit slices and displaying it in the subplot%
A=bitget(I,1);
subplot(3,3,1),imshow(logical(A));
title('Subplot 1: Bit Slice 1');
A=bitget(I,2);
subplot(3,3,2),imshow(logical(A));
title('Subplot 2: Bit Slice 2');
A=bitget(I,3);
subplot(3,3,3),imshow(logical(A));
title('Subplot 3: Bit Slice 3');
A=bitget(I,4);
subplot(3,3,4),imshow(logical(A));
title('Subplot 4: Bit Slice 4');

Multimedia Lab

06420902712

A=bitget(I,5);
subplot(3,3,5),imshow(logical(A));
title('Subplot 5: Bit Slice 5');
A=bitget(I,6);
subplot(3,3,6),imshow(logical(A));
title('Subplot 6: Bit Slice 6');
A=bitget(I,7);
subplot(3,3,7),imshow(logical(A));
title('Subplot 7: Bit Slice 7');
A=bitget(I,8);
subplot(3,3,8),imshow(logical(A));
title('Subplot 8: Bit Slice 8');
subplot(3,3,9),imshow(I);
title('Subplot 9: Original Image');
%% Reshape the image and plot the histograms
figure(2);
Bimg_r=reshape(I,r*c,1);
Bimg_c=reshape(I,1,r*c);
nbins=255;
subplot(2,2,1), imshow(Bimg_r);
title('Reshaping the image in column major order');
subplot(2,2,2),hist(double(Bimg_r),nbins);
title('Histogram for the column reshaped matrix');
subplot(2,2,3), imshow(Bimg_c);
title('Reshaping the image in row major order');
subplot(2,2,4),hist(double(Bimg_c),nbins);
title('Histogram for the row reshaped matrix');

Outputs:

Multimedia Lab

06420902712

10

You might also like