资源简介
实现默认设置下的BM3D去噪算法,为简单起见,图像用PS转成纯数据的RAW格式
代码片段和文件信息
#include
#include
#include
#include
#define BlockSize1 8
#define BlockSize2 8
#define BlockStep1 3
#define BlockStep2 3
#define BlockSearch1 19
#define BlockSearch2 19
#define BlockMatch1 16
#define BlockMatch2 32
#define Threshold1 2500
#define Threshold2 400
#define Lemda1_3D 2.7//注意使用时要乘上噪声标准差
#define BetaHt 2.0
#define BetaWie 2.0
#define Width 256
#define Height 256
#define NoiseStadard 25.0
#define fillen_haar 2
#define fillen_bior 10
#define M_PI 3.1415926
///////////////////////////////////
static double KDCT[8][8];
static double KIDCT[8][8];
void DCTInit()
{
int ij;
double c0c1;
c0=1/sqrt(8.0);
c1=c0*sqrt(2.0);
for(i=0;i<8;i++)
for(j=0;j<8;j++)
KDCT[i][j]=cos((2*j+1)*i*M_PI/16.0);
//Normalization
for(i=0;i<8;i++)
if(i==0)
for(j=0;j<8;j++)
KDCT[i][j]*=c0;
else
for(j=0;j<8;j++)
KDCT[i][j]*=c1;
for(i=0;i<8;i++)
for(j=0;j<8;j++)
KIDCT[i][j]=KDCT[j][i];
}
void DCT1D(double * x)//routine to perform 8 point 1-D DCT
{
int ij;
double y[8];//temp array
double t;
for(i=0;i<8;i++)
{
t=0.0;
for(j=0;j<8;j++)
t+=x[j]*KDCT[i][j];
y[i]=t;
}
for(i=0;i<8;i++)
x[i]=y[i];
}
void DCT2D(double * x)//routine to perform 8*8 point 2-D DCT
{
int ij;
double y[8];
//first row direction
for(i=0;i<8;i++)
DCT1D(x+8*i);
//then column direction
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
y[j]=*(x+8*j+i);
DCT1D(y);
for(j=0;j<8;j++)
*(x+8*j+i)=y[j];
}
}
void IDCT1D(double * x)//routine to perform 8 point 1-D Inverse DCT
{
int ij;
double y[8];//temp array
double t;
for(i=0;i<8;i++)
{
t=0.0;
for(j=0;j<8;j++)
t+=x[j]*KIDCT[i][j];
y[i]=t;
}
for(i=0;i<8;i++)
x[i]=y[i];
}
void IDCT2D(double * x)//routine to perform 8*8 point 2-D Inverse DCT
{
int ij;
double y[8];
//first row direction
for(i=0;i<8;i++)
IDCT1D(x+8*i);
//then column direction
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
y[j]=*(x+8*j+i);
IDCT1D(y);
for(j=0;j<8;j++)
*(x+8*j+i)=y[j];
}
}
///////////////////////////////////////////////
struct Trans_2D
{
double Trans[BlockSize1][BlockSize1];
};
struct ValueWeight
{
double SumValue;
double SumWeight;
};
struct Index
{
int IndexH;
int IndexW;
};
///////////////////////////////////////
double WSExt(double * xint nint N)
{
int P=2*(N-1);
if(n<0)
while(n<0)
n+=P;
else
if(n>=P)
while(n>=P)
n-=P;
if(n>=N)
return x[P-n];
else
return x[n];
}
double WAExt(double * xint nint N)
{
int P=2*N;
if(n<0)
while(n<0)
n+=P;
else
if(n>=P)
while(n>=P)
n-=P;
if(n>=N)
if(n==P-1)
return 0;
else
return -x[P-2-n];
else
return x[n];
}
double HSExt(double * xint nint N)
{
相关资源
- 操作系统c语言模拟文件管理系统844
- C语言开发实战宝典
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
- 尚观培训linux许巍老师关于c语言的课
评论
共有 条评论