Merge branch 'issue179' of github.com:quintusdias/glymur into issue179
This commit is contained in:
commit
d483e2cd4b
2 changed files with 19 additions and 2 deletions
|
|
@ -695,6 +695,8 @@ class Jp2k(Jp2kBox):
|
||||||
(first_row, first_col, last_row, last_col)
|
(first_row, first_col, last_row, last_col)
|
||||||
tile : int, optional
|
tile : int, optional
|
||||||
Number of tile to decode.
|
Number of tile to decode.
|
||||||
|
no_cxform : bool
|
||||||
|
Whether or not to apply intended color transforms.
|
||||||
verbose : bool, optional
|
verbose : bool, optional
|
||||||
Print informational messages produced by the OpenJPEG library.
|
Print informational messages produced by the OpenJPEG library.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ class TestJp2k(unittest.TestCase):
|
||||||
with self.assertRaises(IOError):
|
with self.assertRaises(IOError):
|
||||||
Jp2k(filename)
|
Jp2k(filename)
|
||||||
|
|
||||||
def test_no_cxform(self):
|
def test_no_cxform_pclr(self):
|
||||||
"""Indices for jpxfile if no color transform"""
|
"""Indices for pclr jpxfile if no color transform"""
|
||||||
j = Jp2k(self.jpxfile)
|
j = Jp2k(self.jpxfile)
|
||||||
rgb = j.read()
|
rgb = j.read()
|
||||||
idx = j.read(no_cxform=True)
|
idx = j.read(no_cxform=True)
|
||||||
|
|
@ -112,6 +112,21 @@ class TestJp2k(unittest.TestCase):
|
||||||
rgb_from_idx[r, c] = palette[idx[r, c]]
|
rgb_from_idx[r, c] = palette[idx[r, c]]
|
||||||
np.testing.assert_array_equal(rgb, rgb_from_idx)
|
np.testing.assert_array_equal(rgb, rgb_from_idx)
|
||||||
|
|
||||||
|
def test_no_cxform_cmap(self):
|
||||||
|
"""Bands as physically ordered, not as physically intended"""
|
||||||
|
# This file has the components physically reversed. The cmap box
|
||||||
|
# tells the decoder how to order them, but this flag prevents that.
|
||||||
|
filename = opj_data_file('input/conformance/file2.jp2')
|
||||||
|
j = Jp2k(filename)
|
||||||
|
ycbcr = j.read()
|
||||||
|
crcby = j.read(no_cxform=True)
|
||||||
|
|
||||||
|
expected = np.zeros(ycbcr.shape, ycbcr.dtype)
|
||||||
|
for k in range(crcby.shape[2]):
|
||||||
|
expected[:,:,crcby.shape[2] - k - 1] = crcby[:,:,k]
|
||||||
|
|
||||||
|
np.testing.assert_array_equal(ycbcr, expected)
|
||||||
|
|
||||||
def test_file_not_present(self):
|
def test_file_not_present(self):
|
||||||
"""Should error out if reading from a file that does not exist"""
|
"""Should error out if reading from a file that does not exist"""
|
||||||
# Verify that we error out appropriately if not given an existing file
|
# Verify that we error out appropriately if not given an existing file
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue