• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

12.matlab图像处理基础——混沌系统、函数

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1、混沌系统

(1)绘制序列

  语法:y = linspace(x1,x2,n)

  序列值分布:(x2-x1)/(n-1)

%% 绘制序列
x = linspace(0,0,100);
x(1) = 0.98;
for i = 2:100;
    x(i) = 1-2*x(i-1)*x(i-1);
end
plot(x)

(2)初始值敏感性

%% 初始值敏感性
long = 100;
a = linspace(0,0,long);
a(1) = 0.98;
for i = 2:long;
    a(i) = 1-2*a(i-1)*a(i-1);
end
b = linspace(0,0,long);
b(1) = 0.980001;
for i = 2:long;
    b(i) = 1-2*b(i-1)*b(i-1);
end
plot(a);
hold on
plot(b) 

(3)二值化处理

  

%% 二值化处理
a = linspace(0,0,80);
a(1) = 0.98;
for i = 2:80;
    a(i) = 1-2*a(i-1)*a(i-1);
end
% plot(a,\'o\');
b = a;
for i = 1:80
    if a(i)>0
        b(i) = 1;
    else
        b(i)=0;
    end
end
subplot(1,2,1),plot(a,\'o\');
subplot(1,2,2),plot(b,\'ob\');

(4)生成二值混沌系统

%% 生成二值混沌图像
a = zeros(512,512);
a(1) = 0.98;
for i =2:512*512
    a(i) = 1-2*a(i-1)*a(i-1);
end
for i = 1:512*512
    if a(i)>0
        a(i)=1;
    else
        a(i)=0;
    end
end
imshow(a);

(5)生成灰度混沌图像

%% 生成灰度混沌图像
clc;
clear all;
a = zeros(512,512);
a(1) = 0.98;
for i =2:512*512
    a(i) = 1-2*a(i-1)*a(i-1);
end
% 对a的值进行转换
b = zeros(512,512);
b = mod(round(a*98989898989898),256);
imshow(b,[]);

(6)生成彩色混沌图像

%% 生产彩色混沌图像
r = zeros(512,512);
r(1) = 0.98;
for i = 2:512*512
    r(i) = 1-2*r(i-1)*r(i-1);
end
r = mod(round(r*10000000),256);

g = zeros(512,512);
g(1) = 0.59;
for i = 2:512*512
    g(i) = 1-2*g(i-1)*g(i-1);
end
g = mod(round(g*10000000),256);

b = zeros(512,512);
b(1) = 0.236;
for i = 2:512*512
    b(i) = 1-2*b(i-1)*b(i-1);
end
b = mod(round(b*10000000),256);

c = zeros(512,512,3);
c = cat(3,r,g,b);
imshow(uint8(c));

2、函数

(1)函数构建

 

(2)生成二值混沌图像函数

  ① 函数生成:

function bitI = creatBI(oValue)
%   生成二值混沌图像
bitI = zeros(512,512);
% 生成混沌数组
l = zeros(512,512);
l(1) = oValue;
for i = 2:512*512
    l(i) = 1-2*l(i-1)*l(i-1);
end

% 二值化
for i = 1:512*512
    if l(i)>0
        bitI(i)=1;
    else
        bitI(i)=0;
    end
end

  ② 函数调用:

%% 二值混沌图像函数调用
t = creatBI(0.98);
imshow(t);

(3)生成灰度混沌图像函数

  ① 生成函数:

function grayImage = grayImage(oValue)
%   生成灰度混沌图像

l = zeros(512,512);
grayIamge = zeros(512,512);
l(1) = oValue;
for i = 2:512*512
    l(i) = 1-2*l(i-1)*l(i-1);
end

grayImage=mod(round(l*100000000),256);
grayImage=uint8(grayImage);

  ② 函数调用:

%% 灰度混沌图像函数调用
x = grayImage(0.98);
imshow(x);

(4)生成彩色混沌图像函数

  ① 生成函数:

function x = RgbImage(oValue1,oValue2,oValue3)
%   生成彩色混沌图像

% 方法一:重写
% r = zeros(512,512);
% g = zeros(512,512);
% b = zeros(512,512);
% 
% % red通道
% r(1) = oValue1;
% for i =2:512*512
%     r(i) = 1-2*r(i-1)*r(i-1);
% end
% r = mod(round(r*100000000),256);
% % green通道
% g(1) = oValue2;
% for i =2:512*512
%     g(i) = 1-2*g(i-1)*g(i-1);
% end
% g = mod(round(g*100000000),256);
% % blue通道
% b(1) = oValue3;
% for i =2:512*512
%     b(i) = 1-2*b(i-1)*b(i-1);
% end
% b = mod(round(b*100000000),256);
% 
% % 合成
% x = cat(3,r,g,b);
% x = uint8(x);

% 方法2:调用灰度混沌生成函数
r = grayImage(oValue1);
g = grayImage(oValue2);
b = grayImage(oValue3);
x = cat(3,r,g,b);
x = uint8(x);

  ② 函数调用:

%% 彩色混沌图像函数调用
x = RgbImage(0.98,0.56,0.23);
imshow(x);

  


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi下webbrowser的应用发布时间:2022-07-18
下一篇:
Delphi2007精简版加载Borland.Studio.Together.dll错误解决办法发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap