|
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]);
|