mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 21:01:33 -05:00
Fix silent loss of high-channel ndarray dimensions
Detect three-dimensional NumPy arrays as multichannel inputs before applying the channel limit so OpenCV reports an explicit conversion error instead of treating the channel axis as a matrix dimension. Add regression coverage for a 129-channel remap input. Assisted-by: OpenAI Codex
This commit is contained in:
@@ -165,7 +165,7 @@ bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo& info)
|
||||
|
||||
CV_LOG_DEBUG(NULL, "Incoming ndarray '" << info.name << "': ndims=" << ndims << " _sizes=" << pycv_dumpArray(_sizes, ndims) << " _strides=" << pycv_dumpArray(_strides, ndims));
|
||||
|
||||
bool ismultichannel = ndims == 3 && _sizes[2] <= CV_CN_MAX && !info.nd_mat;
|
||||
bool ismultichannel = ndims == 3 && !info.nd_mat;
|
||||
if (pyopencv_Mat_TypePtr && PyObject_TypeCheck(o, pyopencv_Mat_TypePtr))
|
||||
{
|
||||
bool wrapChannels = false;
|
||||
|
||||
Reference in New Issue
Block a user