matlab imread_matlab经典图片生成与去水印

用matlab生成干扰图片(颜色块随机矩阵):

img = reshape(1:256,16,16);

image(img);

axis square;

axis off;

for i =1:200

   paintpots = rand(256,3);

   colormap(paintpots);

   drawnow;

end

41760d66c0cfaa5f213678fcf0582df4.png

棋盘格的生成:

[x,y] = meshgrid(1:600,1:600);

x1 = sin(x/10);

y1 = sin(y/10);

c = x1.*y1;

pic = c>0;

imshow(pic);

e78eb4eaa0c283d18e957d11c86491d7.png

马赫带的生成:

img = 1:10;

figure(1);

paintpots = ones(10,3);

colormap(paintpots);

image(img);

axis off;

for i =1:10

   paintpots(i,:)=(i/10);

   colormap(paintpots);

end

b2ef6bd8cba93085643ecb16b9f32911.png

对图片去水印:

im = imread('shuiyin.png');%需要去水印的图片

g = rgb2gray(im);

d = im2double(g);

y = d*1.7-0.3;

imshow(y);

如图,左为水印图,右为去除后的效果。

2ce24931f4c31d451364084c40c6a74b.png

63f40effeffec54e98e48c1f07b07075.png

若要将处理结果输出为图片,可在代码末尾加入一行imwrite语句。

所有代码引自 陈立翰《心理学研究方法——基于MATLAB和PSYCHTOOLBOX》,该书详细讲解了用matlab进行心理学视觉、听觉刺激呈现的程序编写及反应收集,需要可自行购买。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值