lecture 3 - stenography

50
Steganography & Pixel neighbors Dr Khurram Khurshid Digital Image Processing

Upload: abdul-waheed-kandhro

Post on 27-Nov-2014

348 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lecture 3 - Stenography

Steganography & Pixel neighbors

Dr Khurram Khurshid

Digital Image Processing

Page 2: Lecture 3 - Stenography

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

Page 3: Lecture 3 - Stenography

3

Steganography

Before Moving On …. Recall – Logical Shift Operators

Logical left shift one bit Logical right shift one bit

Page 4: Lecture 3 - Stenography

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.

Page 5: Lecture 3 - Stenography

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

Page 6: Lecture 3 - Stenography

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

Page 7: Lecture 3 - Stenography

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

Page 8: Lecture 3 - Stenography

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?

Page 9: Lecture 3 - Stenography

9

Steganography

8-bit-per-band, 3-band, “original” image

8-bit-per-band, 3-band, “original” image

Page 10: Lecture 3 - Stenography

10

Steganography

6-bit-per-band, 3-band, quantized image

6-bit-per-band, 3-band, quantized image

Page 11: Lecture 3 - Stenography

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

Page 12: Lecture 3 - Stenography

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.

Page 13: Lecture 3 - Stenography

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

?

Page 14: Lecture 3 - Stenography

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

Page 15: Lecture 3 - Stenography

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

Page 16: Lecture 3 - Stenography

16

Steganography

Original ImageOriginal Image

Page 17: Lecture 3 - Stenography

17

Steganography

Image quantized to 4-bits per pixel.

Image quantized to 4-bits per pixel.

Page 18: Lecture 3 - Stenography

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.

Page 19: Lecture 3 - Stenography

19

Steganography

Extracted Image

Page 20: Lecture 3 - Stenography

20

Steganography

http://mozaiq.org/encrypt/

Page 21: Lecture 3 - Stenography

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

Page 22: Lecture 3 - Stenography

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

Page 23: Lecture 3 - Stenography

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)

Page 24: Lecture 3 - Stenography

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

Page 25: Lecture 3 - Stenography

25

Determine different regions in the image

Page 26: Lecture 3 - Stenography

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

Page 27: Lecture 3 - Stenography

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}

Page 28: Lecture 3 - Stenography

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}

Page 29: Lecture 3 - Stenography

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.

Page 30: Lecture 3 - Stenography

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

Page 31: Lecture 3 - Stenography

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

Page 32: Lecture 3 - Stenography

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

Page 33: Lecture 3 - Stenography

33

CC labeling – 4 Connectivity

Page 34: Lecture 3 - Stenography

34

CC labeling – 4 Connectivity

Page 35: Lecture 3 - Stenography

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

Page 36: Lecture 3 - Stenography

36

CC labeling – 8 Connectivity

Background pixel

Unlabeled Pixel

Background pixel

Unlabeled Pixel

Label 1

Page 37: Lecture 3 - Stenography

37

CC labeling – 8 Connectivity

Background pixel

Unlabeled Pixel

Label 1

Label 2

Background pixel

Unlabeled Pixel

Label 1

Label 2

Label 3

Page 38: Lecture 3 - Stenography

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

Page 39: Lecture 3 - Stenography

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

Page 40: Lecture 3 - Stenography

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

Page 41: Lecture 3 - Stenography

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)

Page 42: Lecture 3 - Stenography

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)

Page 43: Lecture 3 - Stenography

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)

Page 44: Lecture 3 - Stenography

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

Page 45: Lecture 3 - Stenography

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

Page 46: Lecture 3 - Stenography

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

Page 47: Lecture 3 - Stenography

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]

Page 48: Lecture 3 - Stenography

48

Logical Operations (Binary Images)

Page 49: Lecture 3 - Stenography

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

Page 50: Lecture 3 - Stenography

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