当前位置:网站首页>【图像处理】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));

边栏推荐
- Connect two tables to update the third table (updata) in postgresql
- C language force to deduct the length of the last word of the 58th question.Traverse from back to front
- Servlet---ServletConfig类使用介绍
- Leetcode sword 】 refers to the Offer (special commando) summary
- MySQL4(多表查询)
- 《动机与人格》笔记(二)——认识和理解的欲望
- bpftrace:简便输出调试信息
- Matlab simulation of photovoltaic mppt maximum power control based on disturbance observation method
- 查询跟踪多家快递单号,筛选某一时间发货的单号
- The difference between CHAR_LENGTH() and LENGTH() in MySQL
猜你喜欢
随机推荐
研发医疗器械产品需要做的测试
字符串题目解析
力扣84 双周赛 t4 6144 和力扣305周赛t4 6138
0字典树/字符串中等 LeetCode676. 实现一个魔法字典
C语言力扣第58题之最后一个单词的长度。从后往前遍历
【js基础】js的垃圾回收机制/内存回收机制
Week 8 Generative Adversarial Networks(生成对抗网络 GAN)
Leetcode sword 】 refers to the Offer (special commando) summary
MYSQL export data dictionary
[Untitled] I haven't thought of a name yet
Style of DataGrid in wpf
KD树应用汇总
10 must-have free tools for self-media people to operate quickly and efficiently
分类、目标检测、语义分割、实例分割的区别
MySQL4(多表查询)
VSCode已经设置过为中文但变成英文的解决办法
Sequence table (below)
Web attack log analysis: a guide for beginners
Mail online cobalstrike fishing
Distributed Transactions: A Reliable Message Eventual Consistency Scheme









