Thread Subject: Shadow Removal Using Entropy minimization

Subject: Shadow Removal Using Entropy minimization

From: Sandeep

Date: 6 Oct, 2009 12:18:02

Message: 1 of 7


Hi all,

I am trying to implement a shadow removal algorithm in matlab. I follow the paper
written by Mr.Graham.Finalyson i.e, "Shadow removal using Entropy minimization".
First of all i am trying to get 1-D illuminant invariant image by assuming that we
know the projection angle. I took some known images from the above mentioned
paper so that i know the projection angle and there is no need of entropy calculation.
The program which wrote works with some images and seems to be failed with some images. Please help me if some one has some experience with this algorithm. I am appending small part of my matlab code which is written to produce a 1-D illumination invariant image.
------------------------------------------------------------------------------------------------------------------

       I = imread('file1.tiff');
       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;

-----------------------------------------------------------------------------------------------------

Thank you all,
Sandeep P

Subject: Shadow Removal Using Entropy minimization

From: Luca

Date: 21 Jul, 2010 14:26:05

Message: 2 of 7

"Sandeep " <sandeepdevasrii@gmail.com> wrote in message <hafchq$bl1$1@fred.mathworks.com>...
>
> Hi all,
>
> I am trying to implement a shadow removal algorithm in matlab. I follow the paper
> written by Mr.Graham.Finalyson i.e, "Shadow removal using Entropy minimization".
> First of all i am trying to get 1-D illuminant invariant image by assuming that we
> know the projection angle. I took some known images from the above mentioned
> paper so that i know the projection angle and there is no need of entropy calculation.
> The program which wrote works with some images and seems to be failed with some images. Please help me if some one has some experience with this algorithm. I am appending small part of my matlab code which is written to produce a 1-D illumination invariant image.
> ------------------------------------------------------------------------------------------------------------------
>
> I = imread('file1.tiff');
> 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;
>
> -----------------------------------------------------------------------------------------------------
>
> Thank you all,
> Sandeep P

Hi,
at the end did you find the solution of this problem?

I'm as you with the same problem. I want to implement the algorithm to find the minimum entropy value....

Subject: Shadow Removal Using Entropy minimization

From: casa

Date: 24 Jul, 2010 13:18:03

Message: 3 of 7

hi,i use this code to plot Entropy :

X1 = mat2gray(rho1*1/(sqrt(2)) - rho2*1/(sqrt(2)));
X2 = mat2gray(-rho1*sqrt(6)/4 + rho2*sqrt(6)/4 + rho3*(sqrt(6)/4));
for t=1:180

    delta = t*pi/180;
    img = cos(delta)*X1 + sin(delta)*X2 ;
    
    logimg = -log(img);
    r=img.*logimg;
    
    n(t)=mean(abs(r(:)));
end;

plot(abs(n(:)), 'DisplayName', 'n', 'YDataSource', 'n'); figure(gcf)
[v,idx]=min(n(:));

result are inconsistent amongst the papers. may be the paper use some high precision
bmp.

Subject: Shadow Removal Using Entropy minimization

From: casa

Date: 24 Jul, 2010 13:19:04

Message: 4 of 7

hi,i use this code to plot Entropy :

X1 = mat2gray(rho1*1/(sqrt(2)) - rho2*1/(sqrt(2)));
X2 = mat2gray(-rho1*sqrt(6)/4 + rho2*sqrt(6)/4 + rho3*(sqrt(6)/4));
for t=1:180

    delta = t*pi/180;
    img = cos(delta)*X1 + sin(delta)*X2 ;
    
    logimg = -log(img);
    r=img.*logimg;
    
    n(t)=mean(abs(r(:)));
end;

plot(abs(n(:)), 'DisplayName', 'n', 'YDataSource', 'n'); figure(gcf)
[v,idx]=min(n(:));

result are inconsistent amongst the papers. may be the paper use some high precision
bmp.

Subject: Shadow Removal Using Entropy minimization

From: hao yu

Date: 18 Oct, 2010 09:05:05

Message: 5 of 7

hi :
I want know how to solve the PDE in this paper, who can help me ? Thanks all.

Subject: Shadow Removal Using Entropy minimization

From: Nasser M. Abbasi

Date: 18 Oct, 2010 09:07:38

Message: 6 of 7

On 10/18/2010 2:05 AM, hao yu wrote:
> hi :
> I want know how to solve the PDE in this paper, who can help me ? Thanks all.

Sure. Where is the paper btw?

--Nasser

Subject: Shadow Removal Using Entropy minimization

From: hao yu

Date: 18 Oct, 2010 09:23:03

Message: 7 of 7

 it is availialbe in IEEE. also you can google it" Shadow Removal Using Entropy minimization, IJCV 2009".
 If you want a talk, my MSN : yuhao@tju.edu.cn,
thanks

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
shadow reomval ... benoit 11 Oct, 2011 06:01:05
shadow reomval ... Sandeep 6 Oct, 2009 08:19:03
rssFeed for this Thread

Contact us at files@mathworks.com