本文链接: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的更多相关文章

  1. Win8 Metro(C#)数字图像处理--2.70修正后的阿尔法滤波器

    原文:Win8 Metro(C#)数字图像处理--2.70修正后的阿尔法滤波器 /// <summary> /// Alpha filter. /// </summary> / ...

  2. python数字图像处理(1):环境安装与配置

    一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...

  3. 初始----python数字图像处理--:环境安装与配置

    一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...

  4. c语言数字图像处理(八):噪声模型及均值滤波器

    图像退化/复原过程模型 高斯噪声 PDF(概率密度函数) 生成高斯随机数序列 算法可参考<http://www.doc.ic.ac.uk/~wl/papers/07/csur07dt.pdf&g ...

  5. Win8 Metro(C#)数字图像处理--3.1图像均值计算

    原文:Win8 Metro(C#)数字图像处理--3.1图像均值计算 /// <summary> /// Mean value computing. /// </summary> ...

  6. Win8 Metro(C#)数字图像处理--2.52图像K均值聚类

    原文:Win8 Metro(C#)数字图像处理--2.52图像K均值聚类  [函数名称]   图像KMeans聚类      KMeansCluster(WriteableBitmap src,i ...

  7. Win8Metro(C#)数字图像处理--2.9图像均值滤波

    原文:Win8Metro(C#)数字图像处理--2.9图像均值滤波  [函数名称] 图像均值滤波函数MeanFilterProcess(WriteableBitmap src) [函数代码]    ...

  8. python数字图像处理(五) 图像的退化和复原

    import cv2 import numpy as np import matplotlib.pyplot as plt import scipy import scipy.stats %matpl ...

  9. paper 108:系统学习数字图像处理之图像复原与重建

    首先,必须注意这里所限制的处理条件. 关于图像退化/复原模型 退化的图像是由成像系统的退化加上额外的噪声形成的. 1.只考虑噪声引起的退化 噪声模型,包含于空间不相关和相关两种,除了空间周期噪声,这里 ...

随机推荐

  1. 运维开发笔记整理-使用Django编写helloworld

    运维开发笔记整理-使用Django编写helloworld 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.   一.创建Django项目 1>.创建Django项目 djang ...

  2. 提速1000倍,预测延迟少于1ms,百度飞桨发布基于ERNIE的语义理解开发套件

    提速1000倍,预测延迟少于1ms,百度飞桨发布基于ERNIE的语义理解开发套件 11月5日,在『WAVE Summit+』2019 深度学习开发者秋季峰会上,百度对外发布基于 ERNIE 的语义理解 ...

  3. 团队第六次作业-Beta冲刺及发布说明

    1.相关信息 Q A 作业所属课程 https://edu.cnblogs.com/campus/xnsy/2019autumnsystemanalysisanddesign/ 作业要求 https: ...

  4. Luogu P1114 “非常男女”计划/Luogu P2697 宝石串

    Luogu P1114 "非常男女"计划/Luogu P2697 宝石串 (感觉我最近很爱做双倍经验的题啊) 使$d$等于第$i$个位置男生数(绿宝石数)减女生数(红宝石数)的差值 ...

  5. linux网络编程之posix条件变量

    今天来学习posix的最后一个相关知识----条件变量,言归正传. 下面用一个图来进一步描述条件变量的作用: 为什么呢? 这实际上可以解决生产者与消费者问题,而且对于缓冲区是无界的是一种比较理解的解决 ...

  6. Mybatis3.1-[tp_34-35]-_映射文件_select_resultMap关联查询_collection定义关联集合封装规则_collection分步查询_延迟加载

    笔记要点出错分析与总结工程组织 1.定义接口 interface DepartmentMapper package com.dao; import com.bean.Department; publi ...

  7. python常用内置方法

    常用内建函数# 如何在遍历一个列表的同时获取当前下标? # 普通人的做法 list = [1, 2, 3, 4, 5, 6] index = 0 for i in list: print('下标%s' ...

  8. 大数据之路week07--day04 (YARN,Hadoop的优化,combline,join思想,)

    hadoop 的计算特点:将计算任务向数据靠拢,而不是将数据向计算靠拢. 特点:数据本地化,减少网络io. 首先需要知道,hadoop数据本地化是指的map任务,reduce任务并不具备数据本地化特征 ...

  9. Android测试monkeyRunner

    monkeyrunner的官方文档: https://developer.android.com/studio/test/monkeyrunner monkeyrunner脚本可以执行截图操作 具体执 ...

  10. LoadRunner在Controller场景中配置获取Windows Resources

    一.首先需要在被监控Windows服务器端(只支持Windows)进行如下设置: 启动服务: Remote Procedure Call (RPC) RemoteRegistry 操作方法: 按Win ...