Skip to content

Commit 387c9e5

Browse files
committed
Ensure that colour.io.process_image_OpenColorIO definition handles non-contiguous arrays.
References AcademySoftwareFoundation/OpenColorIO#2075
1 parent d9705c9 commit 387c9e5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

colour/io/ocio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def process_image_OpenColorIO(a: ArrayLike, *args: Any, **kwargs: Any) -> NDArra
136136

137137
a = as_float_array(a)
138138
shape, dtype = a.shape, a.dtype
139-
a = as_3_channels_image(a).astype(np.float32)
139+
a = np.ascontiguousarray(as_3_channels_image(a).astype(np.float32))
140140

141141
height, width, channels = a.shape
142142

colour/io/tests/test_ocio.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from colour.constants import TOLERANCE_ABSOLUTE_TESTS
1010
from colour.io import process_image_OpenColorIO
11-
from colour.utilities import full, is_opencolorio_installed
11+
from colour.utilities import full, is_opencolorio_installed, tstack
1212

1313
__author__ = "Colour Developers"
1414
__copyright__ = "Copyright 2013 Colour Developers"
@@ -103,3 +103,20 @@ def test_process_image_OpenColorIO(self):
103103
),
104104
atol=TOLERANCE_ABSOLUTE_TESTS,
105105
)
106+
107+
np.testing.assert_allclose(
108+
process_image_OpenColorIO(
109+
tstack(([0.2, 0.4, 0.6], [0.2, 0.4, 0.6], [0.2, 0.4, 0.6])),
110+
"ACES - ACES2065-1",
111+
"ACES - ACEScct",
112+
config=config,
113+
),
114+
np.array(
115+
[
116+
[0.42226437, 0.42226437, 0.42226437],
117+
[0.47934198, 0.47934198, 0.47934198],
118+
[0.51273096, 0.51273096, 0.51273096],
119+
]
120+
),
121+
atol=TOLERANCE_ABSOLUTE_TESTS,
122+
)

0 commit comments

Comments
 (0)