1.实现img1-1.jpg图像的读取、显示、二值化以及保存, 读取图像img1-2.tif,将彩色转换成灰度图,并显示。
提示: imread, imshow, im2bw, imwrite, rgb2gray
clear;
x=imread('C:\Users\Administrator\Desktop\img1-2.tif');
subplot(1,2,1);
imshow(x);
x=rgb2gray(x);
subplot(1,2,2);
imshow(x);
保存后的位置在和图片位置相同的路径,自己找一下就好了。
2.读取图像img1-2.tif,将彩色转换成灰度图,并显示。
代码:
clear;
x=imread('C:\Users\Administrator\Desktop\img1-2.tif');
subplot(1,2,1);
imshow(x);
x=rgb2gray(x);
subplot(1,2,2);
imshow(x);
3.读取img2.tif图像,绘制其直方图和概率直方图,并进行直方图均衡操作。
提示:imhist 函数提取直方图信息, stem函数绘制直方图,histeq 函数用于直方图均衡
I=imread('C:\Users\Administrator\Desktop\img2.tif');
J=histeq(I);
subplot(3,2,1),imshow(I);title('原图');
subplot(