资源简介
该代码能够有效去除阴影,亲测能运行,且效果很好

代码片段和文件信息
clear all
% close all
clc
b=imread(‘Image9.jpg‘);
b=imresize(b [200 200]);
a=double(b);
figure;
imshow(b);
epsilon = 1e-3;
I=find(a==0);
a(I)=epsilon;
r_b=log(a(::1)./a(::3));
g_b=log(a(::2)./a(::3));
l = 1;
B = zeros(140000);
R = zeros(140000);
for i = 1:200
for j = 1:200
B(l) = g_b(ij);
l = l+1;
end
end
m = 1;
for i = 1:200
for j = 1:200
R(m) = r_b(ij);
m = m+1;
end
end
figure plot(RB‘o‘);
% % deg = invAngle(r_b g_b);
deg=51;
rad = deg*(pi/180);
inv = (cos(rad)*(r_b) - sin(rad)*(g_b));
invexp = exp(inv);
invexp=invexp-min(min(invexp));
invexp=invexp*255/max(max(invexp));
figure;
imshow(invexp [0 255]);
%+++++++++++++++++++++++++++++++++++++++++++
% clustering into 2 clusters
x= (max(g_b(:)) + min(g_b(:)))/2;
c1=g_b(find(g_b >= x));
c2=g_b(find(g_b < x));
mc1=median(c1);
mc2=median(c2);
for i=1:200
for j=1:200
if(g_b(ij) >=x)
logresRG(ij) = inv(ij)*cos(-rad) + mc1*sin(-rad);
logresBG(ij) = -inv(ij)*sin(-rad) + mc1*cos(-rad);
else
logresRG(ij) = inv(ij)*cos(-rad) + mc2*sin(-rad);
logresBG(ij) = -inv(ij)*sin(-rad) + mc2*cos(-rad);
end
end
end
resRG = exp(logresRG);
resBG = exp(logresBG);
%+++++++++++++++++++++++++++++++++++++++++++
B =(3*invexp)./ (resRG + resBG +1);
B=B-min(B(:));
B=B/(max(B(:)));
R = resRG.*B;
R=R-min(R(:));
R=R/(max(R(:)));
G = resBG.*B;
G=G-min(G(:));
G=G/(max(G(:)));
rgb(::1)=R;
rgb(::2)=G;
rgb(::3)=B/2;
figure
imshow((rgb2gray(rgb)));% Gray Scale Image if shadow Less Image
figure
imshow(rgb); % RGB Shadow Less Image
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 729417 2014-07-16 00:07 Image9.jpg
文件 1763 2014-07-16 00:07 inv110107.asv
文件 1762 2014-07-16 00:07 inv110107.m
文件 758 2014-07-16 00:07 invAngle.m
文件 1506 2014-07-16 00:07 license.txt
文件 256 2014-07-16 00:07 waqar.txt
相关资源
- 编程实现二维DCT变换
- 图像二值化
- 用FFT对信号进行频谱分析
- Tone-Reservation
- QGA 量子遗传算法
- 差分形式的阻滞增长模型
- 遗传算法的M文件
- 简单二阶互联系统的非线性动力学分
- 手写数字识别-模板匹配法
- Stock_Watson_动态因子分析模型
- 果蝇优化算法优化支持向量回归程序
- 自己做的一个简单GUI扑克纸牌识别-
- multi output SVR
- AR过程的线性建模过程与各种功率谱估
- PCNN TOOLBOX
- plstoolbox.zip
- 中国国家基础地理信息系统GIS数据
- 粒子群微电网优化调度
- 矩阵分析-经典教材-中文版-Roger.A.Ho
- 压缩感知TwIST
- 基于最小错误率的贝叶斯手写数字分
- 最全系统辨识源代码,包括多种最小
- 导弹制导实验
- 画跟踪精确度图的程序.zip
- 重力场大地水准面及重力异常阶次误
- prtools5.2.3工具包
- 脉冲耦合神经网络工具箱PCNN-toolbox
- SVM算法-回归拟合程序.zip
- Kriging代理模型EGO算法.zip
- Matalb实现停车场完整系统
评论
共有 条评论