>> I=imread('test.jpg');
>> imshow(I);
三个1620*1080的矩阵组成的矩阵
所以影像处理其实就是在处理矩阵
如:
>> for(i=1:size(I,1))
for(j=1:size(I,2))
for(k=1:size(I,3))
I(i,j,k)=I(i,j,k)/2;
end
end
end
>> imshow(I)
将图片变暗
-------------变成了↓----------------
imageinfo(‘mm.png’)
可用于使图片变亮
>> J=immultiply(I,2);
>> subplot(1,2,2);imshow(J);
>> subplot(1,2,1);imshow(I)
叠加,需要图片长宽相同
在这里插入代码片
I=imread('rice.png');
J=imread('cameraman.tif'); K=imadd(I,J);
subplot(1,3,1); imshow(I);
subplot(1,3,2); imshow(K);
subplot(1,3,3); imshow(J);
因为某一点的数值如果相加结果大于255时就只能是255,所以两张图片相加可能会饱和,也就是某些地方显示白色
This MATLAB function calculates the histogram for the grayscale image I.
(计算I的灰度图像I的直方图。)
将灰度直方图的分布拉大
>> I2=histeq(I);
>> subplot(1,4,1);imhist(I);
>> subplot(1,4,2);imshow(I);
>> subplot(1,4,3);imhist(I2);
>> subplot(1,4,4);imshow(I2);
This MATLAB function rotates image I by angle degrees in a counterclockwise
direction around its center point.
*
J = imrotate(I,angle)
J = imrotate(I,angle,method)
J = imrotate(I,angle,method,bbox)
Example
>> J=imrotate(I,35);
>> imshow(J)