matlab初学(image)
2018-03-06 15:33 叶苍笙 阅读(930) 评论(0) 收藏 举报1.imread读取文件
A=imread(filename,fmt)
A=imread('i.jpg',jpg)
filename:文件名字 fmt:文件格式,可以不写由matlab增加判断
2.imshow显示图片
imshow(A)
3.figure新建一个窗口
A=imread('001.png');
imshow(A)
A_gray=rgb2gray(A);%转换成灰度图片
figure,imshow(A_gray)
4.subplot在一个figure中分割
subplot(m,n,k)
将一个figure分割成m*n个,k表示当前第几个
subplot(2,2,1);
imshow(A)
subplot(2,2,2);
imshow(B)
subplot(2,2,3);
imshow(C)
subplot(2,2,4);
imshow(D)
5.rgb2grey彩色转换成灰阶图片
A=imread('001.png');%原彩色图片
imshow(A)
A_gray=rgb2gray(A);%转换成灰度图片
figure,imshow(A_gray)
6.imadjust负片效果
J = imadjust(I,[low_in; high_in],[low_out; high_out])
I:输入的图片 [low_in; high_in]:输入的灰阶范围 [low_out; high_out]:输出的灰阶范围
若是想将图片转换为负片,那么将[low_in; high_in]设置为[0,1],将[low_out; high_out]设置为[1,0]。即原来输入为0的地方变成1输出,输入为1的地方变成0输出。
A=imread('1.jpg');
imshow(A)%显示原图
A1=imadjust(A,[0,1],[1,0]);%将灰度级对调
figure,imshow(A1)%显示负片
学习资料:
http://blog.csdn.net/zxc024000/article/details/49282485
https://jingyan.baidu.com/album/f0e83a257b05e322e4910156.html?picindex=14