MATLAB Answers

How to get an image contrast value?

16 views (last 30 days)
Dear Matlab community,
I am working right now on my masters thesis and for this I have to analyze pictures taken with a special microscope. These pictures are mainly in a red/green color plane. Therefore I have segmented the images in RGB-Colormaps and converted them to a gray scale in different subplots.
But here is my problem: I would like to automatically choose the subplot with the highest contrast for further analysis. Is there any way to maybe compare the contrast values of the images and then the code choses the image with the highest contrast?
Greetings from Germany and thank you in advance!
A desperate student

  0 Comments

Sign in to comment.

Accepted Answer

Madhav Thakker
Madhav Thakker on 22 Sep 2020
Hi Denis,
I understand that you want to calculate the contrast of your gray scale images. You can use a very simple max - min definition as taken from https://www.mathworks.com/matlabcentral/answers/231214-how-to-find-the-contrast-of-a-image-in-matlab#answer_187225.
image_contrast = max(grayImage(:)) - min(grayImage(:));
You can compute the contrast for all different subplot images and choose image with the highest contrast by using a switch loop.
Hope this helps.

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!