필터 지우기
필터 지우기

Using Stretchlim and Imadjust (automatically and manually)

조회 수: 3 (최근 30일)
dunphy
dunphy 2021년 12월 20일
편집: DGM 2024년 2월 1일
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])

답변 (2개)

Image Analyst
Image Analyst 2021년 12월 20일
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 2022년 7월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by