Reversible Data Hiding ECE643 Digital Image Processing (I) Course Project Professor:Yun Q. Shi Su Yu 12/02/2011 Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Introduction What’s Data Hiding? ◦ A process to embed useful data (information) into a cover media. ◦ Data invisibility is the major requirement. Cover Media Data 1 1 … … 1 0 + Marked Media = Introduction Distortion happens in embedding process: Data 1 1 … … 1 0 + = Introduction Distortion happens in embedding process: Data 1 1 … … 1 0 + = First Requirement: Minimize the distortion and maximize the data payload Introduction What’s Reversible Data Hiding? ◦ A process to reverse the marked media back to the original cover media after the hidden data are extracted. ◦ Reversible or lossless ability is required. Cover Media Marked Media Data 1 1 … … 1 0 + Introduction Errors in reverse process are not allowed: Data 0 1 … … 1 1 + Second Requirement: No error in data and cover media Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Applications Secure medical image data system Law enforcement E-government Image authentication Covert Communication G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni; Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Methods Histogram Pair ◦ Based on Paper: ◦ Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Optimum Histogram Pair ◦ Based on Papers: ◦ G. Xuan, C. Yang,Y. Zhen,Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique ◦ G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Some Concepts PSNR (Peak Signal-to-Noise Ratio) ◦ An engineering term for the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation ◦ The PSNR is most commonly used as a measure of quality of reconstruction of lossy compression (e.g., for image compression). http://en.wikipedia.org/wiki/Peak_signal-tonoise_ratio Some Concepts PSNR (Peak Signal-to-Noise Ratio) ◦ Mathematical definition ◦ 𝑀𝑆𝐸 = 1 𝑚𝑛 ◦ 𝑃𝑆𝑁𝑅 = 𝑚−1 𝑖=0 𝑛−1 𝑗=0 [𝐼 𝑀𝐴𝑋𝐼 2 10𝑙𝑜𝑔10 𝑀𝑆𝐸 𝑖, 𝑗 − 𝐾(𝑖, 𝑗)]2 , in dB ◦ I = cover image, K = marked image ◦ MAXI = maximum gray value 255 PSNR represent the distortion level between marked image and cover image http://en.wikipedia.org/wiki/Peak_signal-tonoise_ratio Some Concepts PSNR (Peak Signal-to-Noise Ratio) ◦ Typical values in lossy image and video compression are between 30 and 50 dB, where higher is better. Original Image PSNR=31.45dB http://en.wikipedia.org/wiki/Peak_signal-tonoise_ratio Some Concepts Histogram Pair ◦ Histogram h(x) is the number of occurrence as the variable X assumes value x, i.e. X is number of pixels on one certain gray value in an image. ◦ Only two consecutive integers a and b assumed by X are considered, i.e. x ∈ a, b. ◦ Furthermore, let h(a) = m and h(b) = 0. We call these two points as a histogram pair. ◦ And sometimes denote it by, h = [m, 0], or simply [m, 0]. G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Some Concepts Histogram Pair ◦ Example: in a histogram of an image, a and b are adjacent integers, h = [m, 0] is a histogram pair. Number of Pixels m 0 a b Gray Value Histogram Pair Advantages ◦ ◦ ◦ ◦ Large data payload 5k-60k bits for 512*512*8 grayscale image High visual quality PSNR > 48 dB Method ◦ Histogram Pair Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Embedding Algorithm Use “Lena” image as an example Step 1: ◦ In the histogram find zero point (e.g. 255 no pixel on the gray value of 255); ◦ Then find peak point (e.g. 155 maximum number of pixels on the gray value of 155); ◦ The objective to find the peak point is to increase the embedding capacity as large as possible, which will be further explained. Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Embedding Algorithm Step 1: Embedding Algorithm Step 2: ◦ The whole image is scanned; ◦ The gray value of pixel with gray value between 156 and 254 is incremented by one; ◦ This step is equivalent to shifting the range of histogram [156,254] one unit towards the right hand side leaving the gray value 156 empty; ◦ Then a=155 and b=156 are adjacent integers, h = [2785, 0] is a histogram pair. Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Embedding Algorithm Step 2: h = [2785, 0] is a histogram pair Embedding Algorithm Step 3: ◦ The whole image is scanned once again; ◦ Once a pixel with gray value of 155 is encountered, we check the data to be embedded; ◦ If the to-be-embedded bit is “1”, the pixel value is added by 1. Otherwise, the pixel value is kept intact. ◦ The capacity of this algorithm equals to the maximum number of pixels (2785 bits) Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Embedding Algorithm Step 3: Embedded data Embedding Algorithm Step 3: Embedded data PSNR = 53.8 dB Retrieval algorithm Step 1: ◦ The whole marked image is scanned; ◦ The order must be same as embedding; ◦ Once the gray value of the maximum point is met, if the value is intact, e.g., 155, the “0” is retrieved; ◦ If the value is altered, e.g., 156, the “1” is retrieved; ◦ In this way, the data embedded can be retrieved. Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Retrieval algorithm Step 2: ◦ The whole image is scanned once again; ◦ Once the pixels whose gray value is between the peak point (e.g. 155) and the zero point (e.g. 255) is met (e.g. interval [156,255]), the gray value of those pixels will be subtracted by 1; ◦ In this way, the original image can be recovered without any distortion. Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Retrieval algorithm Result: Data error rate=0, Image error rate=0 Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding PSNR PSNR of all marked images is above 48 dB; Because the pixels whose gray value is between the zero point and the peak point will add by 1 or minus by 1; In the worst case, all pixels of the image will add or minus by 1. That means MSE=1; 1 𝑀𝑆𝐸 = 𝑚𝑛 𝑚−1 𝑛−1 [𝐼 𝑖, 𝑗 − 𝐾(𝑖, 𝑗)]2 𝑖=0 𝑗=0 Hence the PSNR=10xLog10(255x255/MSE)=48.13 dB. Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Some Concepts Companding ◦ The process of signal compression and expansion. Compression and Expansion ◦ Compression: mapping large range of original signals x, into narrower range, y=C(x). ◦ Expansion: reverse process of compression, x=E(y). ◦ After expansion, the expanded signals are close to the original ones. G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Companding ◦ ◦ ◦ ◦ Assume the original signals are x, If the compression function is y=C(x); If the expansion function is x=E(y); If the equation E[C(x)]=x is satisfied, then this kind of companding could be applied into reversible data hiding. G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Companding in Reversible Data Hiding ◦ Let y=C(x), y=P1P2P3…Pn, Pi ∈ {0,1}; ◦ Let b ∈ {0,1}, y’=P1P2P3…Pnb, then y’=P(y)=2y+b, b is the hiding data; ◦ If y’≈x, modification of signal will hardly be perceived; ◦ By hiding data extraction, extract LSB of y’, i.e. b=LSB(y’), recover signal y=(y’-b)/2; ◦ Recover original signal x by expansion x=E(y) G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Companding in Reversible Data Hiding ◦ So, two conditions must be satisfied: y=C(x), x=E[y], => E[C(x)]=x; Condition (1): E[C(x)]=x; y’=P(y)=2y+b≈x, => P[C(x)]≈x; Condition (2): P[C(x)]≈x G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts For Condition (1), E[C(x)]=x ◦ Any one-to-one mapping function can be used; ◦ For multiple x mapped to single y, still could 𝑓 be used, E.g. 𝑥0, 𝑥1 𝑦, use bit “0” to indicate 𝑥0 , and bit “1” to indicate 𝑥1 , these overhead data also need to embedded into original signal. So, condition (1) is easy to satisfied. G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts For Condition (2), P[C(x)]≈x ◦ On study of Human Visual System (HVS) points out that slight modification on wavelet high frequency sub band coefficients is hard to be perceived by human eyes. ◦ The method to compand image is to slightly change wavelet high frequency sub band coefficients for hiding data. So condition (2) could be satisfied. G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Sub bands (embedding region) for data hiding in coefficients are three high frequency sub bands HH, HL and LH. Question is: How to select the most suitable embedding region? G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Some Concepts Wavelet Transform ◦ Likes Fourier Transform, is used to analysis image in frequency domain. ◦ Fourier Transform is based on sinusoid functions; ◦ Wavelet Transform is based on small waves (wavelets) which are varying in frequency and limited duration. Integer Wavelet Transform (IWT) maps integer to integer and can reconstruct the original signal with out distortion. R. C. Gonzalez and R. E. Woods, < Digital Image Processing >, Prentice Hall, 3rd (2007) edition S.G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts IWT high frequency sub band coefficients has two features: ◦ Most coefficients are small in magnitude, so it is convenient to select compression function C(x), could use linear functions to satisfy Condition (2), P[C(x)]≈x; ◦ For coefficients are large in magnitude, linear functions are difficult to satisfy Condition (2), P[C(x)]≈x; ◦ A pre-defined threshold T is introduced to treat these two kinds of coefficients differently. G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Threshold T ◦ For 𝑥 < 𝑇, use one to one mapping function; ◦ For 𝑥 ≥ 𝑇, x, x+1, or x-1… are compressed to same y and the recording data need to be embedded into wavelet coefficients as index for distinguish different values mapped to the same y; ◦ If T is small, a good visual quality of marked image is achieved; ◦ If T is large, a larger payload can be achieved. Question is: How to choose the best threshold T? G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Some Concepts Histogram Modification ◦ After data embedded in coefficients, some pixel’s gray value may overflow (>255) or underflow (<0); ◦ Histogram modification is needed to narrow the histogram from both sides by GR and GL; ◦ Modification G=GR+GL. G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Some Concepts Histogram Modification ◦ This modification is needed to be recorded and embedded as part of the overhead for recovery the original cover image. Question is: How to make adaptive histogram modification? G. Xuan, C. Yang, Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique Optimum Histogram Pair Advantages ◦ Selection of most suitable embedding region ◦ Selection of best threshold T, leads highest PSNR for a given payload ◦ Minimum amount of histogram modification Method ◦ Optimum Histogram Pair ◦ Using Integer wavelet transformation ◦ Using adaptive histogram modification G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Optimum Histogram Pair Selection of Optimum Parameters ◦ ◦ ◦ ◦ ◦ Suitable embedding region R Best Threshold T Adaptive histogram modification value G 𝑅, 𝑇, 𝐺 = 𝑎𝑟𝑔𝑅,𝑇,𝐺 max(𝑃𝑆𝑁𝑅) The selection of three arguments is based on generate maximum PSNR. G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Optimum Histogram Pair Selection of Suitable embedding region R ◦ In order to improve PSNR, ◦ When the payload is small, R=HH, only embed data into HH sub band; ◦ When the payload is large, R=HH,HL,LH all three high frequency sub bands are used. G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Optimum Histogram Pair Selection of Best Threshold T ◦ By experiment, for certain embedding capacity 0.02 bpp and three different cover image, the best threshold T does exist. Optimum Histogram Pair Selection of Adaptive histogram modification value G ◦ After data embedding into each coefficient, underflow and overflow are checked; ◦ By experiment, only when the payload is larger than certain level, it needs histogram modification (G>0), otherwise, there is no need for histogram modification. “Lena”, if payload > 1.0873 bpp (285027 bits) “Barbara”, if payload > 0.5734 bpp (150320 bits) “Baboon”, if payload > 0.0080 bpp (2089 bits) G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Embedding Algorithm Use as an example: ◦ Assume the to-be-embedded bit sequence D=[110001]; ◦ The image 5*5, has 12 gray values ◦ 𝑥 ∈ [−5, −4, −3, −2, −1,0,1,2,3,4,5,6] 0 4 0 -4 1 0 2 -2 3 -1 4 -3 0 2 -3 -1 -2 0 -1 0 -2 1 2 -1 1 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Embedding Algorithm Use as an example: ◦ Histogram is ℎ0 = [0,1,2,3,4,6,3,3,1,2,0,0] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step1: expand image histogram ◦ From right side, h[4]=0, h[4] to h[5] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step1: expand image histogram ◦ From right side, h[5]=0, h[5] to h[6] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step1: expand image histogram ◦ From left side, h[-4]=0, h[-4] to h[-5] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step1: expand image histogram ◦ From center h[3]=0, h[3] to h[4] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step1: expand image histogram ◦ Histogram is ℎ2 = 1, 𝟎, 𝟐, 3,4,6,3, 𝟑, 𝟎, 𝟏, 𝟎, 2 ◦ Three histogram pairs: from right to left to center ◦ right [1,0], left [0,2], center [3,0] -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step2: Embedding Data ◦ from right to left to center D=[110001]; ◦ right [1,0], capacity=1, embedded 1 using histogram pair method -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step2: Embedding Data ◦ from right to left to center D=[110001]; ◦ left [0,2], capacity=2, embedded 10 using histogram pair method -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step2: Embedding Data ◦ from right to left to center D=[110001]; ◦ Center [3,0], capacity=3, embedded 001 using histogram pair method -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm Step2: Embedding Data ◦ Histogram is ℎ3 = 1,1,1,3,4,6,3,2,1,0,1,2 -5 -4 -3 -2 -1 0 1 2 3 4 5 G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 6 Embedding Algorithm For application in “Lena” image, for certain payload, PSNR is good. Retrieval Algorithm Retrieval Algorithm is inverse to the embedding process; To retrieval data, the order is still from right to left to center, to check number of pixels on gray value (4,5), (-3,-4), (2,3) because those pairs are embedded data; Using the expansion function to get original cover image. G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Conclusion Comparison between two methods: Histogram Pair Payload Small Optimum Histogram Pair Large PSNR Low High Complexity Low High Contents Introduction Applications Methods ◦ Histogram Pair ◦ Optimum Histogram Pair Conclusion Simulation Simulation For Histogram Pair method, to hiding data sentence: “ECE 643 Digital Image Processing Course Project by Su Yu” In “Lena” image. References Z. Ni, Y. Q. Shi, N. Ansari and W. Su, Reversible Data Hiding G. Xuan, C.Yang,Y. Zhen, Y. Q. Shi, and Z. Ni, Reversible Data Hiding Using Integer Wavelet Transform and Companding Technique G. Xuan,Y. Q. Shi, P. Chai, X. Cui, Z. Ni, and X. Tong, Optimum Histogram Pair Based Image Lossless Data Embedding 1. R. C. Gonzalez and R. E. Woods, < Digital Image Processing >, Prentice Hall, 3rd (2007) edition Thank you! Questions?