当前位置:网站首页>Matlab learning 7- linear smoothing filtering of image processing
Matlab learning 7- linear smoothing filtering of image processing
2022-06-11 08:51:00 【CHengYuP】
Tips : When the article is finished , Directories can be generated automatically , How to generate it, please refer to the help document on the right
List of articles
Preface
Spatial filtering enhancement
- Convolution principle
- Multidimensional continuous convolution
- Linear smoothing filtering
- Domain average method 、 Selective averaging 、Wiener wave filtering
- Nonlinear smoothing filtering
- median filtering
- Linear sharpening filter
- Laplacian operator
- Nonlinear sharpening filter
- Prewitt operator
- Sobel operator
- Log operator
Matlab Study 7- Linear smoothing filtering for image processing
Domain average method 、 Selective averaging 、Wiener wave filtering
One 、 Select the average method for filtering and denoising
effect 
Code
% Select the average method for filtering and denoising
img =imread("img/test.bmp");
subplot(2,3,1);imshow(img),xlabel(" original image ");
% Mean filtering
K1=filter2(fspecial("average",3),img);
subplot(2,3,2);imshow(uint8(K1)),xlabel(" Original picture 3*3 Convolution and mean filtering ");
% Convolution sum Or template
mask=[ 0 0 0
0 1 1
0 1 1];
mask=1/4*mask;
K2=filter2(mask,img);
subplot(2,3,3);imshow(uint8(K2)),xlabel(" The original image selects average convolution and average filtering ");
ju=imnoise(img,"salt & pepper",0.04);
subplot(2,3,4);imshow(ju),xlabel(" Noise image ");
% Mean filtering
K3=filter2(fspecial("average",3),ju);
subplot(2,3,5);imshow(uint8(K3)),xlabel(" Noise image 3*3 Convolution and mean filtering ");
% Convolution sum Or template
mask=[ 0 0 0
0 1 1
0 1 1];
mask=1/4*mask;
K4=filter2(mask,ju);
subplot(2,3,6);imshow(uint8(K4)),xlabel(" Average convolution and mean filtering are selected for noisy images ");
Two 、 Domain average denoising
effect 
Code
% Domain average denoising
img =imread("img/eight.tif");
subplot(2,3,1);imshow(img),xlabel(" original image ");
ju=imnoise(img,"salt & pepper",0.004);
subplot(2,3,2);imshow(ju),xlabel(" Noise image ");
% Mean filtering
K1=filter2(fspecial("average",3),ju);
subplot(2,3,3);imshow(uint8(K1)),xlabel("3*3 Convolution and mean filtering ");
K2=filter2(fspecial("average",5),ju);
subplot(2,3,4);imshow(uint8(K2)),xlabel("5*5 Convolution and mean filtering ");
% Convolution sum Or template
mask4=[ 0 1 0
1 0 1
0 1 0];
mask4=1/4*mask4;
K3=filter2(mask4,ju);
subplot(2,3,5);imshow(uint8(K3)),xlabel("4 Neighborhood convolution and mean filtering ");
mask8=[ 1 1 1
1 0 1
1 1 1];
mask8=1/8*mask8;
K4=filter2(mask8,ju);
subplot(2,3,6);imshow(uint8(K4)),xlabel("8 Neighborhood convolution and mean filtering ");
3、 ... and 、Wiener wave filtering
effect 
Code
% Wiener wave filtering
img =imread("img/eight.tif");
subplot(2,3,1);imshow(img),xlabel(" original image ");
ju=imnoise(img,"salt & pepper",0.04);
subplot(2,3,2);imshow(ju),xlabel(" Noise image ");
K1=wiener2(ju,[3,3]);
subplot(2,3,3);imshow(K1),xlabel(" Noise image 3*3Wiener wave filtering ");
K2=wiener2(ju,[5,5]);
subplot(2,3,4);imshow(K2),xlabel(" Noise image 5*5Wiener wave filtering ");
K3=wiener2(ju,[7,7]);
subplot(2,3,5);imshow(K3),xlabel(" Noise image 7*7Wiener wave filtering ");
K4=wiener2(ju,[9,9]);
subplot(2,3,6);imshow(K4),xlabel(" Noise image 9*9Wiener wave filtering ");
Four 、 Linear smoothing filtering
Code
% Linear smoothing filtering
Fxy=[0 20 40 70
80 100 120 150
160 180 200 230];
uint8Fxy=uint8(Fxy);
subplot(2,2,1),imshow(uint8Fxy),xlabel(" original image ");
subplot(2,2,2),imhist(uint8Fxy),axis([0,255,0,1]),xlabel(" Histogram of the original image ","position",[120,-0.23]);
% Smooth operation , Fuzzy action , Denoise
Gxy=filter2(fspecial("average",3),uint8Fxy);
uint8Gxy=uint8(Gxy);
subplot(2,2,3),imshow(uint8Gxy),xlabel(" Mean filtered image ");
subplot(2,2,4),imhist(uint8Gxy),axis([0,255,0,1]),xlabel(" Histogram of filtered image ","position",[120,-0.23]);
Click to get the source code
https://gitee.com/CYFreud/matlab/tree/master/image_processing/demo7_220418
边栏推荐
- Redis6 entry-level tutorial. There are integration cases. You can directly see the integration cases. It is easy to get started
- 进程间的通信
- Matlab学习8-图像处理之线性与非线性锐化滤波、非线性平滑滤波
- Interprocess communication
- 显示屏DIN 4102-1 Class B1防火测试要求
- What if the copied code format is confused?
- K8s application (IV) - build a redis5 cluster (for direct external access)
- GCC AVR (ATMEL studio+ AVR studio) how to define the structure array in the program memory (flash) space and read it
- Codetop - sort odd ascending even descending linked list
- Sword finger offer 62 The last remaining number in the circle
猜你喜欢

Codetop - sort odd ascending even descending linked list

Can not connect to local MySQL server through socket ‘/tmp/mysql. sock (2)‘

Matlab学习9-图像处理之非线性锐化滤波

C语言打印菱形

Redis6 entry-level tutorial. There are integration cases. You can directly see the integration cases. It is easy to get started

M1 芯片指南:M1、M1 Pro、M1 Max 和 M1 Ultra

leetcode - 230. The k-th smallest element in a binary search tree

Screaming Frog Log File Analyser 中文版安装教程

c语言打印心形

剑指 Offer 62. 圆圈中最后剩下的数字
随机推荐
js 中 Map 和 Set 的用法及区别
[cvpr2022] intensive reading of querydet papers
领导让我重写测试代码,我也要照办嘛?
2、 Rendering camera data
K8s application (IV) - build a redis5 cluster (for direct external access)
B+ super tree helps you know the underlying structure of MySQL
智能控制理论小题库
剑指 Offer 10- II. 青蛙跳台阶问题
并查集是什么?你还在为其烦恼?其实就是一个连通图的问题,理解起来没有那么困难
[Clickhouse column] user initialization of new library role
Are the two flame retardant standards of European furniture en 597-1 and en 597-2 the same?
Heap can also be regarded as a tree structure. It is specified that the root node must be greater than or less than the left and right child nodes, but the size order of the left and right child nodes
Zookepper===>动物管理员系统
Not eligible for getting processed by all beanpostprocessors
Mazhiqiang: research progress and application of speech recognition technology -- RTC dev Meetup
Display DIN 4102-1 Class B1 fire test requirements
PVC 塑料片BS 476-6 火焰传播性能测定
Installation (detailed illustration) and use of SVN
Matlab学习8-图像处理之线性与非线性锐化滤波、非线性平滑滤波
[programming development] markdown notes tutorial