Required a robust watermarking code which against resizing

Hi everyone, i am final year student in computer science. Doing a watermarking project,embed a watermark - extract d watermark - and prevent it from attacks (just resize). I've found many algorithm, but many watermark embedded has lost after i resize it smaller or bigger.
here's my coding: Embed part
clear all; close all; clc;
[filename1]=uigetfile('*.bmp','Select the host image');
image1=imread(num2str(filename1));
imshow(image1); title('Original image');% orginal image for watermarking
[ori_row,ori_col]=size(image1);
host_length=ori_row*ori_col;
i=1;
j=1;
k=1;
[filename2,pathname]=uigetfile('*.*','Select the watermark image');
wmimage=imread(num2str(filename2));
[wm_row,wm_col] = size(wmimage);
imshow(wmimage); title('Watermark image');
wm=dec2bin(wmimage);
wm_length=wm_row*wm_col*8;
host=dec2bin(image1);
counter=0;
while i < host_length
counter=counter+1;
if counter > wm_length
break;
end
host(i,8)=wm(j,k);
k=k+1;
if k>8
k=1;
j=j+1;
end
i=i+1;
end
key1=wm_row;
key2=wm_col;
im1=bin2dec(host);
im1=reshape(im1,ori_row,ori_col);
image1(1:ori_row,1:ori_col)=im1(1:ori_row,1:ori_col);
display 'After embed';
imwrite(image1,'watermarked.bmp'); % saves the watermarked image as a bmp file
imshow(image1);title('Watermarked image');
*any recommended extraction code which still able to extract the watermark after i resize the watermarked image? Please~ *

 채택된 답변

Image Analyst
Image Analyst 2013년 5월 18일

0 개 추천

So you have an image that you watermarked with a hidden/secret image. You want to recognize your image in case someone has "stolen" it. And the thief takes the image and resizes it. Now you want to take that test image, and apply your watermark recognition/extraction algorithm to see if the test image is one of your images with your identifying, special watermark in it. Does that explain it?
If so, why can't you just resize the test image to the original size (if you know what image you think it might have originated from), and then run your extraction algorithm?

댓글 수: 4

Hi Sir, Ya u got what i meant! But then, aren't there any DCT coding that can successfully generate the watermark which i have planted into the cover image?
Image Analyst
Image Analyst 2013년 5월 18일
편집: Image Analyst 2013년 5월 18일
If you hid it in there, then don't you know how to get it back out? If you did an effective job of hiding it, then it would be tough to generate it if you didn't know how it was hidden.
See section 23.3 for lots of algorithms an a wide variety of watermarking & steganography methods: VisionBib
this is the extracting part:
clc;
[filename1,pathname]=uigetfile('*.*','select the image');
img1=imread(num2str(filename1));
imshow(img1);title('Watermarked image');
prompt ='Please enter which bit you want to use for watermarking? (1-8)';
dialogTitle = 'Enter Bit Plane to Replace';
numberOfLines = 1;
defaultResponse = {'1'};
bitToSet = str2double(cell2mat(inputdlg(prompt, dialogTitle, numberOfLines, defaultResponse)));
[row,col]=size(img1);
Hlength=row*col;
i=1;
j=1;
k=1;
row=64; % our embed row
col=64; % our embed col
[filename2,pathname]=uigetfile('*.*','Select the watermark image');
wmimage=imread(num2str(filename2));
wmimage=imresize(wmimage,[row col]);
wm=dec2bin(wmimage);
Wlength=row*col*8;
host=dec2bin(img1);
cnt=0;
while i < Hlength
cnt=cnt+1;
if cnt>Wlength
break;
end
wm(j,k)=host(i,bitToSet);
k=k+1;
if k>8
k=1;
j=j+1;
end
i=i+1;
end
wm1=bin2dec(wm);
wm2=reshape(wm1,row,col);
wmimage(1:row,1:col)=wm2(1:row,1:col);
output_filename=['extract_', filename1];
imwrite(wmimage,output_filename);
imshow(wmimage);
the watermark I've plant in can't get back...
Well there's a bug in your extraction code somewhere if you can't get back the image you inserted. I don't really understand what's going on, especially since there are no comments, but I'm sure by using the debugger and spending some time on it, you'll discover your error(s).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2013년 5월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by