Borrar filtros
Borrar filtros

Using Stretchlim and Imadjust (automatically and manually)

3 visualizaciones (últimos 30 días)
dunphy
dunphy el 20 de Dic. de 2021
Editada: DGM el 1 de Feb. de 2024
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])

Respuestas (2)

Image Analyst
Image Analyst el 20 de Dic. de 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 el 16 de Jul. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by