【将文本编码为图像灰度级别】以 ASCII 编码并与灰度级别位混合将文本字符串隐藏到图像像素的最低位中,使其不明显研究(Matlab代码实现)

💥💥💞💞欢迎来到本博客❤️❤️💥💥

****🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️**座右铭:**行百里者,半于九十。

📋📋📋++本文目录如下:++🎁🎁🎁

目录

[💥1 概述](#💥1 概述)

[📚2 运行结果](#📚2 运行结果)

[🎉3 参考文献](#🎉3 参考文献)

[🌈4 Matlab代码实现](#🌈4 Matlab代码实现)


💥1 概述

经过文本编码技术的应用,我们可以将文本字符串隐藏在图像像素的最低位中,使其在视觉上不易察觉。

在这个实例中,用户可以输入文本消息,并选择要隐藏消息的图像(这些图像是来自MATLAB附带的演示图像列表)。用户还可以选择要用于编码消息的位平面。首先,将文本消息转换为ASCII代码,然后将其转换为二进制字符串。接着,将被选择的位平面与图像像素相对应,从左上角像素开始,自上而下,自左至右进行分配。

由于文本消息以ASCII编码并与灰度级别位混合,所以在图像上并不容易被察觉到。这样的隐藏技术在隐写术领域中具有重要意义,允许用户在图像中嵌入机密信息,而外观上几乎没有变化。

通过这种方法,可以实现图像与文本之间的隐蔽通信,为信息安全和隐私保护提供了一种隐蔽的手段。然而,需要注意的是,隐写术的应用必须遵循法律和伦理准则,以确保信息的嵌入和提取仅在合法的领域进行。

📚 2 运行结果

部分代码:

复制代码
if numberOfColorChannels > 1
	% It's not really gray scale like we expected - it's color.
	% Convert it to gray scale by taking only the green channel.
	grayCoverImage = grayCoverImage(:, :, 2); % Take green channel.
elseif ~isempty(storedColorMap)
	% There's a colormap, so it's an indexed image, not a grayscale image.
	% Apply the color map to turn it into an RGB image.
	grayCoverImage = ind2rgb(grayCoverImage, storedColorMap);
	% Now turn it into a gray scale image.
	grayCoverImage = uint8(255 * mat2gray(rgb2gray(grayCoverImage)));
end
[rows, columns, numberOfColorChannels] = size(grayCoverImage); % Update.  Only would possibly change, and that's if the original image was RGB or indexed.
% Display the image.
hFig = figure;
subplot(1, 2, 1);
imshow(grayCoverImage, []);
axis on;
caption = sprintf('The Original Grayscale Image\nThe "Cover" Image.');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');

% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off') 

%===============================================================================
% Get the string the user wants to hide:
hiddenString = 'This is your sample hidden string.';
% Ask user for a string.
defaultValue = hiddenString;
titleBar = 'Enter the string you want to hide';
userPrompt = 'Enter the string you want to hide';
caUserInput = inputdlg(userPrompt, titleBar, [1, length(userPrompt) + 75], {num2str(defaultValue)});
if isempty(caUserInput)
	% Bail out if they clicked Cancel.

if numberOfColorChannels > 1

% It's not really gray scale like we expected - it's color.

% Convert it to gray scale by taking only the green channel.

grayCoverImage = grayCoverImage(:, :, 2); % Take green channel.

elseif ~isempty(storedColorMap)

% There's a colormap, so it's an indexed image, not a grayscale image.

% Apply the color map to turn it into an RGB image.

grayCoverImage = ind2rgb(grayCoverImage, storedColorMap);

% Now turn it into a gray scale image.

grayCoverImage = uint8(255 * mat2gray(rgb2gray(grayCoverImage)));

end

rows, columns, numberOfColorChannels\] = size(grayCoverImage); % Update. Only would possibly change, and that's if the original image was RGB or indexed. % Display the image. hFig = figure; subplot(1, 2, 1); imshow(grayCoverImage, \[\]); axis on; caption = sprintf('The Original Grayscale Image\\nThe "Cover" Image.'); title(caption, 'FontSize', fontSize, 'Interpreter', 'None'); % Set up figure properties: % Enlarge figure to full screen. set(gcf, 'Units', 'Normalized', 'OuterPosition', \[0 0 1 1\]); % Get rid of tool bar and pulldown menus that are along top of figure. set(gcf, 'Toolbar', 'none', 'Menu', 'none'); % Give a name to the title bar. set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off') %=============================================================================== % Get the string the user wants to hide: hiddenString = 'This is your sample hidden string.'; % Ask user for a string. defaultValue = hiddenString; titleBar = 'Enter the string you want to hide'; userPrompt = 'Enter the string you want to hide'; caUserInput = inputdlg(userPrompt, titleBar, \[1, length(userPrompt) + 75\], {num2str(defaultValue)}); if isempty(caUserInput) % Bail out if they clicked Cancel. ### ****🎉3**** ****参考文献**** > 文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。 \[1\]张健.复杂图像文本提取关键技术与应用研究\[D\].南开大学,2015. \[2\]张姁.基于小波的彩色图像灰度水印算法研究\[D\].河北工业大学\[2023-09-25\].DOI:10.7666/d.d049536. \[3\]刘勇.二值图像压缩编码算法的若干研究\[D\].山东大学,2009.DOI:10.7666/d.y1562519. ### [🌈](https://mp.weixin.qq.com/mp/appmsgalbum?__biz=Mzk0MDMzNzYwOA==&action=getalbum&album_id=2591810113208958977#wechat_redirect "🌈")****4 Matlab代码实现****

相关推荐
ghie9090几秒前
LMD分解通过局部均值分解重构信号实现对信号的降噪
算法·均值算法·重构
有Li7 分钟前
分割任意组织:用于医学图像分割的单样本参考引导免训练自动点提示方法|文献速递-深度学习医疗AI最新文献
论文阅读·深度学习·计算机视觉
零叹1 小时前
篇章十 数据结构——排序
java·数据结构·算法·排序算法
終不似少年遊*1 小时前
机器学习方法实现数独矩阵识别器
人工智能·python·opencv·机器学习·计算机视觉·矩阵
涛哥码咖1 小时前
前端十种排序算法解析
前端·算法·排序算法
朝朝又沐沐2 小时前
算法竞赛阶段二-数据结构(32)数据结构简单介绍
数据结构·算法
共享家95272 小时前
c语言(重点)
c语言·数据结构·算法
玉米的玉*」*2 小时前
【每日likou】704. 二分查找 27. 移除元素 977.有序数组的平方
数据结构·算法·leetcode
星火飞码iFlyCode2 小时前
【无标题】
java·前端·人工智能·算法
liulilittle3 小时前
OpenSSL 的 AES-NI 支持机制
linux·运维·服务器·算法·加密·openssl·解密