数字图像处理--算术、几何、谐波、逆谐波均值滤波器Matlab
本文链接:https://blog.csdn.net/Dooonald/article/details/78545461
算术均值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
resultImage(x,y)=sum(is(:))/numel(is);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3算术均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
resultImage(x,y)=sum(is(:))/numel(is);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5算术均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
resultImage(x,y)=sum(is(:))/numel(is);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9算术均值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
几何均值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
resultImage(x,y)=prod(prod(is(:)))^(1/numel(is));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3几何均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
resultImage(x,y)=prod(prod(is(:)))^(1/numel(is));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5几何均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
resultImage(x,y)=prod(prod(is(:)))^(1/numel(is));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9几何均值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
谐波均值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
is=1./is;
resultImage(x,y)=numel(is)/sum(is(:));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3谐波均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
is=1./is;
resultImage(x,y)=numel(is)/sum(is(:));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5谐波均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
is=1./is;
resultImage(x,y)=numel(is)/sum(is(:));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9谐波均值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
逆谐波
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
Q1 = 1.5;
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
resultImage(x,y) = sum(is(:).^(Q1+1))/sum(is(:).^(Q1));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3逆谐波均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
resultImage(x,y) = sum(is(:).^(Q1+1))/sum(is(:).^(Q1));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5逆谐波均值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
resultImage(x,y) = sum(is(:).^(Q1+1))/sum(is(:).^(Q1));
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9逆谐波均值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
中值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
temp = sort(is(:));
resultImage(x,y)= temp((numel(temp)-1)/2);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3中值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
temp = sort(is(:));
resultImage(x,y)= temp((numel(temp)-1)/2);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5中值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
temp = sort(is(:));
resultImage(x,y)= temp((numel(temp)-1)/2);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9中值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
最大值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
temp = is(:);
resultImage(x,y)= max(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3最大值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
temp = is(:);
resultImage(x,y)= max(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5最大值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
temp = is(:);
resultImage(x,y)= max(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9最大值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
最小值
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
temp = is(:);
resultImage(x,y)= min(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3最小值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
temp = is(:);
resultImage(x,y)= min(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5最小值');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
temp = is(:);
resultImage(x,y)= min(temp);
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9最小值');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
中点
close all
clear all
f=imread('D:/testData/filtering.tif');
[w,h]=size(f);
image= f(:,:);
fsize1=3;
fsize2=5;
fsize3=9;
fssize1=(fsize1-1)/2;
fssize2=(fsize2-1)/2;
fssize3=(fsize3-1)/2;
figure();
subplot(1,2,1);
imshow(image);
xlabel('原图像');
resultImage = image;
for x=1+fssize1:1:w-fssize1
for y=1+fssize1:1:w-fssize1
is=f(x-fssize1:1:x+fssize1,y-fssize1:1:y+fssize1);
temp = is(:);
resultImage(x,y)= (max(temp) + min(temp))/2;
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('3*3中点');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize2:1:w-fssize2
for y=1+fssize2:1:w-fssize2
%遍历每个点的四周
is=f(x-fssize2:1:x+fssize2,y-fssize2:1:y+fssize2);
temp = is(:);
resultImage(x,y)= (max(temp) + min(temp))/2;
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('5*5中点');
resultImage= f(:,:);
figure();
subplot(1,2,1);
imshow(f);
xlabel('原图像');
for x=1+fssize3:1:w-fssize3
for y=1+fssize3:1:w-fssize3
%遍历每个点的四周
is=f(x-fssize3:1:x+fssize3,y-fssize3:1:y+fssize3);
temp = is(:);
resultImage(x,y)= (max(temp) + min(temp))/2;
end
end
subplot(1,2,2);
imshow(resultImage);
xlabel('9*9中点');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
数字图像处理--算术、几何、谐波、逆谐波均值滤波器Matlab的更多相关文章
- Win8 Metro(C#)数字图像处理--2.70修正后的阿尔法滤波器
原文:Win8 Metro(C#)数字图像处理--2.70修正后的阿尔法滤波器 /// <summary> /// Alpha filter. /// </summary> / ...
- python数字图像处理(1):环境安装与配置
一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...
- 初始----python数字图像处理--:环境安装与配置
一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...
- c语言数字图像处理(八):噪声模型及均值滤波器
图像退化/复原过程模型 高斯噪声 PDF(概率密度函数) 生成高斯随机数序列 算法可参考<http://www.doc.ic.ac.uk/~wl/papers/07/csur07dt.pdf&g ...
- Win8 Metro(C#)数字图像处理--3.1图像均值计算
原文:Win8 Metro(C#)数字图像处理--3.1图像均值计算 /// <summary> /// Mean value computing. /// </summary> ...
- Win8 Metro(C#)数字图像处理--2.52图像K均值聚类
原文:Win8 Metro(C#)数字图像处理--2.52图像K均值聚类 [函数名称] 图像KMeans聚类 KMeansCluster(WriteableBitmap src,i ...
- Win8Metro(C#)数字图像处理--2.9图像均值滤波
原文:Win8Metro(C#)数字图像处理--2.9图像均值滤波 [函数名称] 图像均值滤波函数MeanFilterProcess(WriteableBitmap src) [函数代码] ...
- python数字图像处理(五) 图像的退化和复原
import cv2 import numpy as np import matplotlib.pyplot as plt import scipy import scipy.stats %matpl ...
- paper 108:系统学习数字图像处理之图像复原与重建
首先,必须注意这里所限制的处理条件. 关于图像退化/复原模型 退化的图像是由成像系统的退化加上额外的噪声形成的. 1.只考虑噪声引起的退化 噪声模型,包含于空间不相关和相关两种,除了空间周期噪声,这里 ...
随机推荐
- 前端框架开始学习Vue(一)
MVVM开发思想图(图片可能会被缩小,请右键另存查看,图片来源于网络) 定义基本Vue代码结构 1 v-text,v-cloak,v-html命令 默认 v-text没有闪烁问题,但是会覆盖元 ...
- c# 克隆来创建对象副本
- 团队高效率协作开发的秘密武器-APIDOC
团队高效率协作开发的秘密武器 1.前言 在团队协作开发中,不知道各位有没有遇到这样的问题: l 新人接手了项目代码,因没有项目文档,只能靠追踪路由,寻读代码分析业务逻辑 l 前端同学写好了页面,苦等后 ...
- Vue + Springboot 开发的简单的用户管理系统
后台接口如下: 页面如下: 1. 主页,显示所有的用户信息 2. 点击详情,看到某个id的用户的详细信息 3. 点击编辑按钮,跳转到的详细的编辑(更新)页面 4. 添加用户页面 对应的vue代码如下 ...
- Go 性能分析之案例一
思考 相信大家在实际的项目开发中会遇到这么一个事,有的程序员写的代码不仅bug少,而且性能高:而有的程序员写的代码能否流畅的跑起来,都是一个很大问题.而我们今天要讨论的就是一个关于性能优化的案例分析. ...
- Python笔记(30)-----logger
转自: https://www.jb51.net/article/139080.htm logging模块介绍 Python的logging模块提供了通用的日志系统,熟练使用logging模块可以方便 ...
- 胡搞-强化版的light oj-1055-的思路-AI版的6重暴力For循环的BFS
新题目大意: 三个棋子按照先后顺序,可以随意方向合法地走到空位置上(而不是像原题light oj-1055中的一样三个棋子每次走的方向都一致),当三个棋子全部走进目标地点,就结束:求需要指挥的最少次数 ...
- 【Java】debug初级使用(Eclipse)
1.设置.取消断点 双击要设置断点的代码行数字的前面 2.切换成Debug界面 就会发现画面变成了下图这样 以下是调试的界面解说(图源百度) 3.切换为原界面
- Oracle LOB 大对象处理
LOB类型列主要是用来存储大量数据的数据库字段,最大可以存储4G字节的非结构化数据. 一.LOB数据类型分类 1.按存储数据的类型分: ①字符类型: CLOB:存储大量 单字节 字符数据. N ...
- easyUI--入门实例
ui框架 1.需要导入的所有jar包,以及外部的类或文件 1.1导入jar包 1.2导入WebContent外部资源 1.3导入所有需要的辅助类--Util包 2.实例代码 2.1创建TreeNode ...