Using Stretchlim and Imadjust (automatically and manually)

13 visualizzazioni (ultimi 30 giorni)
How do I correct my code by
(1) first getting an output which uses stretchlim and imadjust to adjust the contrast of an image automatically
(2) manually adjusting the contrast level [low_in high_in] using the imadjust function.
img = imread('coins.png'); %to open the original image of the coins
imshow(img); %to show the original image of the coins
orig_imadjust = imadjust(img); %to automatically adjust the contrast of the coin image using imadjust
orig_stretchlim = stretchlim (img) %to automatically adjust the contrast of the coin image stretchlim
% ??? -- to manually adjust the contrast level using imadjust function [low_in high_in]
orig_imhista = imhist(orig_imadjust) %to get the histogram of orig_imadjust
orig_imhistb = imhist(orig_stretchlim) %to get the histogram of orig_stretchlim
montage({img,orig_imadjust,orig_stretchlim,orig_imhista,orig_imhistb},"Size",[2 3])

Risposte (2)

Image Analyst
Image Analyst il 20 Dic 2021
Look at the documentation for imadjust(). It allows you to specify the min and max output gray levels, and the gray level range of the input image what will get mapped into that min to max range.
Any gray levels in the input image below the min output level will be clipped to the min output gray level you specified.
Any gray levels in the input image above the max output level will be clipped to the max output gray level you specified.

DGM
DGM il 16 Lug 2022

Community Treasure Hunt

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

Start Hunting!

Translated by