?? usage_examples.txt
字號:
Ac) kdu_compress -i y.pgm,cb.pgm,cr.pgm -o image.jpx
Cdecomp:C1=V(-),B(-:-:-) Cdecomp:C2=V(-),B(-:-:-)
-- Uses Part-2 downsampling factor styles (DFS) features to describe
a transform in which the first DWT level splits the Cb and Cr image
components (2'nd and 3'rd components, as supplied by "cb.pgm" and
"cr.pgm") only in the vertical direction. Subsequence DWT levels
use full horizontal and vertical splitting (a la Part-1) for all
image components.
-- This sort of thing can be useful for applications in which the
chrominance components have previously been subsampled horizontally
(e.g., a 4:2:2 video frame). In particular, it ensures that whenever
the image is reconstructed at resolutions (e.g., at half or
quarter resolution for the luminance), the chrominance components
can be reconstructed at exactly the same size as the luminance
component.
Ad) kdu_compress -i image.pgm -o image.jpx Catk=2
Kextension:I2=SYM Kreversible:I2=no
Ksteps:I2={2,0,0,0},{2,-1,0,0}
Kcoeffs:I2=-0.5,-0.5,0.25,0.25
-- Uses Part-2 arbitrary transform kernel (ATK) features to describe
an irreversible version of the spline 5/3 DWT kernel -- Part-1
uses the reversible version of this kernel for its reversible
compression path, but does not provide an irreversible version.
-- For a full understanding of the `Ksteps' and `Kcoeffs' parameter
attribute syntax, refer to the usage statement printed by
"kdu_compress -usage".
-- Note that the `Catk' attribute identifies the kernel to be used
via its instance index (2 in this case). The kernel is then
given by the `Kextension', `Kreversible', `Ksteps' and `Kcoeffs'
attributes with this instance index (:I2).
Ad) kdu_compress -i image.ppm -o image.jpx Catk=2
Kextension:I2=CON Kreversible:I2=yes
Ksteps:I2={1,0,0,0},{1,0,1,1}
Kcoeffs:I2=-1.0,0.5
-- Another example of Part-2 arbitrary transform kernel (ATK) features,
this time specifying the well-known Haar (2x2) transform kernel, for
lossless processing; the reversible Haar DWT is also known as the
"S-transform" in the literature.
Ae) kdu_compress -i image.bmp -o image.j2c Catk=2
Kextension:I2=SYM Kreversible:I2=yes
Ksteps:I2={4,-1,4,8},{4,-2,4,8}
Kcoeffs:I2=0.0625,-0.5625,-0.5625,0.0625,-0.0625,0.3125,0.3125,-0.0625
-- Another example of Part-2 arbitrary transform kernel (ATK) features,
this time specifying a reversible 13x7 kernel (13-tap symmetric low-pass
analysis filter, 7-tap symmetric high-pass analysis filter) with two
lifting steps.
Af) kdu_compress -i image.ppm -o image.jpx -jp2_space sRGB Mcomponents=3
Sprecision=8,8,8 Ssigned=no,yes,yes Mmatrix_size:I7=9
Mmatrix_coeffs:I7=1,0,1.402,1,-0.344136,-0.714136,1,1.772,0
Mvector_size:I1=3 Mvector_coeffs:I1=128,128,128
Mstage_inputs:I16={0,2} Mstage_outputs:I16={0,2}
Mstage_collections:I16={3,3}
Mstage_xforms:I16={MATRIX,7,1,0,0} Mnum_stages=1 Mstages=16
-- Compresses an RGB colour image using the conventional RGB to YCbCr
transform to approximately decorrelate the colour channels, implemented
here as a Part-2 multi-component transform. The colour transform is
actually identical to the Part-1 ICT (Irreversible Colour Transform),
but this example is provided mainly to demonstrate the use of the
multi-component transform.
-- To decode the above parameter attributes, note that:
a) There is only one multi-component transform stage, whose instance
index is 16 (this is the I16 suffix found on the descriptive
attributes for this stage). The value 16 is entirely arbitrary. I
picked it to make things interesting. There can, in general, be
any number of transform stages.
b) The single transform stage consists of only one transform block,
defined by the `Mstage_xforms:I16' attribute -- there can be
any number of transform blocks, in general.
c) This block takes 3 input components and produces 3 output
components, as indicated by the `Mstage_collections:I16' attribute.
d) The stage inputs and stage outputs are not permuted in this example;
they are enumerated as 0-2 in each case, as given by the
`Mstage_inputs:I16' and `Mstage_outputs:I16' attributes.
e) The transform block itself is implemented using an irreversible
matrix decorrelation operator. More specifically, the transform
block belongs to the class of matrix decorrelation operators
(1'st field of `Mstage_xforms:I16' record is "MATRIX"), with
matrix coefficients taken from the `Mmatrix_size' and
`Mmatrix_coeffs' attributes with instance index 7 (2'nd field of
`Mstage_xforms:I16' is 7), using irreversible processing
(4'th field of `Mstage_xforms:I16' is 0 -- irreversible). Block
outputs are added to the offset vector whose instance index is 1
(3'rd field of `Mstage_xforms:I16' is 1), as given by the
`Mvector_size:I1' and `Mvector_coeffs:I1' attributes.
f) The mapping from YCbCr to RGB is performed using the 3x3 matrix,
whose coefficients appear in raster order within the
`Mmatrix_coeffs:I1' attribute.
g) Since a multi-component transform is being used, the precision
and signed/unsigned properties of the final decompressed (or
original compressed) image components are given by `Mprecision'
and `Msigned' (8-bit unsigned image samples in this case), while
their number is given by `Mcomponents'.
h) The `Sprecision' and `Ssigned' attributes record the precision
and signed/unsigned characteristics of what we call the codestream
components -- i.e., the components which are obtained by block
decoding and spatial inverse wavelet transformation. In this
case, these are the Y, Cb and Cr components. The RGB to YCbCr
transform has the property that these are also 8-bit quantities
(no range expansion), with Cb and Cr holding signed quantities
and Y (luminance) unsigned.
Ag) kdu_compress -i image.bmp -o image.jpx -jp2_space sRGB Mcomponents=4
Sprecision=8,8,8 Ssigned=no,yes,yes Mmatrix_size:I7=9
Mmatrix_coeffs:I7=1,0,1.402,1,-0.344136,-0.714136,1,1.772,0
Mvector_size:I1=3 Mvector_coeffs:I1=128,128,128
Mvector_size:I2=1 Mvector_coeffs:I2=128
Mstage_inputs:I16={0,2},{0,0} Mstage_outputs:I16={0,3}
Mstage_collections:I16={3,3},{1,1}
Mstage_xforms:I16={MATRIX,7,1,0,0},{MATRIX,0,2,0,0}
Mnum_stages=1 Mstages=16
-- Same as example Af), except that the multi-component transform defines
an extra output component, which is created by a second transform
block in the single multi-component transform stage.
This extra transform block is described by the second record in
each of `Mstage_collections' and `Mstage_xforms'; it takes only 1 input
and 1 output and uses a null-transform (2'nd field in the second record
of `Mstage_xforms:I16' is 0). This means that the extra transform
block simply passes its input through to its output, adding the
offset described by `Mvector_size:I2' and `Mvector_coeffs:I2' (3'rd
field of the second recrod in `Mstage_xforms:I16' is 2).
The bottom line is that the 4'th output component is simply a
replica of the 1'st raw codestream component -- the Y (luminance)
component. In order, the output components are R, G, B and Y.
-- This example shows how multi-component transforms can have more
output components than the number of codestream components -- i.e.
the components which are actually encoded. In fact, they can also
have fewer components. When confronted with this situation, the
"kdu_compress" example associates the input image file's N components
(N=3 here) with the first N output image components, and then figures
out how to work back through the multi-component transform network,
inverting or partially inverting an appropriate subset of the
transform blocks so as to obtain the codestream components which
must be encoded. If there is a way of doing this, Kakadu should
be able to find it.
Ah) kdu_compress -i image.ppm -o image.jpx -jp2_space sRGB
Mcomponents=3 Creversible=yes
Sprecision=8,8,8 Ssigned=no,yes,yes Mmatrix_size:I7=12
Mmatrix_coeffs:I7=1,1,4,0,1,-1,1,0,-1,0,0,1
Mvector_size:I1=3 Mvector_coeffs:I1=128,128,128
Mstage_inputs:I25={1,1},{2,2},{0,0}
Mstage_outputs:I25={2,2},{0,0},{1,1}
Mstage_collections:I25={3,3}
Mstage_xforms:I25={MATRIX,7,1,1,0}
Mnum_stages=1 Mstages=25
-- Same as example Af), except that processing is performed reversibly
and the Part-1 RCT (reversible colour transform) is implemented as a
multi-component transform to demonstrate reversible matrix
decorrelation transforms.
-- To understand the reversible decorrelation transform block, observe
firstly that the coefficients from `Mmatrix_coeffs:I7' belong to
the following 4x3 array:
| 1 1 4 |
M = | 0 1 -1 |
| 1 0 -1 |
| 0 0 1 |
Let I0, I1 and I2 denote the inputs to this transform block. The
reversible transform operator transforms these inputs into outputs
via the following steps (one step per row in the matrix, M):
i) I2 <- I2 - round[(1*I0 + 1*I1) / 4] = I2 - round((I0+I1)/4)
ii) I1 <- I1 - round[(0*I0 + -1*I2) / 1] = I1 + I2
iii) I0 <- I0 - round[(0*I0 + -1*I2) / 1] = I0 + I2
iV) I2 <- I2 - round[(0*I0 + 0*I1) / 1] = I2
Noting that `Mstage_inputs:I25' associates the block inputs with
the raw codestream components I0 -> C1=Db, I1 -> C2=Dr, I2 -> C0=Y,
and `Mstage_outputs:I25' associates the block outputs with stage
output components I0 -> M2=B, I1 -> M0=R, I2 -> M1=G, the above
steps can be written as
i) G <- Y - round((Db + Dr)/4)
ii) R <- Dr + G
iii) B <- Db + G
iV) G <- G
which is exactly the Part-1 RCT transform mapping YDbDr to RGB -- of
course, the fourth step does nothing here, but reversible
multi-component decorrelation transforms require this final step.
-- For a complete description of reversible multi-component decorrelation
transforms, consult Part-2 of the JPEG2000 standard, or the interface
description for Kakadu function `kdu_tile::get_mct_rxform_info'.
Ai) kdu_compress -i catscan.rawl*35@524288 -o catscan.jpx -jpx_layers *
-jpx_space sLUM Creversible=yes Sdims={512,512} Clayers=16
Mcomponents=35 Msigned=no Mprecision=12
Sprecision=12,12,12,12,12,13 Ssigned=no,no,no,no,no,yes
Mvector_size:I4=35 Mvector_coeffs:I4=2048
Mstage_inputs:I25={0,34} Mstage_outputs:I25={0,34}
Mstage_collections:I25={35,35}
Mstage_xforms:I25={DWT,1,4,3,0}
Mnum_stages=1 Mstages=25
-- Compresses a medical volume consisting of 35 slices, each 512x512,
represented in raw little-endian format with 12-bits per sample,
packed into 2 bytes per sample. This example follows example (x)
above, but adds a multi-component transform, which is implemented
using a 3 level DWT, based on the 5/3 reversible kernel (the kernel-id
is 1, which is found in the second field of the `Mstage_xforms' record.
-- To decode the above parameter attributes, note that:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -