当前位置:网站首页>Matlab learning 9- nonlinear sharpening filter for image processing

Matlab learning 9- nonlinear sharpening filter for image processing

2022-06-11 08:50: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


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 9- Nonlinear sharpening filter for image processing
Prewitt operator 、Sobel operator 、Log operator

One 、Prewitt operator

effect
 Insert picture description here

Code

% prewitt operator 
img=imread("img/lena.bmp");
subplot(3,2,2),imshow(img),xlabel(" original image ");

MaskPrewittV=fspecial("prewitt");
MaskPrewittH=MaskPrewittV';

KB1=filter2(MaskPrewittH,img);
subplot(3,2,4),imshow(uint8(KB1)),xlabel(" Horizontal template filter image ");
subplot(3,2,5),imshow(uint8(double(img)+KB1)),xlabel(" Horizontal template filtering addition superimposed image ");
subplot(3,2,6),imshow(uint8(double(img)-KB1)),xlabel(" Horizontal template filtering subtraction superimposed image ");

Two 、Sobel operator

effect
 Insert picture description here

Code

% sobel operator 
img=imread("img/liftingbody.png");
subplot(3,3,2),imshow(img),xlabel(" original image ");

MaskPrewittV=fspecial("sobel");
MaskPrewittH=MaskPrewittV';

KB1=filter2(MaskPrewittH,img);
subplot(3,3,4),imshow(uint8(KB1)),xlabel(" Horizontal template filter image ");
subplot(3,3,5),imshow(uint8(double(img)+KB1)),xlabel(" Horizontal template filtering addition superimposed image ");
subplot(3,3,6),imshow(uint8(double(img)-KB1)),xlabel(" Horizontal template filtering subtraction superimposed image ");

KB2=filter2(MaskPrewittV,img);
subplot(3,3,7),imshow(uint8(KB2)),xlabel(" Vertical template filter image ");
subplot(3,3,8),imshow(uint8(double(img)+KB2)),xlabel(" Vertical template filtering addition superimposed image ");
subplot(3,3,9),imshow(uint8(double(img)-KB2)),xlabel(" Vertical template filtering subtraction superimposed image ");

3、 ... and 、Log operator

effect  Insert picture description here
Code

% log operator 
img=imread("img/liftingbody.png");
subplot(2,2,1),imshow(img),xlabel(" original image ");

MaskLog=fspecial("log");
KB=filter2(MaskLog,img);
subplot(2,2,2),imshow(uint8(KB)),xlabel("LOG Operator filtered image ");
subplot(2,2,3),imshow(uint8(double(img)+KB)),xlabel(" Filter add overlay image ");
subplot(2,2,4),imshow(uint8(double(img)-KB)),xlabel(" Filter subtraction superimposed image ");

Click to get the source code
https://gitee.com/CYFreud/matlab/tree/master/image_processing/demo9_220502

原网站

版权声明
本文为[CHengYuP]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110832015972.html