Files
opencv-MIRROR/modules/core
Shiven Solanki efe44093c3 Merge pull request #30706 from sshivensolanki/core-locateroi-1d (#30706)
core: fix locateROI and getUMat for 1D Mat and UMat

Problem
For a 1D Mat, Mat::locateROI divides by step[0] (the element size), so it counts every element as a row and returns a wrong wholeSize and offset. Because of this, adjustROI doesn't grow 1D slices, and getUMat on a 1D slice recurses until the stack overflows. UMat::locateROI has the same bug.

Fix
Mat::locateROI and UMat::locateROI: for dims == 1, compute the offset and whole size from the element size: ofs = (delta1 / esz, 0) and wholeSize = (delta2 / esz, 1). The width is clamped to at least ofs.x + cols, like the 2D code.
Mat::getUMat: for a 1D slice, cut the result out of the whole UMat with a Range instead of a Rect, so the returned UMat stays 1D. Cutting with a Rect always made it 2D.
2D Mats and UMats are unchanged.
2026-11-13 16:16:51 +05:30
..