Quantize image using specified quantization levels and output values
quantizes imagequant_A
= imquantize(A
,levels
)A
using specified quantization values contained in theN
element vectorlevels
. Output imagequant_A
is the same size asA
and containsN + 1
discrete integer values in the range1
toN + 1
which are determined by the following criteria:
IfA(k)≤levels(1), thenquant_A(k) =1.
Iflevels(m-1)<A(k)≤levels(m), thenquant_A(k)=m.
IfA(k)>levels(N), thenquant_A(k) =N + 1.
Note thatimquantize
assigns values to the two implicitly defined end intervals:
A(k)≤levels(1)
A(k)>levels(N)
adds thequant_A
= imquantize(___,values
)N + 1
element vectorvalues
whereN
=length
(levels
). Each of theN + 1
elements ofvalues
specify the quantization value for one of theN + 1
discrete pixel values inquant_A
.
IfA(k)≤levels(1), thenquant_A(k) =values(1).
Iflevels(m-1)<A(k)≤levels(m), thenquant_A(k)=values(m).
IfA(k)>levels(N), thenquant_A(k) =values(N + 1).