Documentation for slicing.
This commit is contained in:
parent
30219d01bf
commit
2c8e30e320
1 changed files with 14 additions and 7 deletions
|
|
@ -3,17 +3,24 @@ How do I...?
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
||||||
... read the lowest resolution thumbnail?
|
... read the lower resolution images?
|
||||||
=========================================
|
=====================================
|
||||||
Printing the Jp2k object should reveal the number of resolutions
|
Jp2k implements slicing via the :py:meth:`__getitem__` method so
|
||||||
(look in the COD segment section of the codestream), but you can
|
any lower resolution images in a JPEG 2000 file can easily be
|
||||||
take a shortcut by supplying -1 as the
|
accessed, for example here's how to retrieve the first sub-image ::
|
||||||
resolution level. ::
|
|
||||||
|
|
||||||
>>> import glymur
|
>>> import glymur
|
||||||
>>> jp2file = glymur.data.nemo()
|
>>> jp2file = glymur.data.nemo()
|
||||||
>>> jp2 = glymur.Jp2k(jp2file)
|
>>> jp2 = glymur.Jp2k(jp2file)
|
||||||
>>> thumbnail = jp2.read(rlevel=-1)
|
>>> fullres = jp2[:]
|
||||||
|
>>> print(fullres.shape)
|
||||||
|
(1456, 2592, 3)
|
||||||
|
>>> thumbnail = jp2[::2, ::2]
|
||||||
|
>>> print(thumbnail.shape)
|
||||||
|
(728, 1296, 3)
|
||||||
|
|
||||||
|
The :py:meth:`read` method gives many more options for other JPEG 2000 features
|
||||||
|
such as quality layers.
|
||||||
|
|
||||||
... display metadata?
|
... display metadata?
|
||||||
=====================
|
=====================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue