资源简介
国外大牛写的Retinex图像处理,可用于图像增强,去雾等应用。

代码片段和文件信息
#include “lum_retinex.h“
#include
#include
#include
namespace lum {
// timing helper
double get_s() {
using namespace std::chrono;
auto now = system_clock::now();
system_clock::duration tse = now.time_since_epoch();
return duration_cast(tse).count() / 1e9;
}
// Helper image processing routines
void log(const float* inimg float* outimg int sz) {
#ifdef USE_MKL
vsLn(sz inimg outimg);
#else
for (int i = 0; i < sz; ++i) {
float in = inimg[i];
outimg[i] = std::logf(inimg[i] + 0.00001);
}
#endif
}
void exp(const float* inimg float* outimg int sz) {
#ifdef USE_MKL
vsExp(sz inimg outimg);
#else
for (int i = 0; i < sz; ++i) {
outimg[i] = std::expf(inimg[i]);
}
#endif
}
void mean(const float* inimg float* outimg int outsz) {
for (int i = 0; i < outsz; ++i) {
outimg[i] = (inimg[i * 3] + inimg[i * 3 + 1] + inimg[i * 3 + 2]) / 3;
}
}
// helpers for image indices
class reflshadidx {
public:
reflshadidx(int w int h)
:m_w(w) m_h(h){}
int reflidx(int x int y) const {
return m_w * y + x;
}
int shadidx(int x int y) const {
return m_w * m_h + reflidx(x y);
}
private:
int m_w;
int m_h;
};
class imwrap {
public:
imwrap(const float* img int w int h)
:m_w(w) m_h(h) m_img(img){ }
float operator()(int x int y) const {
assert(x >= 0);
assert(y >= 0);
assert(x < m_w);
assert(y < m_h);
return m_img[m_w * y + x];
}
private:
const float* m_img;
int m_w;
int m_h;
};
// forward declaration of internal functions
void reflect_clamp(int w int h float* refl_in float* shading_in);
void preprocess(int w int h const float* img float* logimg);
void postprocess(int w int h float* refl_in float* shading_in float* refl_out float* shading_out);
Eigen::VectorXf makeB(float threshold const float* im int w int h);
using Triplet = Eigen::Triplet;
int nconstraints(int w int h) {
return w*h + 2 * w*(h - 1) + 2 * (w - 1) * h;
}
int nentries(int w int h) {
return 2 * (w*h + 2 * w*(h - 1) + 2 * (w - 1) * h);
}
std::vector makeTriplets(int w int h) {
reflshadidx I(w h);
printf(“Assemble matrix.\n“);
double assemble_start = get_s();
std::vector entries;
int cit = 0;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
if (x < w - 1) {
// dxR(r c) = -lR(r c) + lR(r c + 1)
entries.push_back(Triplet(cit I.reflidx(x y) -1));
entries.push_back(Triplet(cit I.reflidx(x + 1 y) +1));
cit++;
// dxS(r c) = -lS(r c) + lS(r c + 1)
entries.push_back(Triplet(cit I.shadidx(x y) -1));
entries.push_back(Triplet(cit I.shadidx(x + 1 y) +1));
cit++;
}
if (y < h - 1) {
entries.push_back(Triplet(cit I.reflidx(x y) -1));
entries.push_back(Triplet(cit I.reflidx(x y + 1) +1));
cit++;
entries.push_back(Triplet(cit I.shadidx(x y) -1));
entries
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-10-27 04:09 retinex-master\
文件 1296 2015-10-27 04:09 retinex-master\LICENSE.txt
文件 518 2015-10-27 04:09 retinex-master\README.md
目录 0 2015-10-27 04:09 retinex-master\img\
文件 186715 2015-10-27 04:09 retinex-master\img\input.jpg
文件 2558417 2015-10-27 04:09 retinex-master\img\input.ppm
文件 129119 2015-10-27 04:09 retinex-master\img\reflectance.jpg
文件 638417 2015-10-27 04:09 retinex-master\img\reflectance.ppm
文件 8611 2015-10-27 04:09 retinex-master\lum_retinex.cpp
文件 780 2015-10-27 04:09 retinex-master\lum_retinex.h
文件 734 2015-10-27 04:09 retinex-master\retinextest.cpp
相关资源
- 冈萨雷斯 数字图像处理 源代码(m文
- qt图像处理
- 血液图像处理—细胞识别
- VC数字图像处理课程设计
- 图像处理作业C 源代码
- SAR图像处理1
- Graphics Magic图像处理魔术师,含Delph
- 铝合金方波交流TIG焊熔池图像处理
- 基于图像处理的智能车寻迹算法设计
- 医学超声图像处理研究+哈尔滨工业大
- 友锋图像处理系统v3.rar(破解版
- 图像处理代码
- 图片-视频互换程序
- 基于图论的图像处理
- opencv视觉测距
- 北京交通大学-数字图像处理试卷+ 答
- 数字图像处理 王伟强 国科大 期末试
- 国科大图像处理作业王伟强老师.rar
- 国科大数字图像处理习题课重点
- 数字图像处理标准测试图片335张
- 哈尔滨工业大学深圳 数字图像处理
- 东南大学数字图像处理期末复习
- 2019国科大 王伟强 课程PPT+作业+中文翻
- 国科大图像处理期末考题2017(王伟强
- 数字图像处理课程设计 实验报告
- 国科大王伟强图像处理期末考试2018
- 国科大-图像处理与分析-2018期末试题
- 图像处理 分析与机器视觉 源码
- 图像处理及源码-5个可以使用包含源代
- 综合Canny法与小波变换的边缘检测方法
评论
共有 条评论