why after applying imadjust it gives me a white picture?

4 views (last 30 days)
I applied imadjust on my image and the first time it was working and gave me a hight contrast image but the 2nd time ,it is giving a a white picture with some black pixels. There is no problem in showing image because I know if my image pixel values not be in the range of showing, this problem will happen but this part has no problem.

Accepted Answer

Pravarthana P
Pravarthana P on 29 Jun 2022
Hi Donya Khaledyan,
I can understand that you are trying to improve the contrast of an image using the function “imadjust” which returns white image.
The reason for this behavior is that “imadjust” expects image data to be in the range of [0,1]. When the image data exceeds this range the “imadjust” function clips the data to maximum value ‘1’ which makes the image pixel to appear white.
One possible workaround will be to normalize the image by dividing with maximum value of image data before inputting to the “imadjust” function.
A sample code snippet is given below for your reference, the image data after normalizing in the range of [0.1,0.7] is mapped to [0,1] clipping all other data outside this range:
I = imread('cameraman.tif'); %image of interest
I = double(I)/255;v%normalizing the image data
J = imadjust(I,[0.1 0.7],[0 1]); %mapping the range
Another option you can try is to manually adjust the contrast using Adjust Contrast tool. This tool will allow you to visually set the contrast limits rather than guessing at what a reasonable contrast limit may be.
This can be done by calling the function “imcontrast” after displaying the image of interest. For further information the following documentation can be referred : Adjust Contrast tool - MATLAB imcontrast (mathworks.com)
Hope this information helps you!!

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!