一段MATLAB代码 哪位大侠给解释一下可以吗? 15
clear;clc;closeallsize=256;block=8;blockno=size/block;LENGTH=size*size/64;Alpha1=0.02...
clear;clc;close all
size=256;block=8;blockno=size/block;LENGTH=size*size/64;
Alpha1=0.02; Alpha2=0.1; T1=3; I=zeros(size,size); BW=zeros(size,size); block_dct1=zeros(block,block);
mark=imread('2.jpg');mark=rgb2gray(mark);
subplot(2,2,1);imshow(mark);title('水印图片'); mark=edge(mark,'prewitt')
subplot(2,2,2);I=imread('1.jpg');
I=rgb2gray(I);
imshow(I);title('原始图像');
BW=edge(I,'prewitt');subplot(2,2,3);imshow(BW);
title('原图边界');
k=1;
for m=1:blockno
for n=1:blockno
x=(m-1)*block+1; y=(n-1)*block+1;
block_dct1=I(x:x+block-1,y:y+block-1);
block_dct1=dct2(block_dct1);
BW_8_8=BW(x:x+block-1,y:y+block-1);
if m<=1|n<=1
T=0;
else
T=sum(BW_8_8); T=sum(T);
end
if T>T1
Alpha=Alpha2
else
Alpha=Alpha1;
end
block_dct1(1,1)=block_dct1(1,1)*(1+Alpha*mark(k)); block_dct1=idct2(block_dct1);
I(x:x+block-1,y:y+block-1)=block_dct1;
k=k+1;
end
end
subplot(2,2,4);imshow(I,[]);title('嵌入水印的图像');
救命呀 谁有相应的提取代码呀 好心人 帮帮忙 展开
size=256;block=8;blockno=size/block;LENGTH=size*size/64;
Alpha1=0.02; Alpha2=0.1; T1=3; I=zeros(size,size); BW=zeros(size,size); block_dct1=zeros(block,block);
mark=imread('2.jpg');mark=rgb2gray(mark);
subplot(2,2,1);imshow(mark);title('水印图片'); mark=edge(mark,'prewitt')
subplot(2,2,2);I=imread('1.jpg');
I=rgb2gray(I);
imshow(I);title('原始图像');
BW=edge(I,'prewitt');subplot(2,2,3);imshow(BW);
title('原图边界');
k=1;
for m=1:blockno
for n=1:blockno
x=(m-1)*block+1; y=(n-1)*block+1;
block_dct1=I(x:x+block-1,y:y+block-1);
block_dct1=dct2(block_dct1);
BW_8_8=BW(x:x+block-1,y:y+block-1);
if m<=1|n<=1
T=0;
else
T=sum(BW_8_8); T=sum(T);
end
if T>T1
Alpha=Alpha2
else
Alpha=Alpha1;
end
block_dct1(1,1)=block_dct1(1,1)*(1+Alpha*mark(k)); block_dct1=idct2(block_dct1);
I(x:x+block-1,y:y+block-1)=block_dct1;
k=k+1;
end
end
subplot(2,2,4);imshow(I,[]);title('嵌入水印的图像');
救命呀 谁有相应的提取代码呀 好心人 帮帮忙 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询