Image Illumination Correction problem
5 views (last 30 days)
Show older comments
Dear All;
I am trying to image correction for illumination and i have tried to use the same way the matlab presented but it does not work for me, can you help me in that.
The code that I wrote:
a = imread('Slug Flow.jpg');
% Convert the image to gray level image
b= rgb2gray(a)
% Apply adaptive histogram eqaulization to enahnce the contrast of the
% image
c=adapthisteq(b);
% Illumination Correction
MN=size(c);
background = imopen(c,strel('rectangle',MN));
I2 = imsubtract(c,background);
I3= imadjust(I2);
% Convert to binary image
level = graythresh(b);
d=im2bw(I3,level);
bw = bwareaopen(d, 50);
0 Comments
Answers (1)
Image Analyst
on 14 Sep 2013
What does your image look like?
You don't want a structuring element the size of your entire image! That will give you an image out that's just a single uniform gray level. Make your structuring element smaller, like 5 or 9 pixels in diameter.
What's all the stuff about binary image for?
Do you have a "blank shot"? If so, that would be better than using adapthisteq() which is really a last resort if you don't have a background image at all and need to estimate one from the image itself, assuming that some part of the background "shows through" your sample and you know that your sample is either brighter or darker than the background.
After you have the background image what you do depends on your image. For radiology and fluorescence you subtract the background, for most other image modalities you divide by the background.
2 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!