![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/187105/image.bmp)
Normalize image brightness for thresholding?
12 次查看(过去 30 天)
显示 更早的评论
I'm working on object segmentation with a grayscale image that has a gradient. That is to say I have a bunch of objects in a picture which are bright and have high intensity values, and the further from the object's center you get the lower the values.
So I'm trying to binarize the image so I can separate objects. The problem? Not all the objects in the image have the same intensity. If I set the threshold lower the darker objects are below the threshold and are lost. If I set the threshold higher the brighter objects bleed together into one big blob. The problem is that no matter what threshold I pick some data is being lost.
Is there a way that I can increase the brighness of the darker parts of the image without losing contrast in the brighter parts? Absolute image intensity is not important, just the discrimination between objects. Is there some other workaround I could use? I'm stumped. Everything I've tried has either caused a loss of detail for the brighter objects or messed with existing shapes.
Thanks so much.
1 个评论
Christian Bernhardt
2017-3-22
Hi, I'm having the same question... I guess you could try to transform the image with following algorithm:
g=rgb2gray(RGBImage); c=input('Enter the constant value, c = '); [M,N]=size(g); for x = 1:M for y = 1:N m=double(g(x,y)); z(x,y)=c.*log10(1+m); %#ok<AGROW> end end imshow(g), figure, imshow(z);
I found it when I was searching for a way to normalize an image; I want to make a segmentation of an image obtained from a micrscope camera. The same trouble you have posted, brightness decreases towards the borders of the image, and then binarisation doesn't work well. With this implementation it worked a bit better, I hope this can help you keep trying..
<<
<<
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/187105/image.bmp)
>>
>>
回答(1 个)
Alain Kuchta
2017-3-21
编辑:Alain Kuchta
2017-3-21
My understanding is that your overall workflow is to perform image segmentation via a thresholding method. One of the challenges you are facing in doing this is a "gradient" or, in other words, non-uniform illumination.
You may find this example helpful, it shows how to correct nonuniform illumination in an image to make it easy to identify individual grains of rice in the image:
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!