matlab - Matlab中图像的提取
问题描述
我是 Matlab 的新手,尝试嵌入水印,我成功了。现在,在提取中,我无法正确取回它。
function [ eximage ] = watermark_extract( Y,Y_ex )
host=double(Y);
ln = size(host,1); %the length of the image
hqln = ln/4; %the length of half of the middle quarter
% mqNo = (hqln/4)^2; %Number of middle quarter 8 x 8 squares
LU = ln/2-hqln+1; %the location of the left and upper side of the middle quarter
RL = ln/2+hqln; %the location of the right and lower side of the middle quarter
ex=double(Y_ex);
ln_ex = size(ex,1); %the length of the embedded image
hqln_ex = ln_ex/4; %the length of half of the middle quarter
% mqNo = (hqln/4)^2; %Number of middle quarter 8 x 8 squares
LU_ex = ln_ex/2-hqln+1; %the location of the left and upper side of the middle quarter
RL_ex = ln_ex/2+hqln;
counter = 0;
for s = LU:8:RL
for t= LU:8:RL
ho=host(s:s+7,t:t+7);
host1= blkproc(ho,[8,8],@dct2);%at location 5,2 dct 2 is applied to get the dct coefficients of host image
h(counter*4+1) = host1(5,2);
end
end
wm=[];
w=1; wm=ex;
for i = LU_ex:8:RL
for j= LU_ex:8:RL
d = ex(i:i+7,j:j+7); %
ex1 = blkproc(d,[8,8],@dct2); %at location 5,2 dct 2 is applied to get the dct coefficients of embedded or watermarked image
e(counter*4+1) = ex1(5,2);
end
end
alpha=0.02;
for rw=1:32
for co=1:32
if ne(ex1(5,2),host1(5,2))
wm(rw,co)=0;
else
wm(rw,co)=1;
end
end
end
eximage=blkproc(wm,[8 8],@idct2);% inverse of dct top get back the image
end
我在主机图像中心的 5,2 位置嵌入了一个水印,并应用了 32x32 二进制图像。我在这里想念什么?
解决方案
推荐阅读
- mongodb - 使用 Hibernate OGM 5.3 将多个文档插入 MongoDB
- jquery - jQuery 验证器自定义方法未定义 *有时*
- ios - 如何在 iOS Swift4 中隐藏/显示 UITextView
- r - "选择 * 从
" 使用 'odbc'、'DBI' 包从 R 创建表时,Oracle 11g 无法正常工作 - laravel-5 - fzaninotto/faker 你能设置随机元素的随机 $count 数量吗?
- python - 如何使用具有标签之间相同距离的对数比例属性的符号比例
- azure-cosmosdb - Group By和迭代路径的Gremlin应用
- android - WebView 组件不显示网页:网页不可用
- typescript - Babel 7 + Inversify 4 + WebPack 4 - @inject 上的意外字符'@'
- node.js - 如果尝试从标准输入中读取某些东西,那么玩笑测试失败的好方法是什么?