影像強化(Image Enhancement) 影像強化:處理影像使其結果比原始影像更為適合某特定應用
影像對比反轉(Contrast reversal) PhotoImpact:影像調整反向 s = T(p) = 255 – p 41 214
對比擴展:調亮 PhotoImpact:相片亮度與對比 41 58
對比擴展:調暗 PhotoImpact:相片亮度與對比 41 12
直方圖 PhotoImpact:調整高亮度中間值陰影
Roberts 濾波器 銳化濾波器(Sharpening filter) 增強影像細微部分、被模糊的細節、邊緣 PhotoImpact:相片 清晰 強調邊緣
Roberts 濾波器 Gx 0=50-50 0=70-70 F 50 70 -20 -20
Roberts 濾波器 Gy 20=70-50 20=70-50 F 50 70 20 -20 -20 20 20
Roberts 濾波器 F’ = F + Gx + Gy Gy 50 70 20 -20 Gx F -20 70 90 50 30 10
Roberts 濾波器 F’ = F + Gx + Gy
Roberts 濾波器
Laplacian 濾波器 Lx 40=70+50+50+70-4*50 -40=70+80+50+50+70-4*70 F L 40 1 -4 40=70+50+50+70-4*50 -40=70+80+50+50+70-4*70 F L 50 70 -20 40 -40 -20 20 40 -40
Laplacian 濾波器 F’ = F - L
Vector Quantization (VQ) 7 7 9 10 Index table In this paper we based on vector quantization image compression scheme and Chinese remainder theorem to hide information. The concept of the VQ is try to encode an image into a index table. For example, assume there is a 4 by 4 image. And we want to compress the image by using VQ. First, the image is divided into 2 by 2 blocks, each block of size 2 by 2. Then each block maps a proper codeword from a codebook. If the codeword has the minimum Euclidean distance with the block, then the block is compressed by the index of the codeword. We can see the codeword 7 has the least distance with this block. So we use the corresponding index 7 to represent the block. After VQ compression we can obtain a set of index called a index table. Original Image VQ Encoder
Vector Quantization (VQ) Index table Reconstructed Image Then we can use a VQ decoder to reconstruct the original image. When we want to reconstruct the original image, we just map the index in the index table to the corresponding codeword in the codebook. And the block is replace by the codeword. Then we can obtain the reconstructed image. VQ Decoder
Vector Quantization (VQ) Image compression technique 15 20 10 18 50 40 60 25 110 125 113 140 30 210 220 230 240 100 70 3 7 9 255 13 15.68439 73.98649 227.1629 63.07932 432.4801 120.9091 13.34166 246.258 15 10 11 12 5 7 8 9 120 130 48 36 140 150 53 27 1 2 3 4 5 Image 6 7 Vector Quantization Encoder
VQ Encoding Index table Original Image Codebook … (120,155,…,80) 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (90,135,…,120) (100,125,…,150) … Index table Original Image (49,117,…,25) (50,42,…,98) (20,65,…,110) Codebook
PSNR 34 15 85 37 45 17 10 27 51 40 31 20 12 11 5 5 11 10 13 20 31 41 51 27 10 17 44 37 85 14 35 Image Stego-Image MSE = =0.4375 General, we use two measurements to judge the performance of a information hiding scheme. The first one is image quality of the stego image that is the similarity between the original cover image and the stego image. If the hiding process will not cause too much distortion, then the scheme is good. In this slide, we will show how to calculate the image quality of the stego image. Here are the cover image and the stego image. First we use mean square error (MSE) to calculate the difference between two images. The equation is shown here. Now, we compute the difference between two pixels in two image then squares the difference. The summation of the differences is divided by the total number of the pixels. Then we can get the average difference 0.4375. After that, we inverse the MSE to compute the PSNR value. In this example, the PSNR value of the stego image is 51.72. General speaking, people can not find any different between two image while the PSNR value is higher than 25. So 51.72 is very high PSNR value . Another measurement is information payload, which shows how many information can be embedded in a pixel. In LSB, each pixel can be used to hide one bit. So the payload of LSB is 1 bpp. PSNR (Peak Signal to Noise Ratio) = =51.72 Payload = 1 (bit per pixel, bpp)
Vector Quantization (VQ) Index table Then we can use a VQ decoder to reconstruct the original image. When we want to reconstruct the original image, we just map the index in the index table to the corresponding codeword in the codebook. And the block is replace by the codeword. Then we can obtain the reconstructed image. Reconstructed Image
import java.io.*; import java.io.InputStream; import java.io.OutputStream; public class PSNR { public static void main(String args[]) throws IOException DataInputStream in = new DataInputStream(new FileInputStream("Lena512.raw")); DataOutputStream ou = new DataOutputStream(new FileOutputStream("Lena512_v1.raw")); int imgSize = 512; int Lena [][] = new int [imgSize][imgSize]; int Lena_2 [][] = new int [imgSize][imgSize]; double mse = 0; for(int i=0;i<imgSize;i++) for(int j=0;j<imgSize;j++) Lena [i][j] = (int) in.readUnsignedByte() ; Lena_2 [i][j]= 255 - Lena [i][j]; ou.writeByte(Lena_2[i][j]); mse += (Lena [i][j] - Lena_2 [i][j]) *(Lena [i][j] - Lena_2 [i][j]) ; } mse = mse/imgSize/imgSize; double psnr = 10.0*(Math.log(255.0*255.0/mse)/Math.log(10.0)); System.out.print("psnr = " + psnr); in.close(); ou.close();