Re: Background Illumination



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
.



Relevant Pages

  • Re: Background Illumination
    ... backApprox = im2double; ... But you really need to decide if background subtraction is what you ...  If you're not doing intensity analysis of the objects but are ... perform histtogram equaliuzation on it but I am getting an error on ...
    (comp.soft-sys.matlab)
  • Re: background subtraction in x-rays
    ... i am working on MATLAB and am restricted to MATLAB as ... though background subtraction seems a very common topic ... image as my operating image which is a digital x-ray. ...
    (sci.image.processing)

Loading