You are on page 1of 45

Dr.

Muhammad Shahzad
Department Of Computing (DOC), SEECS, NUST
http://seecs.nust.edu.pk/faculty/muhammadshahzad.html
muhammad.shehzad@seecs.edu.pk
Spring 2018, MSCS-7
▪ Histogram Equilization
▪ Adaptive version

▪ Histogram Specification
▪ Bit-Plane Slicing
▪ Steganography
▪ Neighborhood processing

2
▪ Histogram Equilization
▪ Histogram Specification
▪ Bit-Plane Slicing
▪ Steganography
▪ Neighborhood processing

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
clear all; close all; clc % combine both images into one
combined_img=bitor(im1_left_shift, im2_right_shift);
im1 = imread(‘cameraman.tif’);
im2 = imread(‘rice.png’); figure; imshow(combined_img);

% shifting image 1 % extract images back


im1_right_shift=bitshift(im1,-4); AA=bitshift(combined_img,-4);
im1_left_shift=bitshift(im1_right_shift,4); BB=bitshift(combined_img,4);
BB=bitshift(BB,-4);
% shifting image 2
im2_right_shift=bitshift(im2,-4); figure;
im2_left_shift=bitshift(im2_right_shift,4); subplot(1,2,1),imshow(AA),caxis([0 15])
subplot(1,2,2),imshow(BB),caxis([0 15])
figure;
subplot(2,2,1);imshow(im1);
subplot(2,2,3);imshow(im1_right_shift); caxis([0 15])
subplot(2,2,4);imshow(im1_left_shift);

figure;
subplot(2,2,1);imshow(im2);
subplot(2,2,3);imshow(im2_right_shift); caxis([0 15])
subplot(2,2,4);imshow(im2_left_shift); 25
▪ Histogram Equalization
▪ Histogram Specification
▪ Bit-Plane Slicing
▪ Steganography
▪ Neighborhood processing

26
▪ They don’t know where they are in an image

▪ They don’t know anything about their neighbors

▪ Most image features (edges, textures, etc) involve a spatial


neighborhood of pixels

▪ If we want to enhance or manipulate these features, we need to


go beyond point operations

27
▪ Spatial Filtering : Basics

28
Basics

29
Basics

30
Basics

31
Basics

32
Basics

33
Basics

34
Basics

35
Basics

36
▪ The output intensity value at (x,y) depends not only on the
input intensity value at (x,y) but also on the specified number of
neighbouring intensity values around (x,y)

▪ Spatial masks (also called window, filter, kernel, template) are


used and convolved over the entire image for enhancement
(spatial filtering)

▪ The size of the masks determines the number of neighbouring


pixels which influence the output value at (x,y)

▪ The values (coefficients) of the mask determine the nature and


properties of enhancing technique

37
Filtering can be given in equation
form as shown above

38
39
= wTz

40
g  x, y   w  1, 1 f  x  1, y  1  w  1,0  f  x  1, y   w  1,1 f  x  1, y  1
 w  0, 1 f  x, y  1  w  0,0  f  x, y   w  0,1 f  x, y  1
 w 1, 1 f  x  1, y  1  w 1,0  f  x  1, y   w 1,1 f  x  1, y  1

In general, linear spatial filtering of an Filter


image of size M x N with a filter of size coefficients
m x n is given below

Pixels of
m 1 n 1 image
where a  ,b 
2 2 section
under filter
where x and y are varied so that each
pixel in w visits every pixel in f
41
▪ There are two closely related concepts that must be understood
clearly when performing linear spatial filtering
▪ Correlation
▪ Convolution

▪ Correlation is the process of moving a filter mask w over the


image f and computing the sum of products at each location
exaxctly as explained in the previous slide

▪ Mechanically, convolution is the same process, except that w is


rotated by 180 degrees prior to passing it over the image f

▪ Read section 3.4.1 and section 3.4.2; DIP 3e by Gonzalez

42
Correlation Convolution

43
Correlation Convolution

44
Various contents in this presentation have been taken from
different books, lecture notes, and the web. These solely belong
to their owners, and are here used only for clarifying various
educational concepts. Any copyright infringement is not
intended.

45

You might also like