Equalization and Contrast Levels

4 ビュー (過去 30 日間)
Dracfov
Dracfov 2018 年 5 月 12 日
コメント済み: Image Analyst 2021 年 10 月 20 日
Hello everyone Could someone clarify some doubts:
I know that Histogram equalization is a method in image processing of contrast adjustment using the image's histogram.
so:
What would be the most appropriate value or contrast range of an image?
How to calculate it in Matlab?
How to assign a new contrast value to an Image in case the contrast value is too low.
could someone provide me what is the code in Matlab.
thanks ....
  1 件のコメント
Siyu Guo
Siyu Guo 2018 年 5 月 12 日
The function is histeq. As to my own opinion, there is no such thing as a "most appropriate value of contrast". Histogram equalization is based on the following assumption, that any contents of the image with a specific gray level are, without other additional information, of the same importance. It is then "unfair" that a large proportion of pixels are crowded in a very narrow gray scale level interval, meanwhile a small proportion of pixels take a very wide gray scale level interval, or a considerable part of the available gray scale range is simply left unused. Under the assumption, the most "fair" way to distribute the full available gray scale range among the image pixels is to distribute uniformly, i.e., the output image should have a uniform histogram. The new contrast is not "assigned" to the image, it is the result by adjusting the gray scale level of the image pixels.

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

回答 (1 件)

Image Analyst
Image Analyst 2018 年 5 月 12 日
Histogram equalization is almost always not a good idea. It does not make the image look better (usually makes it look unnatural), and it's not necessary for image segmentation. If you do need to scale your image for some reason, it would be better to use imadjust().
  2 件のコメント
Louis-Philippe Guinard
Louis-Philippe Guinard 2021 年 10 月 20 日
Allright, here's a follow-up: what if I can't get imadjust() to work properly. I am very probably not understanding properly how it works, but I have grayscale images whose pixel values are not limited to the 0-255 range (the image I'm currently testing this on has a range of 0 to 1957). The image is basically cells observed under fluorescence microscopy, and the default contrast makes some of them very hard to see. I would like to adjust the contrast to see better for segmentation, ideally without affecting pixel values, but I have lots of trouble with imadjust().
For the sake of example, I would write:
g1 = imadjust(G,[0 1],[0 1]);
g2 = imadjust(G,[0 1],[0 0.1]);
g3 = imadjust(G,[0 0.1],[0 1]);
All of which returns the exact same contrast adjustment, which saturates unnecessarily my image, not making it any easier to work with. Besides, I need to define multiple ROIs on said image; I got imcontrast to work, but since my ROI delimitation is all in a while loop, I need to adjust contrast with imcontrast every. single. time. I define a new ROI, which is tedious and annoying. How can I save once a proper contrast correction and use this every following time I work an image? Would I just need to save a .jpg after contrast adjustment and work with this? Thanks in advance!
P.S.: for what it's worth, I'm working on R2018a, if it can help!
Image Analyst
Image Analyst 2021 年 10 月 20 日
Yes, imadjust gives much more natural looking images because it's a linear stretch.
I would give imadjust() a histogram percentage rather than absolute ranges like you did. Like 1% or something so that it computes the CDf and puts the 1% gray level to 0 and the 99% gray level to 255 (limit of your display). The image itself can have any range whatsoever -- it doesn't need to be 0-255 or 0-65535.

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

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by