lecture 3 - stenography
TRANSCRIPT
Steganography & Pixel neighbors
Dr Khurram Khurshid
Digital Image Processing
2
Steganography
The science of writing hidden messages in such a way that no one, apart from the
sender and intended recipient, suspects the existence of the message
3
Steganography
Before Moving On …. Recall – Logical Shift Operators
Logical left shift one bit Logical right shift one bit
SteganographySteganography
8-bit Image 6-bit Image
Two
lea
st s
igni
fica
nt b
its a
re 0
If an image is quantized, say from 8 bits to 6 bits and redisplayed it can be all but impossible to tell the difference between the two.
5
Steganography
That other information could be a message, perhaps encrypted, or even another image.
If the 6-bit version is displayed as an 8-bit image then the 8-bit pixels all have zeros in the lower 2 bits:
00bb bb b b
b = 0 or 1 always 0
This introduces the possibility of encoding other information in the low-order bits.
Image 2
R-Shift 6
Image Out
Image 1
R-Shift 2
L-Shift 2
X-Shift n = logical left or right shift by n bits.
logical OR
0 0 1 0 1 1 0 1
1 0 1 1 0 1 0 0
180
1 1 0 1 1 1 0 0
220
0 0 0 0 0 0 1 103
1 0 1 1 0 1 1 1
183
1 0 1 1 0 1 1 0
182
R-Shift 2
L-Shift 2
SteganographySteganography
R-Shift 6
1 0 1 1 0 1 1 1
183
SteganographySteganography
L-Shift 6
1 1 0 0 0 0 0 0
192
Extracted Second Image
How
to
get
the
seco
nd im
age
How
to
get
the
seco
nd im
age
0 0 1 0 1 1 0 1
1 0 1 1 0 1 0 0
180
0 0 0 0 0 0 1 1
03
0 0 0 0 0 0 1 103
1 0 1 1 0 1 1 1
183
1 0 1 1 0 1 1 0
182
R-Shift 2
L-Shift 2
SteganographySteganography
R-Shift 6
If we have only 4 colors (2-bits) and we put them in the lower order bits
If we have only 4 colors (2-bits) and we put them in the lower order bits
No need to shift rightNo need to shift right
What would you do to get back original data?
What would you do to get back original data?
9
Steganography
8-bit-per-band, 3-band, “original” image
8-bit-per-band, 3-band, “original” image
10
Steganography
6-bit-per-band, 3-band, quantized image
6-bit-per-band, 3-band, quantized image
11
Steganography
The histograms of the two versions indicate which is which. If the 6-bit version is displayed as an 8-bit image it has only pixels with values 0, 4, 8, … , 252.
green-band histogram of 8-bit image green-band histogram of 6-bit image
12
Steganography
The second image is invisible because the value of each pixel is between 0 and 3. For any given pixel, its value is added to the to the collocated pixel in the first image that has a value from the set {0, 4, 8, … , 252}. The 2nd image is noise on the 1st.
13
Steganography
To recover the second image (which is 2 bits per pixel per band) simply left shift the combined image by 6 bits.
L-S
hift
6
?
14
Steganography
To recover the second image (which is 2 bits per pixel per band) simply left shift the combined image by 6 bits.
L-S
hift
6
image
15
Steganography
Images 1 and 2 each have 4-bits per pixel when combined.
Images 1 and 2 each have 4-bits per pixel when combined.
This is so effective that two 4-bit-per-pixel images can be superimposed with only the image in the high-order bits visible. Both images contain the same amount of information but the image in the low-order bits is effectively invisible
Image 2
R-Shift 4
Image Out
Image 1
R-Shift 4
L-Shift 4
16
Steganography
Original ImageOriginal Image
17
Steganography
Image quantized to 4-bits per pixel.
Image quantized to 4-bits per pixel.
18
Steganography
Image 1 in upper 4-bits. Image 2 in lower 4-bits.
Image 1 in upper 4-bits. Image 2 in lower 4-bits.
19
Steganography
Extracted Image
20
Steganography
http://mozaiq.org/encrypt/
21
Relationships between pixels
Neighbors of pixel are the pixels that are adjacent pixels of an identified pixel
x-1 x+1x
y-1
y+1
y
22
4- Neighbors of a Pixel –N4(p)
x-1 x+1x
y-1
y-1
y
(x-1,y), (x+1,y), (x, y-1), (x, y+1)
Wh
at a
re th
e
coo
rdin
ate
s of
ea
ch o
f th
e b
lue
pix
els
Wh
at a
re th
e
coo
rdin
ate
s of
ea
ch o
f th
e b
lue
pix
els
23
Diagonal Neighbors of a Pixel –ND(p)
x-1 x+1x
y-1
y-1
y
(x-1,y-1), (x+1,y-1), (x-1, y+1), (x+1, y+1)
24
8- Neighbors of a Pixel –N8(p)
x-1 x+1x
y-1
y-1
y
(x-1,y), (x+1,y), (x, y-1), (x, y+1)
(x-1,y-1), (x+1,y-1), (x-1, y+1), (x+1, y+1)
8 4( ) ( ) ( )DN p N p N p
25
Determine different regions in the image
26
Connectivity
Establishing boundaries of objects and components in an image
Group the same region by assumption that the pixels being the same color or
equal intensity
Two pixels p & q are connected if
They are adjacent in some sense If their gray levels satisfy a specified criterion of
similarity
27
Connectivity
V: Set of gray levels used to define the criterion of similarity
4-connectivity4-connectivity
If gray level4( , ) , ( )p q V and q N p
Set of gray levels V = {1}Set of gray levels V = {1}
28
Connectivity
V: Set of gray levels used to define the criterion of similarity
8-connectivity8-connectivity
If gray level8( , ) , ( )p q V and q N p
Set of gray levels V = {1}Set of gray levels V = {1}
29
Connectivity
V: Set of gray levels used to define the criterion of similarity
m-connectivity (Mixed Connectivity)m-connectivity (Mixed Connectivity)
If gray level
( , ) , satisfies one of the following:p q V and q4 ( )q N p or
4 4( ) ( ) ( ) has no pixels
whose values are from VDq N p And N p N q
a.
b.
30
Example: m – Connectivity
Set of gray levels V = {1}
Note: Mixed connectivity can eliminate the multiple path connections that often occurs in 8-connectivity
31
Paths
Path: Let coordinates of pixel p: (x, y), and of pixel q: (s, t)
A path from p to q is a sequence of distinct pixels with
coordinates: (x0, y0), (x1, y1), ......, (xn,yn)
where (x0, y0) = (x, y) & (xn,yn) = (s, t), and (xi,yi) is adjacent
to (xi-1,yi-1) 1≤i ≤n
32
CC labeling – 4 Connectivity
Process the image from left toright, top to bottom:
1.) If the next pixel to process is 1 i.) If only one of its neighbors
(top or left) is 1, copy its label.
ii.) If both are 1 and have the same label, copy it.
iii.) If they have different labels Copy the label from the left. Update the equivalence table.
iv.) Otherwise, assign a new label.
Re-label with the smallest of equivalentlabels
Pass 1
Pass 2
33
CC labeling – 4 Connectivity
34
CC labeling – 4 Connectivity
35
CC labeling – 8 Connectivity
Same algorithm but examine also the upper diagonal neighbors of pSame algorithm but examine also the upper diagonal neighbors of p
36
CC labeling – 8 Connectivity
Background pixel
Unlabeled Pixel
Background pixel
Unlabeled Pixel
Label 1
37
CC labeling – 8 Connectivity
Background pixel
Unlabeled Pixel
Label 1
Label 2
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
38
CC labeling – 8 Connectivity
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
39
CC labeling – 8 Connectivity
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
40
CC labeling – 8 Connectivity
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Label 4
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Label 4
41
Distance Metrics
Let pixels p, q and z have coordinates (x,y), (s,t) and (u,v) respectively.
D is a distance function or metric if D(p,q) ≥ 0 and D(p,q) = 0 iff p = q and D(p,q) = D(q,p) and D(p,z) ≤ D(p,q) + D(q,z)
42
City block distance (D4 distance)
4 ( , )D p q x s y t
Diamond with center at (x,y)
D4 = 1 are the 4 neighbors of pixel p(x,y)
43
Chessboard distance (D8 distance)
8 ( , ) max( , )D p q x s y t
Square centered at p(x,y) D8 = 1 are the 8 neighbors
of pixel p(x,y)
44
Euclidean Distance
2 2( , ) ( ) ( )eD p q x s y t
A circle with radius r centered at (x,y)
p(x,y)
q(s,t)
r
45
Arithmetic Operations
Carried out between corresponding pixel pairs ( , ) ( , ) ( , )s x y f x y g x y
( , ) ( , ) ( , )d x y f x y g x y ( , ) ( , ) ( , )p x y f x y g x y
( , ) ( , ) ( , )d x y f x y g x y
46
Arithmetic Operations
Conversion to range 0 – 255 Difference of two 8-bit images: -255 to 255 Sum of two 8-bit images: 0 to 510 Solution?
Set all values < 0 to 0
Set all values > 255 to 255
Full range of arithmetic operation not captured
47
Arithmetic Operations
First perform the operation
Then perform
min( )mf f f
Creates an image whose minimum value
is 0
max( )s m mf K f f
Creates a scaled image fs with values in
the range [0 K]
48
Logical Operations (Binary Images)
49
Acknowledgements
Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2002
Peters, Richard Alan, II, Lectures on Image Processing, Vanderbilt University, Nashville, TN, April 2008
Brian Mac Namee, Digitial Image Processing, School of Computing, Dublin Institute of Technology
Computer Vision for Computer Graphics, Mark Borg
Ma
teria
l in
th
ese
slid
es
ha
s b
ee
n t
ake
n f
rom
th
e f
ollo
win
g r
eso
urc
es
50
Acknowledgements
Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000 Pattern Recognition and Analysis Course – A.K. Jain, MSU Pattern Classification” by Duda et al., John Wiley & Sons. Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley,
2002 Machine Vision: Automated Visual Inspection and Robot Vision”, David Vernon, Prentice
Hall, 1991 www.eu.aibo.com/ Advances in Human Computer Interaction, Shane Pinder, InTech, Austria, October 2008
Ma
teria
l in
th
ese
slid
es
ha
s b
ee
n t
ake
n f
rom
, th
e f
ollo
win
g r
eso
urc
es