Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!v15g2000prn.googlegroups.com!not-for-mail
From: Ashvin <nkmah2@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Background Illumination
Date: Mon, 20 Jul 2009 01:30:32 -0700 (PDT)
Organization: http://groups.google.com
Lines: 50
Message-ID: <70315d19-6a65-454e-b2e5-1e59dd7a656e@v15g2000prn.googlegroups.com>
References: <h3vi1h$1la$1@fred.mathworks.com> <f7354e0d-ded9-4533-bdbf-35c02188140f@l31g2000vbp.googlegroups.com>
NNTP-Posting-Host: 220.245.127.169
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1248078632 16257 127.0.0.1 (20 Jul 2009 08:30:32 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 20 Jul 2009 08:30:32 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: v15g2000prn.googlegroups.com; posting-host=220.245.127.169; 
	posting-account=TvwpjAoAAADbk6Eaohvk4fQgIZs6iF74
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) 
	Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:556737


On Jul 20, 4:16 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> Smith Kumar :
> You probably forgot to put [] in your imshow() function to scale your
> double to the display range.  Try this:
> clc;
> close all;
> workspace;
> I = imread('C:\Program Files\MATLAB\R2008b\toolbox\images\imdemos
> \rice.png');
> I = uint8(I);
> subplot(2,2,1);
> imshow(I);
> kernel = ones(16,16) / (16*16);
> backApprox = imfilter(I, kernel);
> subplot(2,2,2);
> imshow(backApprox, []);
> I = im2double(I); % Convert I to storage class of double.
> backApprox = im2double(backApprox); % Convert backApprox to storage
> class of double.
> I2 = I - backApprox; % Subtract the background from I.
> subplot(2,2,3);
> imshow(I2, [])
> I2(I2<0) = 0; % Clip the pixel values to the valid range.
> subplot(2,2,4);
> imshow(I2, [])
> set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.
>
> But you really need to decide if background subtraction is what you
> want to do.  It usually isn't, except in radiography (e.g. digital
> subtraction angiography).  Most cases should use background division.
> After all, if the corner of your image has 90% of the light incident
> on it, wouldn't you want to divide by 0.9 at those pixels?  Sure you
> would.  If you're not doing intensity analysis of the objects but are
> just doing shape analysis then subtraction can work OK to give you the
> object masks (binary image of where you objects are in your image).
> Regards,
> ImageAnalyst

Thanks ImageAnalyst ... works great....


Now the problem I am facing is that I need to save the image and
perform histtogram equaliuzation on it but I am getting an error on
saving it as (I2, [])

Also I need to perform histogram equalization on 32*32 blocks of the
image.. is this the right approach or is there a better way...

I3=histeq(I2, [32 32]);