function [Y_waterMarked]=embed(S_Y_P_source,row,column,blocksize,message_pad)
% 嵌入规则:对于各8×8块,DCT变换后以step为步长量化,以S取模。
% if message bit is 0,coefficient+s/4;
% if message bit is 1,coefficient+3*s/4;
step=1;%量化步长
s=15;%模值
for y=0:(row/blocksize-1)
for x=0:(column/blocksize-1)
% transform block using DCT
dct_block=dct2(S_Y_P_source((y*blocksize+1):(y+1)*blocksize,(x*blocksize+1):(x+1)*blocksize));
dct_block_WM=dct_block;
% DCT变换后以step为步长量化,以S取模。
messured_dct_block=dct_block/step;
relaxed_messured_dct_block=messured_dct_block-mod(messured_dct_block,s);
% if message bit is 0 elseif message bit is 1
if (message_pad(y*column/blocksize+x+1) == 0)
dct_block_WM(1,2)=relaxed_messured_dct_block(1,2)+s/4;
dct_block_WM(3,1)=relaxed_messured_dct_block(3,1)+s/4;
dct_block_WM(4,4)=relaxed_messured_dct_block(4,4)+s/4;
elseif (message_pad(y*column/blocksize+x+1) == 1)
dct_block_WM(1,2)=relaxed_messured_dct_block(1,2)+3*s/4;
dct_block_WM(3,1)=relaxed_messured_dct_block(3,1)+3*s/4;
dct_block_WM(4,4)=relaxed_messured_dct_block(4,4)+3*s/4;
end
% transform block back into spatial domain
Y_waterMarked( y*blocksize+1:(y+1)*blocksize,x*blocksize+1:(x+1)*blocksize)=idct2(dct_block_WM);
end
end
zznieyanlong1989
- 粉丝: 0
- 资源: 6
最新资源
- 全新完整版H5商城系统源码 亲测 附教程.zip
- (源码)基于Python的咖啡粉反射率分析系统.zip
- jsp ssm 校园订餐系统 校园点餐 在线点餐订餐 项目源码 web java【项目源码+数据库脚本+项目说明+软件工具】毕设
- Fideo(直播录制工具) v1.0.8支持抖音快手等全网各大平台
- 星宿UI小程序所需软件教程.zip
- (源码)基于C++的学生选课系统.zip
- JAVA企业级Java快速开发框架源码数据库 MySQL源码类型 WebForm
- 海湾控制器CAAN总线联网调试
- (源码)基于Android的NubiaZ9MaxNX512J设备配置与传感器管理系统.zip
- 2023最新校园综合跑腿服务小程序源码/全开源的/附详细安装教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈