i want to ask how to adjust image contrast,
6 views (last 30 days)
Show older comments
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
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
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???
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;
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!