当前位置:网站首页>图像增强——MSRCR
图像增强——MSRCR
2022-07-28 05:17:00 【qq_46165876】
原文章:A multiscale retinex for bridging the gap between color images and the human observation of scenes.
代码搬运
clear;
close all;
img_in = im2double(imread('D:\Image enhancement\image 10\10.bmp'));
scales = [2 120 240];
alpha = 500;
d = 1.5;
img_out = MSRCR(img_in,scales,[],alpha,d);
imwrite(img_out,'D:\Image enhancement\image 10\MSRCR.jpg');
str_scales = ['scale=[',num2str(scales(1)),',',num2str(scales(2)),',',num2str(scales(3)),']'];
str_alpha = ['alpha=',num2str(alpha)];
str_d = ['contrast=',num2str(d)];
function img_out = MSRCR( img_in, sigma, w, alpha, d )
e = 0.004;
img_in = img_in + e;
if ~exist('sigma','var') || isempty(sigma)
sigma = [2 90 180];
end
if ~exist('w','var') || isempty(w)
w = [1 1 1]/3;
end
if ~exist('alpha','var') || isempty(alpha)
alpha = 128;
end
if ~exist('d','var') || isempty(d)
d = 1.2;
end
% multi-scale Retinex, color restore
scale = max(size(sigma,1),size(sigma,2));
S = log(img_in);
R = cell(scale,1);
for is = 1 : scale
R{is} = S - imgaussfilt(S,sigma(is));
end
R_sum = w(1)*R{1};
for is = 2 : scale
R_sum = R_sum + w(is)*R{is};
end
% dynamics of the colors
C = log(alpha*img_in) - repmat(log(sum(img_in,3)),[1,1,3]);
Rcr = C.*R_sum;
meani = mean(Rcr(:));
vari = var(Rcr(:));
mini = meani - d*vari;
maxi = meani + d*vari;
range = maxi - mini;
img_out = (Rcr - mini)/range;
end只是原作者的搬运工。原作者的github链接有附。
边栏推荐
- 【CVPR2022】Lite Vision Transformer with Enhanced Self-Attention
- 11.< tag-动态规划和子序列, 子数组>lt.115. 不同的子序列 + lt. 583. 两个字符串的删除操作 dbc
- Interpreting the source code of cfrunloopref
- How does Alibaba use DDD to split microservices?
- Flask Development & get/post request
- Advanced assignment method of ES6 -- Deconstruction assignment
- MySQL basic query
- php7.1 连接sqlserver2008r2 如何测试成功
- 个人写的一个文件上传工具网站
- 【单例模式】懒汉模式的线程安全问题
猜你喜欢

First acquaintance with C language (2)

How practical is the struct module? Learn a knowledge point immediately

ES6 new variable modifiers let and const, new basic data type symbol

Message forwarding mechanism -- save your program from crashing

After ruoyi generates the code corresponding to the database, what should I do to make the following image look like

【内功心法】——函数栈帧的创建和销毁(C实现)

Flask Development & get/post request

You must configure either the server or JDBC driver (via the ‘serverTimezone)

PC side bug record

Offline loading of wkwebview and problems encountered
随机推荐
mybaties foreach多选查询,index循环,取消and/or标签
解决Oracle使用in语句不能超过1000问题
PC side bug record
Edge calculation kubeedge+edgemash
MySQL date and time function, varchar and date are mutually converted
How about ink cloud?
[internal mental skill] - creation and destruction of function stack frame (C implementation)
MySQL practice 45 lectures
导出excel,生成多个sheet页,并命名
Thinking on multi system architecture design
2021CSDN博客之星评选,互投
Bean的作用域、执行流程、生命周期
There is no crossover in the time period within 24 hours
Mysql处理遗留数据样例
docker 部署 mysql5.7.35
You must configure either the server or JDBC driver (via the ‘serverTimezone)
多线程进阶:锁的策略
JVM篇 笔记3:类加载与字节码技术
数据库日期类型全部为0
repackag failed: Unable to find main class