资源简介
本程序为C语言编写的基于小波变换的图像去噪程序的源代码,运行速度快,去噪效果还不错,相比其他传统的图像去噪效果要好很多,对于初学小波变换图像去噪的人非常有帮助。
代码片段和文件信息
/*
* Wavelet denoise GIMP plugin
*
* colorspace.c
* Copyright 2008 by Marco Rossini
*
* Implements the wavelet denoise code of UFRaw by Udi Fuchs
* which itself bases on the code by Dave Coffin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
*/
#include “plugin.h“
void
srgb2ycbcr (float ** fimg int size)
{
/* using JPEG conversion here - expecting all channels to be
* in [0:255] range */
int i;
float y cb cr;
for (i = 0; i < size; i++) {
y = 0.2990 * fimg[0][i] + 0.5870 * fimg[1][i] + 0.1140 * fimg[2][i];
cb = -0.1687 * fimg[0][i] - 0.3313 * fimg[1][i] + 0.5000 * fimg[2][i]
+ 0.5;
cr = 0.5000 * fimg[0][i] - 0.4187 * fimg[1][i] - 0.0813 * fimg[2][i]
+ 0.5;
fimg[0][i] = y;
fimg[1][i] = cb;
fimg[2][i] = cr;
}
}
void
ycbcr2srgb (float **fimg int size int pc)
{
/* using JPEG conversion here - expecting all channels to be
* in [0:255] range */
int i;
static float r g b;
if (pc > 3) { /* single channel colour */
pc -= 4;
for (i = 0; i < size; i++) {
fimg[(pc + 1) % 3][i] = 0.5;
fimg[(pc + 2) % 3][i] = 0.5;
}
} else if (pc > 0) { /* single channel gray */
pc -= 1;
for (i = 0; i < size; i++) {
fimg[(pc + 1) % 3][i] = fimg[pc][i];
fimg[(pc + 2) % 3][i] = fimg[pc][i];
}
return;
}
for (i = 0; i < size; i++) {
r = fimg[0][i] + 1.40200 * (fimg[2][i] - 0.5);
g = fimg[0][i] - 0.34414 * (fimg[1][i] - 0.5)
- 0.71414 * (fimg[2][i] - 0.5);
b = fimg[0][i] + 1.77200 * (fimg[1][i] - 0.5);
fimg[0][i] = r;
fimg[1][i] = g;
fimg[2][i] = b;
}
}
void
srgb2xyz (float **fimg int size)
{
/* fimg in [0:1] sRGB */
int i;
float x y z;
for (i = 0; i < size; i++) {
/* scaling and gamma correction (approximate) */
fimg[0][i] = pow(fimg[0][i] 2.2);
fimg[1][i] = pow(fimg[1][i] 2.2);
fimg[2][i] = pow(fimg[2][i] 2.2);
/* matrix RGB -> XYZ with D65 reference white (www.brucelindbloom.com) */
x = 0.412424 * fimg[0][i] + 0.357579 * fimg[1][i] + 0.180464 * fimg[2][i];
y = 0.212656 * fimg[0][i] + 0.715158 * fimg[1][i] + 0.0721856 * fimg[2][i];
z = 0.0193324 * fimg[0][i] + 0.119193 * fimg[1][i] + 0.950444 * fimg[2][i];
/*
x = 0.412424 * fimg[0][i] + 0.212656 * fimg[1][i] + 0.0193324 * fimg[2][i];
y = 0.357579 * fimg[0][i] + 0.715158 * fimg[1][i] + 0.119193 * fimg[2][i];
z = 0.180464 * fimg[0][i] + 0.0721856 * fimg[1][i] + 0.950444 * fimg[2][i];
*/
fimg[0][i] = x;
fimg[1][i] = y;
fimg[2][i] = z;
}
}
void
xyz2srgb (float **fimg int size int pc)
{
int i;
float r g b;
if (pc > 3) { /* single channel colour */
pc -= 4;
for (i = 0; i < size; i++) {
fimg[(pc + 1) % 3][i] = 0.0;
fimg[(pc + 2) % 3][i] = 0.0;
}
} else if (pc > 0) { /* single channel
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-05-06 12:11 wavelet-denoise-master\
文件 328 2013-05-06 12:11 wavelet-denoise-master\AUTHORS
文件 17992 2013-05-06 12:11 wavelet-denoise-master\COPYING
文件 2540 2013-05-06 12:11 wavelet-denoise-master\ChangeLog
文件 371 2013-05-06 12:11 wavelet-denoise-master\INSTALL
文件 481 2013-05-06 12:11 wavelet-denoise-master\Makefile
文件 2153 2013-05-06 12:11 wavelet-denoise-master\README
文件 402 2013-05-06 12:11 wavelet-denoise-master\THANKS
文件 450 2013-05-06 12:11 wavelet-denoise-master\TRANSLATIONS
目录 0 2013-05-06 12:11 wavelet-denoise-master\po\
文件 1125 2013-05-06 12:11 wavelet-denoise-master\po\Makefile
文件 6329 2013-05-06 12:11 wavelet-denoise-master\po\de.po
文件 5884 2013-05-06 12:11 wavelet-denoise-master\po\et.po
文件 6632 2013-05-06 12:11 wavelet-denoise-master\po\it.po
文件 5839 2013-05-06 12:11 wavelet-denoise-master\po\pl.po
文件 7708 2013-05-06 12:11 wavelet-denoise-master\po\ru.po
目录 0 2013-05-06 12:11 wavelet-denoise-master\src\
文件 792 2013-05-06 12:11 wavelet-denoise-master\src\Makefile
文件 7444 2013-05-06 12:11 wavelet-denoise-master\src\colorspace.c
文件 6310 2013-05-06 12:11 wavelet-denoise-master\src\denoise.c
文件 4942 2013-05-06 12:11 wavelet-denoise-master\src\events.c
文件 16313 2013-05-06 12:11 wavelet-denoise-master\src\interface.c
文件 1187 2013-05-06 12:11 wavelet-denoise-master\src\interface.h
文件 2769 2013-05-06 12:11 wavelet-denoise-master\src\messages.h
文件 3976 2013-05-06 12:11 wavelet-denoise-master\src\plugin.c
文件 2844 2013-05-06 12:11 wavelet-denoise-master\src\plugin.h
文件 4398 2013-05-06 12:11 wavelet-denoise-master\src\wavelet.c
- 上一篇:C++程序设计语言A视频教程 全12讲 地址
- 下一篇:决策树实现算法C语言编写
相关资源
- 决策树实现算法C语言编写
- c语言 链表排序--
- C语言版贪吃蛇设计思路及源代码
- 动态分区分配方式模拟c语言
- 浙江大学C程题库
- 学生系统C语言成绩排名
- 背包问题C语言实现, 动态规划
- linux命令c语言自己实现大概40来个
- c语言实现的动态规划求最短路径长度
- 数字图像处理 印前输出 rip 数字加
- C语言双语词汇对照表
- C语言-遗传算法的排课源码
- C语言模拟路由DV算法
- 用c语言写的OBB旋转及碰撞检测源代码
- 用C语言编写的usb自动识别程序
- 基于51单片机的12864液晶显示C语言源程
- 分治法求格雷码的C语言代码
- C语言C++魔兽全图源码
- linux环境下C语言编程指南 源代码
- 上传的p2p技术C语言源码
- 连连看C语言小游戏开发源代码
- 磁盘调度算法(c语言)44989
- 音乐跑马灯C语言程序
- bpsk的C语言代码
- 用回溯法解决01背包问题C语言实现
- Linux GTK 聊天室 MySql C语言聊天室
- 单片机流水灯C语言
- C语言版本的DES加密解密算法代码!(
- 连连看 C语言 源代码
- spath(A*算法的C语言源代码)
评论
共有 条评论