Getting error while embedding watermark in DWT watermarking
1 回表示 (過去 30 日間)
古いコメントを表示
Code:
clear all; % save start time start_time=cputime; k=2; % set the gain factor for embeding % read in the cover object file_name='images.jpg'; cover_object=double(imread(file_name)); % determine size of watermarked image Mc=size(cover_object,1); %Height Nc=size(cover_object,2); %Width % read in the message image and reshape it into a vector file_name='copyright.bmp'; message=double(imread(file_name)); Mm=size(message,1); %Height Nm=size(message,2); %Width message_vector=round(reshape(message,Mm*Nm,1)./256); [cA1,cH1,cV1,cD1] = dwt2(cover_object,'haar'); % add pn sequences to H1 and V1 componants when message = 0 for (kk=1:length(message_vector)) pn_sequence_h=round(2*(rand(Mc/2,Nc/2)-0.5)); pn_sequence_v=round(2*(rand(Mc/2,Nc/2)-0.5)); if (message(kk) == 0) cH1=cH1+k*pn_sequence_h; cV1=cV1+k*pn_sequence_v; end end % perform IDWT watermarked_image = idwt2(cA1,cH1,cV1,cD1,'haar',[Mc,Nc]); % convert back to uint8 watermarked_image_uint8=uint8(watermarked_image); % write watermarked Image to file imwrite(watermarked_image_uint8,'dwt_watermarked.jpg','jpg'); % display processing time elapsed_time=cputime-start_time, % display watermarked image figure(1) imshow(watermarked_image_uint8,[]) title('Watermarked Image')
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!