Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
correct image for brightness skewedness

Subject: correct image for brightness skewedness

From: M Ladderman

Date: 13 Dec, 2010 22:05:22

Message: 1 of 5

Dear all,

I have an image that increases steadily in brightness from left to right (lamp is from the left). I want to compensate for this somehow because it messes up my segmentation (because the brightness is so different across the picture).

any ideas are appreciated thanks!

Subject: correct image for brightness skewedness

From: Sean de

Date: 13 Dec, 2010 22:17:20

Message: 2 of 5

"M Ladderman" <mirresimons@gmail.com> wrote in message <ie65b2$bj9$1@fred.mathworks.com>...
> Dear all,
>
> I have an image that increases steadily in brightness from left to right (lamp is from the left). I want to compensate for this somehow because it messes up my segmentation (because the brightness is so different across the picture).
>
> any ideas are appreciated thanks!

Show us the image! (Some free file hosting website)

Subject: correct image for brightness skewedness

From: ImageAnalyst

Date: 13 Dec, 2010 22:39:38

Message: 3 of 5

Most likely a background division would do a pretty good job of
improving it, as long as you can get a "blank" shot and your object is
not 3D with bad shadows. Like Sean said, post your picture somewhere.

Subject: correct image for brightness skewedness

From: M Ladderman

Date: 14 Dec, 2010 06:06:05

Message: 4 of 5

Hi guys

Thanks for your replies. sorry for not posting my picture I thought it would be a general problem.

The pics are here: http://picasaweb.google.com/mirresimons/Matlab#
one image and one plot of the red channel (mean per column of matrix) * x coordinate.
You can see from the plot that brightness increases on the right and that this messes up segementation based on brightness (and kmeans clustering also not working optimally, tried that).

I think I need a matrix that increases from left to right, and add this to the pic matrix. I do not know how to make such a 'gradient' matrix and there might be easier ways?

thanks again

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b8733546-8994-43b1-95fc-ed2d99e9b54d@m37g2000vbn.googlegroups.com>...
> Most likely a background division would do a pretty good job of
> improving it, as long as you can get a "blank" shot and your object is
> not 3D with bad shadows. Like Sean said, post your picture somewhere.

Subject: correct image for brightness skewedness

From: M Ladderman

Date: 14 Dec, 2010 10:42:05

Message: 5 of 5

Hi everyone,

This is the (messy) code I just made to do what I want more or less. It calculates a linear regression for the increase in brightness (the peaks in the plot) and then correct the matrix accordingly. Thoughts are appreciated.

sizeR=size(RRR);
yaxis=(mean(RRR(:,:,1)))';
xaxis=(1:sizeR(2))';

xx=peakfinder(yaxis,(max(yaxis)-min(yaxis))/4,1); %function is availible on exchange
yy=yaxis(xx);

sizex=size(xx);
onesreg=ones(sizex);
B = [onesreg xx] \ yy; %regression

line=xaxis.*B(2);
correctmatrix=line';
k=1;
for k=1:(sizeR(1)-1)
correctmatrix=[correctmatrix; line'];
end
correctmatrix=uint8(correctmatrix);
correctedred=RRR(:,:,1)-correctmatrix;





"M Ladderman" <mirresimons@gmail.com> wrote in message <ie71gd$c0c$1@fred.mathworks.com>...
> Hi guys
>
> Thanks for your replies. sorry for not posting my picture I thought it would be a general problem.
>
> The pics are here: http://picasaweb.google.com/mirresimons/Matlab#
> one image and one plot of the red channel (mean per column of matrix) * x coordinate.
> You can see from the plot that brightness increases on the right and that this messes up segementation based on brightness (and kmeans clustering also not working optimally, tried that).
>
> I think I need a matrix that increases from left to right, and add this to the pic matrix. I do not know how to make such a 'gradient' matrix and there might be easier ways?
>
> thanks again
>
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b8733546-8994-43b1-95fc-ed2d99e9b54d@m37g2000vbn.googlegroups.com>...
> > Most likely a background division would do a pretty good job of
> > improving it, as long as you can get a "blank" shot and your object is
> > not 3D with bad shadows. Like Sean said, post your picture somewhere.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us