Illumination estimation: Finding boundary template
显示 更早的评论
The gradient module and the boundary template are similar.The output is supposed to be like

but the gradient and boundary template comes like this for my code

[Gx, Gy] = imgradientxy(eimg);
[Gmag, Gdir] = imgradient(Gx, Gy);
g=Gmag;
imshow(g,'Parent',handles.axes5);
sum=0.0;
%? = c·?A
area=rows*cols;
sig= 0.0032*sqrt(area);
d = dog(g,4*sig, sig,0);
imshow(d,'Parent',handles.axes6);
for x = 1:rows
for y = 1:cols
if d(x,y)>0
d(x,y)=d(x,y);
else
d(x,y)=0;
end
sum = sum+d(x,y);
end
end
al = 1.2;
w = d ./ sum;
t=ones(rows,cols);
for x = 1:rows
for y = 1:cols
t(x,y) = conv(w(x,y),g(x,y));
if g(x,y)>0
g(x,y)=g(x,y);
else
g(x,y)=0;
end
end
end
b = g - (al .* t);
b is the boundary template and g is the gradient module .
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Filtering and Enhancement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!