Dear all, How to embed message bits in DWT coefficient values ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
I wanted to embed some message bits in DWT coefficient values of an image and transmit. After embedding the message bits when I have performed uint8() to transmit the image as a grayscale image, at the receiving end, I am not able to get back the message bit from the same coefficient values. On the other hand, if I don't perform uint8() function, I can retrive the message bit successfully.
채택된 답변
Walter Roberson
2017년 4월 12일
Use an Integer Wavelet Transform (iwt)
댓글 수: 8
Manashee Malita
2017년 4월 13일
편집: Manashee Malita
2017년 4월 13일
Thank you sir, I have read these(which are in the link) but, not able to get my answer. My problem is that after embedding process, the image is reconstructed, but, the values are in double and when I convert it into uint8, some pixel values are also get changed which create a problem in retrieving the message in the receiving side. Thank you
After you use the integer wavelet, use uint8() before you do the embedding.
Thank you sir. It is working with Integer Wavelet Transform.
Hi, i am a beginner at image processing..i have the same problem after coverting to uint8 i cann't retrieve the hidden message.. i didn't get understand the solution of @Walter Roberson..when should i do the conversion and how?...plz i am a student and i need it so much..help me
Do not use dwt() at all. Use iwt() instead. The result will be integers that you can embed bits in.
shimaa samy
2017년 5월 5일
편집: Walter Roberson
2017년 5월 6일
first..thanks for your reply :)
yes i use lwt ..and it is also the same error..here is my code..i need your help so much..plz tell me what is wrong in my code
% reading the image
img=imread('c:\head4.tif');
% the row (the host row) in which i want to embed the secret message as an example at row
% 305 and start column 3 to end column 570
row_img=img(305,3:570);
% secret message is a vector
secret=[100,200,20,40,50,80,60,230,140,1,2,0,210,205,190,9,0,32,80,100,200,201,202,203,199,189,187,180,170,0,1,0,1,0,100];
secret_bin=dec2bin(secret,8);
secret_bin=secret_bin';
length_secret = size(secret_bin,1)*size(secret_bin,2);
wname = liftwave('haar','int2int');
host_row=double(row_img);
[CA, CD]=lwt(host_row,wname);
length_CA = size(CA,2);
c = 1;
% embedding the secret_bin in the last signficant bit of each CA ( 1 LSB of CA )
for b = 1:1:length_CA
if b <= length_secret
xb=CA(1,c);
if xb < 0
xb= abs(xb);
if strcmp(secret_bin(b), '0')
xb=bitset(xb,1,0);
else
xb=bitset(xb,1,1);
end
CA(1,c)=-xb;
else
if strcmp(secret_bin(b), '0')
CA(1,c) = bitset(CA(1,c),1,0);
else
CA(1,c) = bitset(CA(1,c),1,1);
end
end% end if xb<0
c = c+ 1;
if (c > length_CA)
c = 1;
end
end % if b <= length_secret
end % end for loop b=8:-1:1
stego_host_uint8 = uint8(ilwt(CA,CD,wname));
stego_host_dble = (ilwt(CA,CD,wname));
% Extracting the secret vector from the stego_host_uint8
watermarked_host=double(stego_host_uint8);
[CA_ex, CD_ex] = lwt(watermarked_host,wname);
length_CA_ex = size(CA_ex,2);
c = 1;
secret_bits_ex = zeros(1,size_data);
for b = 1:1:length_CA_ex
if b <= length_secret
xb=CA_ex(1,c);
if xb < 0
xb= abs(xb);
end
secret_bits_ex(b) = bitget(xb,1);
%letter = bitset(letter,b,bitget(xb,1));
c = c + 1;
end
end
% function i created
secret_ex=binRoundC2Dec(secret_bits_ex,8);
% comparison between the input secret vector and the extracted
message=secret';
if secret_ex == message
disp('yes equal');
else
disp('No Equal');
end
% the extracted output [100;200;20;40;114;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;162;0;1;0;1;0;100]
% the input secret [100;200;20;40;50;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;170;0;1;0;1;0;100]
% they are diffrent at positions 5 , 29 ...why?
shimaa samy
2017년 5월 5일
편집: Walter Roberson
2017년 5월 6일
% reading the image
img=imread('c:\head4.tif');
% the row (the host row) in which i want to embed the secret message as an example at row 305 and start column 3 to end column 570
row_img=img(305,3:570);
% secret message is a vector
secret=[100,200,20,40,50,80,60,230,140,1,2,0,210,205,190,9,0,32,80,100,200,201,202,203,199,189,187,180,170,0,1,0,1,0,100];
secret_bin=dec2bin(secret,8);
secret_bin=secret_bin';
length_secret = size(secret_bin,1)*size(secret_bin,2);
wname = liftwave('haar','int2int');
host_row=double(row_img);
[CA, CD]=lwt(host_row,wname);
length_CA = size(CA,2);
c = 1;
% embedding the secret_bin in the last signficant bit of each CA ( 1 LSB of CA )
for b = 1:1:length_CA
if b <= length_secret
xb=CA(1,c);
if xb < 0
xb= abs(xb);
if strcmp(secret_bin(b), '0')
xb=bitset(xb,1,0);
else
xb=bitset(xb,1,1);
end
CA(1,c)=-xb;
else
if strcmp(secret_bin(b), '0')
CA(1,c) = bitset(CA(1,c),1,0);
else
CA(1,c) = bitset(CA(1,c),1,1);
end
end% end if xb<0
c = c+ 1;
if (c > length_CA)
c = 1;
end
end % if b <= length_secret
end % end for loop b=8:-1:1
stego_host_uint8 = uint8(ilwt(CA,CD,wname));
stego_host_dble = (ilwt(CA,CD,wname));
% Extracting the secret vector from the stego_host_uint8
watermarked_host=double(stego_host_uint8);
[CA_ex, CD_ex] = lwt(watermarked_host,wname);
length_CA_ex = size(CA_ex,2);
c = 1;
secret_bits_ex = zeros(1,length_secret);
for b = 1:1:length_CA_ex
if b <= length_secret
xb=CA_ex(1,c);
if xb < 0
xb= abs(xb);
end
secret_bits_ex(b) = bitget(xb,1);
%letter = bitset(letter,b,bitget(xb,1));
c = c + 1;
end
end
% function i created
secret_ex=binRoundC2Dec(secret_bits_ex,8);
% comparison between the input secret vector and the extracted
message=secret';
if secret_ex == message
disp('yes equal');
else
disp('No Equal');
end
% the extracted output [100;200;20;40;114;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;162;0;1;0;1;0;100]
% the input secret [100;200;20;40;50;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;170;0;1;0;1;0;100]
% they are diffrent at positions 5 , 29 ...why?
% Extracting the secret vector from the stego_host_dble
watermarked_host_dbl=double(stego_host_dble);
[CA_ex_dbl, CD_ex_dbl] = lwt(watermarked_host_dbl,wname);
length_CA_ex = size(CA_ex_dbl,2);
c = 1;
secret_bits_ex_dbl = zeros(1,length_secret);
for b = 1:1:length_CA_ex
if b <= length_secret
xb=CA_ex_dbl(1,c);
if xb < 0
xb= abs(xb);
end
secret_bits_ex_dbl(b) = bitget(xb,1);
%letter = bitset(letter,b,bitget(xb,1));
c = c + 1;
end
end
% function i created
secret_ex_dbl=binRoundC2Dec(secret_bits_ex_dbl,8);
% comparison between the input secret vector and the extracted
message=secret';
if secret_ex_dbl == message
disp('yes equal from stego dble');
else
disp('No Equal from stego dble');
end
% the extracted output [100;200;20;40;50;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;170;0;1;0;1;0;100]
% the input secret [100;200;20;40;50;80;60;230;140;1;2;0;210;205;190;9;0;32;80;100;200;201;202;203;199;189;187;180;170;0;1;0;1;0;100]
% they are equal when extracting directly from double lwt without conversion to uint8
You appear to have posted this question as https://www.mathworks.com/matlabcentral/answers/338974-help-embedding-secret-message-using-lwt-cannot-extract-the-secret-message-correctly
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Wavelet Toolbox에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
