当前位置:网站首页>【图像处理】matlab基础图像处理 | 图像载入、图像添加噪声、图像滤波、图像卷积
【图像处理】matlab基础图像处理 | 图像载入、图像添加噪声、图像滤波、图像卷积
2022-08-08 05:25:00 【今天一定要洛必达】
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
一、图片载入与显示
1.1 最普通的调用方式
最普通的版本:
I=imread('1.jpg');
imshow(I);
colorbar %展示颜色条
结果:
1.2 读取RGB图片将其转为灰度图并显示
I=imread('1.jpg');
gmap=rgb2gray(I);%转为灰度图的函数
imshow(gmap);
colorbar %展示颜色条
结果:
1.3 读取RGB图片将其转为二值图并显示
I=imread('1.jpg');
gmap=im2bw(I);%转为灰度图的函数
imshow(gmap);
colorbar %展示颜色条
结果:
二、噪声制造(生成噪声图)
2.1.噪声制造
代码如下(示例):
clear all;
image=imread('1.jpg');
image_jiaoyan=imnoise(image,'salt & pepper');
image_gaosi=imnoise(image,'gaussian');
subplot(131);
imshow(image);
title('原始图像')
subplot(132);
imshow(image_jiaoyan);
title('椒盐噪声')
subplot(133);
imshow(image_gaosi);
title('高斯噪声')
结果:
这里可能不太清楚,重新单个列出来:
椒盐噪声:

高斯噪声:
三 去噪实验(均值滤波,中值滤波)
3.1.保存两张噪声图到本地中
会使用到imwrite函数
clear all;
image=imread('1.jpg');
image_jiaoyan=imnoise(image,'salt & pepper');
image_gaosi=imnoise(image,'gaussian');
subplot(131);
imshow(image);
title('原始图像')
subplot(132);
imshow(image_jiaoyan);
title('椒盐噪声');
imwrite(image_jiaoyan,'jiaoyan.jpg')
subplot(133);
imshow(image_gaosi);
title('高斯噪声')
imwrite(image_gaosi,'gaosi.jpg')

3.2.均值滤波器
3.3.中值滤波器


四 图像卷积实验
4.1.图像“曝光”
data=imread('1.jpg');
A=rgb2gray(data);
imshow(A);
B=[0 0 0
0 2 0
0 0 0];
C=conv2(B,A);
figure(1);
subplot(1,2,1);
imshow(A);
subplot(1,2,2);
imshow(uint8(C));

4.2.图像不变
data=imread('1.jpg');
A=rgb2gray(data);
imshow(A);
B=[0 0 0
0 1 0
0 0 0];
C=conv2(B,A);
figure(1);
subplot(1,2,1);
imshow(A);
subplot(1,2,2);
imshow(uint8(C));

边栏推荐
猜你喜欢

Spark entry learning-3-SparkSQL data abstraction

TCP/IP基本实现

查询时间内用户分布的sql语句

Unity-CharacterController(角色控制器)

毕设——基于人脸表情的桌面交互精灵设计(分享一下成果,附上人脸表情的数据集和自己训练出来yolov5模型以及基于PYQT5运行yolov5的交互界面)

14.Unity2D 横版 粒子系统特效 飙血粒子+高处落地粒子+对象池管理所有粒子

leetcode-isomorphic string judgment

Connect two tables to update the third table (updata) in postgresql

邮件钓鱼上线cobalstrike

查询跟踪多家快递单号,筛选某一时间发货的单号
随机推荐
《公共管理学》考试重点及答案
《动机与人格》笔记(二)——认识和理解的欲望
121道分布式面试题和答案
14.Unity2D 横版 粒子系统特效 飙血粒子+高处落地粒子+对象池管理所有粒子
报错:[Intervention] Unable to preventDefault inside passive event listener due to target ...
Open3D ICP精配准(使用鲁棒性核函数)
Cube - studio deployment process
【js基础】js的垃圾回收机制/内存回收机制
C语言-函数
Week 8 Transformer Language Models and Implications
全网唯一OpenCyphal/UAVCAN教程(11)用candump和gawk工具写一个Cyphal协议解析小工具
2022-08-07 mysql/stonedb slow SQL-subquery-semi-join
cs软件ui构建办法
C language framework FreeSwitch custom event introduction and usage example
CAP定理实例分析
多维度数组拉平到一维
千亿级、大规模:腾讯超大 Apache Pulsar 集群性能调优实践
【猜拳游戏 基于Objective-C语言】
Sequence table (below)
【Win10】Several sleep problems and countermeasures