我有这张图片
我想从图像中删除阴影。我知道很多不同的方法,比如某些形态学操作已经被用来去除阴影:
我为同一张图片创建了这个蒙版
是否有其他方法可以尝试使用我创建的这个面具?
编辑:
输入图像和与请求大小相同的掩码:
编辑 2:我生成了 1D 不变图像,但它并不完美
I = imread('shadow.jpg');
J = im2double(I);
R = J(:,:,1);
G = J(:,:,2);
B = J(:,:,3);
[len,wid] = size(R);
% Generation of 2-D Log Chromaticity Image.
for i = 1:len
for j = 1:wid
if ((R(i,j)*G(i,j)*B(i,j))~= 0)
c1(i,j) = R(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));
c2(i,j) = G(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));
c3(i,j) = B(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));
else
c1(i,j) = 1;
c2(i,j) = 1;
c3(i,j) = 1;
end
end
end
rho1 = mat2gray(log(c1));
rho2 = mat2gray(log(c2));
rho3 = mat2gray(log(c3));
X1 = mat2gray(rho1*1/(sqrt(2)) - rho2*1/(sqrt(2))); %(1/sqrt(2); -1/sqrt(2); 0)
X2 = mat2gray(rho1*1/(sqrt(6)) + rho2*1/(sqrt(6)) - rho3*2/(sqrt(6))); %(1/sqrt(6); 1/sqrt(6); -2/sqrt(6))
theta = 120;
InvariantImage = cos(theta*pi/180)*X1 + sin(theta*pi/180)*X2;
imagesc(InvariantImage); colormap(gray)
无法理解我在这里做错了什么请帮忙?