Histogram Equalisation creating pixelated images

8 ビュー (過去 30 日間)
jlouise2022
jlouise2022 2022 年 7 月 5 日
コメント済み: jlouise2022 2022 年 7 月 6 日
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);
imwrite(gsImg,gsFilename);
end
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!
Thanks
  2 件のコメント
DGM
DGM 2022 年 7 月 5 日
Two things:
  • your images are integer data
  • your images are lossy-compressed JPG
What happens when you take a roughly-quantized shallow gradient and stretch its range?
A = imread('shallowgrad.jpg'); % a shallow JPG gradient
A = rgb2gray(A);
imshow(A)
B = imadjust(A); % stretch the range
imshow(B)
IA is right about not using histeq(), but the problem is more fundamental. Images have limited information. They look grossly quantized because they are. Regardless of the method, extreme contrast changes will emphasize the deficiencies of the source image.
jlouise2022
jlouise2022 2022 年 7 月 6 日
Thanks for the explanation!

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2022 年 7 月 5 日
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.
  1 件のコメント
jlouise2022
jlouise2022 2022 年 7 月 6 日
Haha... thanks, well noted.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by