图像处理滤波器(五)——斑点滤波器(Speckle Removal Filter)
描述:斑点滤波器是本人自己翻译的,不是通俗叫法,您记住它叫Speckle Removal Filter 就可以了,它来自于Thomas R.Crimmins 的一篇文章“Geometric Filter for Speckle Reduction”中的"The 8-Hull Algorithm",这个算法主要应用于合成孔径雷达图像(synthetic aperture radar image)去减少斑点噪声(Speckle noise)。具体算法可以去看该处提到的文章我就不具体叙述,待会代码会很详细说明的。
Part of Codes:
/*** Takes a 2d array of grey level values and applies the* Crimmins Speckle Reduction algorithm to it for a * specified number of iterations.** @param image the input image* @param width of the input image* @param height of the input image* @param iterations to be applied* @return the new Crimminsed image*/public int [][] crimminsImage(int [][] image, int width,int height, int iterations){int [][] image2 = (int [][]) image.clone();for(int its=0;its<iterations;++its){for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && image[i-1][j]>image[i][j]+1){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width&& image2[i-1][j]>image2[i][j] && image2[i+1][j]>=image2[i][j]){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && i-1>=0&& image[i-1][j]>=image[i][j] && image[i+1][j]>image[i][j]){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && image2[i+1][j]>image2[i][j]+1){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && image[i-1][j]<image[i][j]-1){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width&& image2[i-1][j]<image2[i][j] && image2[i+1][j]<=image2[i][j]){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && i-1>=0&& image[i-1][j]<=image[i][j] && image[i+1][j]<image[i][j]){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && image2[i+1][j]<image2[i][j]-1){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j-1>=0 && image[i][j-1]>image[i][j]+1){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j-1>=0 && j+1<height&& image2[i][j-1]>image2[i][j] && image2[i][j+1]>=image2[i][j]){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j+1<height && j-1>=0&& image[i][j-1]>=image[i][j] && image[i][j+1]>image[i][j]){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j+1<height && image2[i][j+1]>image2[i][j]+1){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j-1>=0 && image[i][j-1]<image[i][j]-1){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j-1>=0 && j+1<height&& image2[i][j-1]<image2[i][j] && image2[i][j+1]<=image2[i][j]){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j+1<height && j-1>=0&& image[i][j-1]<=image[i][j] && image[i][j+1]<image[i][j]){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(j+1<height && image2[i][j+1]<image2[i][j]-1){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && j-1>=0&& image[i+1][j-1]>image[i][j]+1){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image2[i+1][j-1]>image2[i][j]&& image2[i-1][j+1]>=image2[i][j]){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image[i+1][j-1]>=image[i][j]&& image[i-1][j+1]>image[i][j]){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && j+1<height&& image2[i-1][j+1]>image2[i][j]+1){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && j-1>=0&& image[i+1][j-1]<image[i][j]-1){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image2[i+1][j-1]<image2[i][j]&& image2[i-1][j+1]<=image2[i][j]){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image[i+1][j-1]<=image[i][j]&& image[i-1][j+1]<image[i][j]){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && j+1<height&& image2[i-1][j+1]<image2[i][j]-1){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && j+1<height&& image[i+1][j+1]>image[i][j]+1){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image2[i+1][j+1]>image2[i][j]&& image2[i-1][j-1]>=image2[i][j]){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image[i+1][j+1]>=image[i][j]&& image[i-1][j-1]>image[i][j]){image2[i][j] = image[i][j] +1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && j-1>=0&& image2[i-1][j-1]>image2[i][j]+1){image[i][j] = image2[i][j] +1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i+1<width && j+1<height&& image[i+1][j+1]<image[i][j]-1){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image2[i+1][j+1]<image2[i][j]&& image2[i-1][j-1]<=image2[i][j]){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && i+1<width && j-1>=0 && j+1<height&& image[i+1][j+1]<=image[i][j]&& image[i-1][j-1]<image[i][j]){image2[i][j] = image[i][j] -1;}else image2[i][j] = image[i][j];}}for(int j=0;j<height;++j){for(int i=0;i<width;++i){if(i-1>=0 && j-1>=0&& image2[i-1][j-1]<image2[i][j]-1){image[i][j] = image2[i][j] -1;}else image[i][j] = image2[i][j];}}}return image;}
/*** Takes a 2d image and applies Crimmins to it.** @param input the input image* @param width of the input image* @param height of the input image* @param iterations to be applied* @return the new image*/public int [][] crimmins(int [][] input, int width, int height,int iterations){int [][] output = new int [width][height];for(int j=0;j<height;++j){for(int i=0;i<width;++i){input[i][j] = (new Color(input[i][j])).getRed();}}output = crimminsImage(input,width,height,iterations);return output;}
Input Image:
Output Image :
一次迭代效果:
四次迭代效果:
八次迭代效果:
总结:本算法主要应用于处理椒盐噪声上,本算法在处理椒盐噪声的同时也相应的模糊了图像的细节,而且迭代次数越多,图像细节也越来越模糊。
图像处理滤波器(五)——斑点滤波器(Speckle Removal Filter)相关推荐
- 数字图像处理第五次作业——频域滤波器
目 录 一.基本概念及原理 1. 理想低通滤波器: 2. 巴特沃斯低通滤波器: 3. 高斯低通滤波器: 4. 高通滤波器: 5. 拉普拉斯高通滤波器: 6. Unmask高通滤波器: 二.实现过程和结 ...
- [Python图像处理] 使用LPF/Notch滤波器执行图像去噪
使用LPF/Notch滤波器执行图像去噪 0. 前言 1. 使用 Notch 滤波器去除图像周期性噪声 2. 使用高斯滤波器去除椒盐噪声 相关链接 0. 前言 在本节中,我们将学习如何使用频域滤波器( ...
- Win8 Metro(C#)数字图像处理--2.69中点滤波器
原文:Win8 Metro(C#)数字图像处理--2.69中点滤波器 [函数代码] <strong> /// <summary>/// Mid-point filter./// ...
- opencv图像处理几种常见滤波器实现
文章目录 一.算术均值滤波器 代码实现 二.集合均值滤波器 代码实现 三.逆谐波均值滤波器 代码实现 四.中职滤波器 代码实现 五.最大值滤波器 代码实现 六.最小值滤波器 代码实现 七.中点滤波器 ...
- 五.卡尔曼滤波器(EKF)开发实践之五: 编写自己的EKF替换robot_pose_ekf中EKF滤波器
本系列文章主要介绍如何在工程实践中使用卡尔曼滤波器,分七个小节介绍: 一.卡尔曼滤波器开发实践之一: 五大公式 二.卡尔曼滤波器开发实践之二: 一个简单的位置估计卡尔曼滤波器 三.卡尔曼滤波器(EK ...
- Digital Image processing 数字图像处理最佳陷波滤波器设计(频域)
最佳陷波滤波器(傅里叶变换,matlab实现) 1基本概念 1.1频域滤波步骤小结 在频域中的滤波是简单明了的.它包含如下步骤: (1)给定一幅大小为MN的输入图像f(x,y),选择填充参数P,Q,典 ...
- OpenCV与图像处理学习五——图像滤波与增强:线性、非线性滤波、直方图均衡化与Gamma变换
OpenCV与图像处理学习五--图像滤波与增强:线性.非线性滤波.直方图均衡化与Gamma变换 三.图像滤波与增强 3.1 线性滤波 3.1.1 方框滤波 3.1.2 均值滤波 3.1.3 高斯滤波 ...
- 数字图像处理——第五章 图像复原与重建
数字图像处理--第五章 图像复原与重建 文章目录 数字图像处理--第五章 图像复原与重建 写在前面 1 图像退化/复原过程的模型 2 噪声模型 2.1 高斯噪声 2.2 椒盐噪声 3 仅有噪声的复原- ...
- Udacity机器人软件工程师课程笔记(三十二) - 卡尔曼滤波器 - 一维卡尔曼滤波器 - 多维卡尔曼滤波器 - 拓展卡尔曼滤波器(EKF)
卡尔曼滤波器 一.概述 二.一维高斯分布 均值和方差 三.一维卡尔曼滤波器 变量命名约定 卡尔曼滤波循环 1.测量值更新 (1)平均值计算 (2)程序实现 2.位置预测 位置预测公式 3.一维卡尔曼滤 ...
最新文章
- centos7快速搭建LAMP
- windows cmd命令行中 查看 修改 删除与添加环境变量
- mybatis-spring整合jar包功能
- TCP穿透NAT的C++版
- 中断原理在计算机中的应用,最新 计算机原理与应用 复习3-判断题
- 【大型网站运维之道 天道 人道 运维之道】
- 【探索PowerShell 】【十二】筛选器 - Filters
- 数据中心操作人员:艰难地在针对VM构建的基础设施上运行容器
- 【转】Android 中的 Service 全面总结
- C++ 4 C++变量及作用域
- 电脑无线网络显示红叉_Maxidix Wifi Suite下载_无线网络管理软件中文版v14.5.8
- Matlab视频系列教程-小木讲matlab-前12讲
- 卸载 vista sp1
- eplan mysql_EPLAN 部署SQL部件库安装详解
- win10重装系统后部分电脑无法调节亮度问题
- React项目中请求跨域解决方法
- 【Excel】用公式提取Excel单元格中的汉字
- C# 判断有向图是否存在环
- SRAM FPGA控制,实际产品拷机测试过
- 企业工商信息查询API开发文档