【图像隐藏】基于 FFT实现数字水印嵌入含Matlab源码
2022/3/11 12:15:11
本文主要是介绍【图像隐藏】基于 FFT实现数字水印嵌入含Matlab源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1 简介
基于 FFT实现数字水印嵌入
2 部分代码
%Watermarking based on FFTclcclear allclose all%Reading Original Image[FileName,FilePath] = uigetfile('*.*');Image = imread([FilePath,FileName]);if size(image,3) == 1 Image = rgb2gray (Image);end[ImageRows,ImageColoumns] = size(Image);%Reading Logo[FileName,FilePath] = uigetfile('*.*');Logo = imread([FilePath,FileName]);if size(Logo,3) == 1 Logo = rgb2gray(Logo);endLogo = im2bw(Logo,0.7);[LogoRows,LogoColoumns] = size(Logo);figure, subplot(2,3,1),imshow(Image);title('Original Image') subplot(2,3,4),imshow(Logo);title('Logo')%Water Mark Logo, lines 17 & 18 also can be used for Logo extraction.ImageFFT = fft2(Image);ImageFFTshift = fftshift(ImageFFT);ImageFFTshift2 = ImageFFTshift;%Is used for inserting the Logo far from center of FFT.%Inserting the Logo to center of the FFT shifted Image. ImageFFTshift(ImageRows / 2:(ImageRows / 2+ LogoRows - 1), ...ImageColoumns / 2 :(ImageColoumns / 2 + LogoColoumns - 1)) = Logo;% Reversing the FFT to obtain Image in spatial domain.WaterMArkedImage = ifftshift(ImageFFTshift);WaterMArkedImage = ifft2(WaterMArkedImage);subplot(2,3,2),imshow(uint8(WaterMArkedImage))title('Watermarked Image')subplot(2,3,5),imshow(ImageFFTshift);title('Embeded Logo in FFT2')%Inserting the Logo outside the center of the FFT shifted Image. ImageFFTshift2(10:(10 + LogoRows - 1),5 : 5 + LogoColoumns - 1)= Logo;WaterMArkedImage2 = ifftshift(ImageFFTshift2);WaterMArkedImage2 = ifft2(WaterMArkedImage2);subplot(2,3,3),imshow(uint8(WaterMArkedImage2));title('Watermarked Image')subplot(2,3,6),imshow(ImageFFTshift2);title('Embeded Logo in FFT2')%When logo is far from center Image quality dose not change!
3 仿真结果
4 参考文献
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
这篇关于【图像隐藏】基于 FFT实现数字水印嵌入含Matlab源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-05小米13T Pro系统合集:性能与摄影的极致融合,值得你升级的系统ROM
- 2024-10-01基于Python+Vue开发的医院门诊预约挂号系统
- 2024-10-01基于Python+Vue开发的旅游景区管理系统
- 2024-10-01RestfulAPI入门指南:打造简单易懂的API接口
- 2024-10-01初学者指南:了解和使用Server Action
- 2024-10-01Server Component入门指南:搭建与配置详解
- 2024-10-01React 中使用 useRequest 实现数据请求
- 2024-10-01使用 golang 将ETH账户的资产平均分散到其他账户
- 2024-10-01JWT用户校验课程:从入门到实践
- 2024-10-01Server Component课程入门指南