i want to ask how to adjust image contrast,

6 views (last 30 days)
i want to adjust the image contrast, the problem is the when i used imread to read the image it appears as a black image although when i browse it using image viewer the image was good. i used imadjust command to adjust image contrast , but it become brighter in the middle , but at the edges the brigntness is lower, so i want a command to change the image brighness equally through out the image
in the first column of the attached image i am tracing powder inside pocket , so the problem is that the pixel values at the pocket boundries is lower than in the middle , so it is traced as black (no powder), i think that comes from imadjust command

Answers (3)

Image Analyst
Image Analyst on 13 Dec 2018
You can multiply the image by a factor, or add a constant the the image. You can get those values from scroll bars if you build a GUI to do that.
  2 Comments
khalid Elserfy
khalid Elserfy on 14 Dec 2018
first problem i have is using imread of 16 bit image, matab read it as black image although its contrast setting is good when viewing it using image viewer
second one, is as i mentioned that imadjust increase image contrast in the middle , but the boundries are not ,so when i convert my image to black , and white these point are read as black
Image Analyst
Image Analyst on 14 Dec 2018
The first problem is not a problem. imread() reads it as a 16 bit image just fine. If you don't believe me, look at the values in the workspace.
The second problem does not have to be a problem. imadjust() lets you adjust the contrast anywhere - just look at the documentation.
"but the boundries are not" <== are not what?
"when i convert my image to black..." <== Why are you converting your image to black???

Sign in to comment.


khalid Elserfy
khalid Elserfy on 14 Dec 2018
hi
thanks a lot for your reply
my problem is with that part that is highlighted in the attached image , i do not know why it is darker compared to the points in the middle of the pocket.
  • i highlighted the part that i am refering to in the the attached image
  • i want to convert the image into black , and white .i used threshold criteria. if the pixel value is below specific value it is considered as black otherwise it is white

Image Analyst
Image Analyst on 14 Dec 2018
With this code, I display the image with the range 0-1000 mapped to 0-255. The pixels in the far lower right of hte image, that you circled in your uploaded picture, are in the range of 0-1000 or so. You can adjust the range if you want, but the information in that region (below line 300 or so) is just very noisy. Not sure what you're hoping to find out about that area.
fileName = '8000fps 100000-1.41sec tif high shutter_000001.tif';
grayImage = imread(fileName);
subplot(2, 2, 1);
imshow(grayImage);
axis('on', 'image');
impixelinfo;
fontSize = 15;
title(fileName, 'FontSize', fontSize, 'Interpreter', 'none');
subplot(2, 2, 3:4);
imhist(grayImage);
grid on;
title('Histogram', 'FontSize', fontSize);
subplot(2, 2, 2);
imshow(grayImage, [0, 1000]);
axis('on', 'image');
title('Contrast Stretched', 'FontSize', fontSize, 'Interpreter', 'none');
impixelinfo;
0000 Screenshot.png

Community Treasure Hunt

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

Start Hunting!