Retinex系列之Frankle-McCann Retinex 分类: Matlab 图像处理 2014-12-01 21:52 538人阅读 评论(2) 收藏
一、Frankle-McCann Retinex
Frankle-McCann算法选择一条螺旋结构的路径用于像素间的比较。如下图,算法沿着螺旋路径选取用于比较
像素点,这种路径选择包含了整个图像的全局明暗关系。并且越靠近预测中心点选取的点数越多,因为靠的
近的像素点与中心像素点的相关性要比远处的高。
此迭代方案基于成对像素亮度值间的互动,这一像素对在图像中的坐标(x,y)、(xs,ys)。第一步处理的像素被
预定义的距离D分开,下一步将比较方向顺时针旋转90度,距离D减半,直至到达单位像素距离。每一步计
算中迭代次数nIterator由用户决定。每次迭代有四个步操作:比例(ratio)、乘积(product)、重置(reset)、平
均(average)。
设OP为上一步迭代的乘积;NP为当前迭代的乘积;IP为中间乘积结果;R为原始图像;符号*表示重置操作。
实验证明几何平均效果好于算术平均,则每步迭代使用如下公式估计点处的明度值:
放在对数域:
变量初始化:
OP中的所有像素值初始化为输入图像中的最大亮度值;
初始距离设为2的指数,指数部分小于输入图像的长、宽,即:
;
迭代次数nIterator一般设为4;
二、Matlab实现
function Test()
ImOriginal=imread('fig5.tif');
[m,n,z] = size(ImOriginal);
ImOut = zeros(m,n,z);
for i = 1:z
ImChannel = log(double(ImOriginal(:,:,i))+eps);
ImOut(:,:,i)=retinex_frankle_mccann(ImChannel,4);
ImOut(:,:,i)=exp(ImOut(:,:,i));
a=min(min(ImOut(:,:,i)));
b=max(max(ImOut(:,:,i)));
ImOut(:,:,i)=((ImOut(:,:,i)-a)/(b-a))*255;
end
ImOut=uint8(ImOut);
figure(1);
imshow(ImOriginal);
figure(2);
imshow(ImOut);
imwrite(ImOut,'tt.tif'); function Retinex = retinex_frankle_mccann(L, nIterations)
global RR IP OP NP Maximum
RR = L;
Maximum = max(L(:)); % maximum color value in the image
[nrows, ncols] = size(L); shift = 2^(fix(log2(min(nrows, ncols)))-1); % initial shift
OP = Maximum*ones(nrows, ncols); % initialize Old Product while (abs(shift) >= 1)
for i = 1:nIterations
CompareWith(0, shift); % horizontal step
CompareWith(shift, 0); % vertical step
end
shift = -shift/2; % update the shift
end
Retinex = NP; function CompareWith(s_row, s_col)
global RR IP OP NP Maximum
IP = OP;
if (s_row + s_col > 0)
IP((s_row+1):end, (s_col+1):end) = OP(1:(end-s_row), 1:(end-s_col)) + ...
RR((s_row+1):end, (s_col+1):end) - RR(1:(end-s_row), 1:(end-s_col));
else
IP(1:(end+s_row), 1:(end+s_col)) = OP((1-s_row):end, (1-s_col):end) + ...
RR(1:(end+s_row),1:(end+s_col)) - RR((1-s_row):end, (1-s_col):end);
end
IP(IP > Maximum) = Maximum; % The Reset operation
NP = (IP + OP)/2; % average with the previous Old Product
OP = NP; % get ready for the next comparison
测试结果:
注:输出时只是简单的进行线性拉伸,使得灰度值落在[0-255],没有使用更好调整方法
参考:
http://www.cnblogs.com/Imageshop/archive/2013/04/18/3029352.html
http://www.cnblogs.com/sleepwalker/p/3676600.html
http://yh-zhao0217.blog.sohu.com/169200160.html
http://www.cs.sfu.ca/~colour/publications/IST-2000/
[1]Land, Edwin and McCann,John, “Lightness and Retinex Theory”, Journal of the Optical Society ofAmerica, 61(1),January 1971.
[2] Brian Funt, FlorianCiurea, and John McCann "Retinex in Matlab," Proceedings of the IS&T/SIDEighth Color Imaging Conference: Color Science, Systems and Applications, 2000.
[3] Frankle,Jonathan and McCann, John, “Method and Apparatus for Lightness Imaging”, USPatent #4,384,336, May 17, 1983.
版权声明:本文为博主原创文章,未经博主允许不得转载。
Retinex系列之Frankle-McCann Retinex 分类: Matlab 图像处理 2014-12-01 21:52 538人阅读 评论(2) 收藏的更多相关文章
- Hiking 分类: 比赛 HDU 函数 2015-08-09 21:24 3人阅读 评论(0) 收藏
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Subm ...
- Elevator 分类: HDU 2015-06-19 21:52 13人阅读 评论(0) 收藏
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- android开发之调试技巧 分类: android 学习笔记 2015-07-18 21:30 140人阅读 评论(0) 收藏
我们都知道,android的调试打了断点之后运行时要使用debug as->android application 但是这样的运行效率非常低,那么我们有没有快速的方法呢? 当然有. 我们打完断点 ...
- UI基础:UIButton.UIimage 分类: iOS学习-UI 2015-07-01 21:39 85人阅读 评论(0) 收藏
UIButton是ios中用来响应用户点击事件的控件.继承自UIControl 1.创建控件 UIButton *button=[UIButton buttonWithType:UIButtonTyp ...
- UI基础:UITextField 分类: iOS学习-UI 2015-07-01 21:07 68人阅读 评论(0) 收藏
UITextField 继承自UIControl,他是在UILabel基础上,对了文本的编辑.可以允许用户输入和编辑文本 UITextField的使用步骤 1.创建控件 UITextField *te ...
- 前端知识概述----公司内部的一次分享 分类: JavaScript HTML+CSS 2015-04-16 21:24 2593人阅读 评论(2) 收藏
因为公司内部一个纯后端团队要做一些适合自己团队的web页面,所以就有了这次分享.知识都是很基础,有的知识也只是做了解简单介绍.主要是想让大家对前端有一个基本的了解.现在做一个总结.欢迎大家拍砖. 知识 ...
- 架构师速成5.1-小学gtd进阶 分类: 架构师速成 2015-06-26 21:17 313人阅读 评论(0) 收藏
人生没有理想,那和咸鱼有什么区别. 有了理想如何去实现,这就是gtd需要解决的问题.简单说一下gtd怎么做? 确定你的目标,如果不能确定长期目标,至少需要一个2年到3年的目标. 目标必须是可以衡量的, ...
- Matlab实现图像分割 分类: 图像处理 2014-06-14 21:31 662人阅读 评论(1) 收藏
下面使用极小值点阈值选取方法,编写MATLAB程序实现图像分割的功能. 极小值点阈值选取法即从原图像的直方图的包络线中选取出极小值点, 并以极小值点为阈值将图像转为二值图像 clear all; cl ...
- NYOJ-289 苹果 289 AC(01背包) 分类: NYOJ 2014-01-01 21:30 178人阅读 评论(0) 收藏
#include<stdio.h> #include<string.h> #define max(x,y) x>y?x:y struct apple { int c; i ...
随机推荐
- Null value was assigned to a property of primitive type setter of原因及解决
出现Null value was assigned to a property of primitive type setter of错误是由于类型不匹配,将字段的属性由hibernate的int类型 ...
- iOS设计模式 - (1)概述
近期可自由安排的时间比較多, iOS应用方面, 没什么好点子, 就先放下, 不写了.花点时间学学设计模式. 之后将会写一系列博文, 记录设计模式学习过程. 当然, 由于我自己是搞iOS的, 所以之后设 ...
- [RxJS] Chain RxJS Operators Together with a Custom `pipe` Function using Array.reduce
Instead of writing complex operators, it's usually best to write simple, single-purpose operators th ...
- maven 项目 spring mvc + jdbc 配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- [转] When to use what language and why
Published by Seraphimsan Oct 13, 2010 (last update: Oct 14, 2010) When to use what language and why ...
- eclipse中经常使用快捷键
熟练一些快捷键,会使你的开发更加快捷.高效,值得花些时间学一下! 1. ctrl+shift+r:打开资源 这可能是全部快捷键组合中最省时间的了.这组快捷键能够让你打开你的工作区中不论什么一个文件,而 ...
- GEO,IGSO,MEO,LEO
GEO(Geosynchronous Eearth Orbit):地球静止轨道卫星 IGSO(Inclined Geosynchronous Satellite Orbit):倾斜轨道同步卫星 地球同 ...
- Hadoop Hive概念学习系列之hive里的索引(十三)
Hive支持索引,但是Hive的索引与关系型数据库中的索引并不相同,比如,Hive不支持主键或者外键. Hive索引可以建立在表中的某些列上,以提升一些操作的效率,例如减少MapReduce任务中需要 ...
- touch all contents in a folder recursively
https://superuser.com/questions/598163/powershell-touch-all-files-newer-than Powershell to use Unix ...
- winform 无法修改控件的location
dock and location 是因为设置了控件的Dock,导致无法修改