-215
opencv
type_error
ai_generated
true
cv::error: (-215:断言失败) (map1.type() == CV_32FC2 || map1.type() == CV_16SC2) 在函数 'remap' 中
cv::error: (-215:Assertion failed) (map1.type() == CV_32FC2 || map1.type() == CV_16SC2) in function 'remap'
ID: opencv/remap-invalid-map-type
85%修复率
88%置信度
1证据数
2023-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 4.5.0 | active | — | — | — |
| 4.8.1 | active | — | — | — |
| 4.10.0 | active | — | — | — |
根因分析
传递给 cv::remap 的映射数组数据类型不受支持;第一个映射仅接受 CV_32FC2 或 CV_16SC2。
English
The map array passed to cv::remap has an unsupported data type; only CV_32FC2 or CV_16SC2 are accepted for the first map.
官方文档
https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html#ga5ae0f1347a0e5b9e8f8f1f0a5b7c3e1f解决方案
-
确保 map1 使用 CV_32FC2 类型创建:cv::Mat map1(rows, cols, CV_32FC2); 然后填充浮点坐标。
-
如果使用 initUndistortRectifyMap,通过检查传递给函数的 m1type 参数,验证输出映射类型为 CV_32FC2 或 CV_16SC2。
无效尝试
常见但无效的做法:
-
75% 失败
remap requires exactly CV_32FC2 (two-channel float) or CV_16SC2 (two-channel signed short) for the first map; other types cause assertion failure regardless of conversion.
-
90% 失败
The function expects map1 to contain (x,y) coordinates; swapping reverses the mapping logic and may produce distorted output or a different assertion error.