图像的读取方式
如图像的读取和显示:
p1 = imread('4.jpg');
p2 = imread('ice.jpeg');
figure;
subplot(121);imshow(p1);
subplot(122);imshow(p2);
保存
视频文件的读取本质与图片类似:
read() 读取
movie() 播放
图像处理:
- 灰度变化
- 图形变平移旋转 intransform()
- 图像分块 选出某个局部区域进行操作
-
图像增强
提高图像的可辨识度和质量
灰度增强、规定化处理— histep()函数
如图第三幅灰度增强后效果:
使用imcontour(I,2) 可以画出等灰度线
p1 = imread('4.jpg');
p2 = imread('ice.jpeg');
I = rgb2gray(p2);
J = histeq(I);
figure;
subplot(131);imshow(I);
subplot(132);imshow(p2);
subplot(133);imshow(J);
图像增强还有 图像滤波(去除噪声)
卷积方式 conv2()
线性滤波 imfilter()
非线性中值滤波 medfilt2()
统计滤波 ordfilt2() 【最小值、最大值】
自适应滤波 wiener2()
除此之外还有频域滤波(突出边缘,高通滤波)、带阻滤波、同态滤波(对比增强)
-
图像还原
逆过程来还原图像,与增强不同,需要知道噪声来源 -
图像分割(边缘、阈值、区域分割)
边缘检测采用:微分算子、canny算子、log算子等
h1 = [-1 -1 -1 ; 2 2 2; -1 -1 -1]; %横线
h2 = [-1 -1 2 ; -1 2 -1; 2 -1 -1];%45°线
h3 = [-1 2 -1 ; -1 2 -1; -1 2 -1];
h4 = [2 -1 -1 ; -1 2 -1; -1 -1 2];
J1 = imfilter(I,h1);
J2 = imfilter(I,h2);
J3 = imfilter(I,h3);
J4 = imfilter(I,h4);
J = J1+J2+J3+J4;
figure
subplot(121);imshow(I);
subplot(122);imshow(J);
算子法 roberts算子例子,prewitt(水平竖直),sobel,canny(更加精细)
[J,t] = edge(I,'roberts',35/255);
figure
subplot(121);imshow(I);
subplot(122);imshow(J);
阈值分割法(通过灰度直方图来找阈值,两波谷作为全局阈值),全局阈值分割,utso阈值,迭代分割
列子(utso)
I = im2double(I);
T = graythresh(I);
J = im2bw(I,T);
figure
subplot(121);imshow(I);
subplot(122);imshow(J);
区域分割法:分水岭分割、区域增长法
-
图形变换
傅里叶变换(时域变到频域处理)– 卷积实现分割选取
离散余弦变换压缩 -
提取边界信息
四叉树法
- 图像融合
实列
倾斜图像校正,如车牌矫正
人脸识别、图像识别
具体见《matlab图像处理实例详解》于网盘
simulink中有相应库
版权声明:本文为keleke_原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。