Skip to content

Commit

Permalink
Ensure that colour.io.process_image_OpenColorIO definition handles …
Browse files Browse the repository at this point in the history
…non-contiguous arrays.

References AcademySoftwareFoundation/OpenColorIO#2075
  • Loading branch information
KelSolaar committed Oct 10, 2024
1 parent d9705c9 commit 387c9e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion colour/io/ocio.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def process_image_OpenColorIO(a: ArrayLike, *args: Any, **kwargs: Any) -> NDArra

a = as_float_array(a)
shape, dtype = a.shape, a.dtype
a = as_3_channels_image(a).astype(np.float32)
a = np.ascontiguousarray(as_3_channels_image(a).astype(np.float32))

height, width, channels = a.shape

Expand Down
19 changes: 18 additions & 1 deletion colour/io/tests/test_ocio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from colour.constants import TOLERANCE_ABSOLUTE_TESTS
from colour.io import process_image_OpenColorIO
from colour.utilities import full, is_opencolorio_installed
from colour.utilities import full, is_opencolorio_installed, tstack

__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers"
Expand Down Expand Up @@ -103,3 +103,20 @@ def test_process_image_OpenColorIO(self):
),
atol=TOLERANCE_ABSOLUTE_TESTS,
)

np.testing.assert_allclose(
process_image_OpenColorIO(
tstack(([0.2, 0.4, 0.6], [0.2, 0.4, 0.6], [0.2, 0.4, 0.6])),
"ACES - ACES2065-1",
"ACES - ACEScct",
config=config,
),
np.array(
[
[0.42226437, 0.42226437, 0.42226437],
[0.47934198, 0.47934198, 0.47934198],
[0.51273096, 0.51273096, 0.51273096],
]
),
atol=TOLERANCE_ABSOLUTE_TESTS,
)

0 comments on commit 387c9e5

Please sign in to comment.