How to create binary images from an image with low contrast and non-uniform illumination?

4 visualizzazioni (ultimi 30 giorni)
Hi all,
I am working with CT scans of concrete and am trying to create binary images. The problem is that the images from the middle of the concrete block is much lower in contrast. Additionally, the images have non-uniform lumination (the center is darker compared to the edges). I have tried using the code outlined in https://www.mathworks.com/help/images/correcting-nonuniform-illumination.html.
Here are two images I am working with:
https://drive.google.com/drive/folders/1lRHgRhEUQw5RZWxB17hwjO2q5DCbzdrd?usp=sharing

Risposte (1)

Raunak Gupta
Raunak Gupta il 18 Feb 2020
Hi,
Below code might solve the problem.
I = imread('top0076.tif');
I = I(:,:,1);
diskSize = 50;
SE = strel('disk',diskSize);
nhood = ~(SE.Neighborhood);
se = strel(nhood);
background = imopen(I,se);
k = I-background;
I3 = imadjust(k);
figure;imshow(I3)
bw = imbinarize(I3);
pixelAreaToRemove = 30;
bw = bwareaopen(bw,pixelAreaToRemove);
figure;imshow(bw)
I changed the morphological structuring element strel as it is mentioned that at center the illumination is less compared to the edges. This is opposite to the usual vignette scenario. You may change the diskSize or pixelAreaToRemove as required.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by