Histogram Equalisation creating pixelated images

1 view (last 30 days)
Hi there,
I am using histeq to transform a set of images. However, while some of the images are transformed fine, a fair few are looking too pixelated. I will input an example below. First, here is my code:
filenames = dir(fullfile(Stimuli, '*.jpg'));
for k = 1:numel(filenames)
images = filenames(k).name;
equalHist = imread(images);
gsImg = histeq(equalHist, 255);
[~,name,~] = fileparts(filename);
gsFilename = sprintf('%s_histeq.jpg', name);
This is how some of the images are looking. E.g. edges are pixelated.
I have tried adjusting the intensity availibility , e.g. 255, 127, etc, but the problem persists.
Any ideas welcomed!

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 5 Jul 2022
Yes, you've learned that histogram equalized images look crappy. It's not surprising. So just don't do it. There is no need to. There are ways to get it to look less posterized (by adding a half gray level of noise) but they will still look bad so don't bother.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by