python: validate high-channel 3D ndarrays on 4.x

This commit is contained in:
NIKHIL
2026-08-13 20:27:50 +05:30
parent 77dfa297d0
commit 726a0959df
2 changed files with 14 additions and 1 deletions

View File

@@ -89,6 +89,19 @@ try:
print(res1)
def test_ndarray_channel_limit_is_reported(self):
map_x, map_y = np.meshgrid(
np.arange(8, dtype=np.float32),
np.arange(8, dtype=np.float32),
)
data = np.broadcast_to(
np.arange(513, dtype=np.uint8),
(8, 8, 513),
).copy()
with self.assertRaisesRegex(cv.error, "unable to wrap channels"):
cv.remap(data, map_x, map_y, cv.INTER_NEAREST)
def test_mat_wrap_channels_zero(self):
# Passing a 0-channel array must raise cv.error, not segfault.
data = np.zeros((100, 100, 0), dtype=np.uint8)