Files
opencv-MIRROR/modules/core
Arnesh Banerjee ba5b40b1a2 core: restore in-place support for extractChannel (#29568)
extractChannel() stopped supporting in-place operation (dst aliasing
src) after commit 416bf3253 (PR #23473), which replaced

    Mat src = _src.getMat();
    _dst.create(src.dims, &src.size[0], depth);

with a single up-front

    _dst.createSameSize(_src, depth);
    ...
    Mat src = _src.getMat();

When _src and _dst reference the same array, the up-front reallocation
reshapes the shared buffer to a single channel before the multi-channel
source header is fetched. mixChannels() then sees a 1-channel source and
throws for any coi >= 1.

Move createSameSize() back to after the source Mat/UMat is obtained, so
the source header keeps the original multi-channel data alive across the
destination reallocation. This preserves the 0D/1D handling introduced
by createSameSize while restoring the pre-existing in-place contract.

Adds regression test Core_Mat.extractChannel_inplace_29568.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-30 03:09:43 +05:30
..
2026-07-28 20:28:24 +05:30
2026-05-25 17:49:25 +03:00