I wanna know how imadjust is working. The whole algorithm and its reference paper.

10 visualizzazioni (ultimi 30 giorni)
Hi everyone,
I am looking for the refrence paper of imadjust in matlab. I searched throught its library in matlab but I couldn't find any refrence in that.
I'll appreciate any help from you.

Risposte (1)

DGM
DGM il 12 Lug 2022
Modificato: DGM il 12 Lug 2022
Barring all the validation and ancillary stuff, the core operations are very simple. You can open imadjust.m and see for yourself.
So that I'm not posting TMW code, this is part of the fallback routine from MIMT's replacement for imadjust(). There are slight differences, but the core transformation is the same. If you want to know exactly how IPT imadjust() works in detail, you'll have to look at it instead.
% inrange is a 2-element vector in the range [0 1], default is [0 1]
% outrange is a 2-element vector in the range [0 1], default is [0 1]
% gamma is a scalar, default is 1
if automode
% just like IPT imadjust(), if no parameters are specified,
% then use stretchlim() to find the input range
inrange = stretchlimFB(inpict);
elseif size(inpict,3) == 3 && size(inrange,2) == 1
% the following routine expects size(inrange,2) to be equal to size(inpict,3)
% if the image is color, make sure to expand it
inrange = repmat(reshape(inrange,2,1),[1 3]);
end
% clamp inrange to stay within [0 1]
inrange = max(min(inrange),1,0);
% scale and cast the image to floating point
[inpict inclass] = imcast(inpict,'double'); % MIMT-only
% preallocate output
outpict = zeros(size(inpict));
% this is a basic linear scaling with gamma
for c = 1:size(inpict,3)
outpict(:,:,c) = ((inpict(:,:,c)-inrange(1,c))./(inrange(2,c)-inrange(1,c))).^gamma;
outpict(:,:,c) = outpict(:,:,c).*(outrange(2)-outrange(1))+outrange(1);
end
% clamp output to stay within [0 1]
outpict = max(min(real(outpict),1),0);
% scale and cast output to match the class of the input image
outpict = imcast(outpict,inclass); % MIMT-only
That said, I'm wondering if what you're actually asking about is how stretchlim() works instead. If so, feel free to open up stretchlim() and see. I don't recall if MIMT stretchlimFB() uses a similar method during fallback or not. It might be a bit different. The rough idea is to get the intensity distribution (the histogram), integrate it (find the CDF), and then find the points (the graylevels) at which it crosses the specified threshold value and (1-threshold).

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by