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
棋盤格的生成:
[x,y] = meshgrid(1:600,1:600);
x1 = sin(x/10);
y1 = sin(y/10);
c = x1.*y1;
pic = c>0;
imshow(pic);
馬赫帶的生成:
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
對圖片去水印:
im = imread('shuiyin.png');%需要去水印的圖片
g = rgb2gray(im);
d = im2double(g);
y = d*1.7-0.3;
imshow(y);
如圖,左為水印圖,右為去除后的效果。
若要將處理結果輸出為圖片,可在代碼末尾加入一行imwrite語句。
所有代碼引自 陳立翰《心理學研究方法——基于MATLAB和PSYCHTOOLBOX》,該書詳細講解了用matlab進行心理學視覺、聽覺刺激呈現的程序編寫及反應收集,需要可自行購買。
總結
以上是生活随笔為你收集整理的matlab imread_matlab经典图片生成与去水印的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ string replace_J
- 下一篇: matlab 线性拟合polyfit_一