i am not getting why secret message(x) is changing when apply dwt on image.

1 次查看(过去 30 天)
x=-4.335145935643288e-04;
img = imread('frame286.png');
img1=rgb2gray(img);
img2=im2double(img1);
liftscheme = liftwave('haar','int2int');
[cA cH cV cD]=lwt2(img2,'liftscheme');
cD(180,1)=x;
X = idwt2(cA,cH,cV,cD,'liftscheme');
imwrite(X,'gg23.png');
x2= imread('gg23.png');
img5=im2double(x2);
[cA1 cH1 cV1 cD1]=lwt2(x2,'liftscheme');
rr3=cD1(180,1);
now value is changed ie (rr3!=x)
but when i does not create image then it gives same values
x=-4.335145935643288e-04;
img = imread('frame286.png');
img1=rgb2gray(img);
img2=im2double(img1);
liftscheme = liftwave('haar','int2int');
[cA cH cV cD]=lwt2(img2,'liftscheme');
cD(180,1)=x;
X = idwt2(cA,cH,cV,cD,'liftscheme');
[cA1 cH1 cV1 cD1]=lwt2(X,'liftscheme');
rr3=cD1(180,1);
plz someone explain why this is happening because of imwrite?

采纳的回答

Walter Roberson
Walter Roberson 2016-2-17
Round off error. See this bit of documentation in imwrite():
"If A is a grayscale or RGB color image of data type double or single, then imwrite assumes that the dynamic range is [0,1] and automatically scales the data by 255 before writing it to the file as 8-bit values. If the data in A is single, convert A to double before writing to a GIF or TIFF file."
Therefore when you are writing to the .png file, your floating point values are being quantized. That is not happening when you do not write to file.
  3 个评论
Walter Roberson
Walter Roberson 2016-2-18
With the quantization to 8 bit values, you effectively cannot hide more than 8 bits worth of information in one coefficient. Your input value of -4.335145935643288e-04 is specified to an accuracy of 53 bits (the next closest representable number would display as ending with 9 instead of 8). You are therefore going to have to break up the information to be hidden into a minimum of 7 bytes (more likely 8 bytes), and hide the bytes in different places and upon extraction re-assemble the bytes into the desired hidden number.
In practice, it is uncommon to hide more than 3 bits per coefficient, as doing so changes the image too much visually, and the goal of steganography is to hide changes, not make them obvious.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by