# cv::error: (-215:断言失败) distCoeffs.type() == CV_32FC1 || distCoeffs.type() == CV_64FC1 在函数 'undistortPoints' 中

- **ID:** `opencv/undistort-points-empty`
- **领域:** opencv
- **类别:** type_error
- **错误码:** `-215`
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

传递给 cv::undistortPoints 的畸变系数矩阵必须为 CV_32FC1 或 CV_64FC1 类型；其他类型会导致断言失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 4.5.0 | active | — | — |
| 4.8.0 | active | — | — |
| 4.10.0 | active | — | — |

## 解决方案

1. ```
   将 distCoeffs 转换为 CV_32FC1：distCoeffs.convertTo(distCoeffs, CV_32F);
   ```
2. ```
   如果没有畸变，传递零矩阵：cv::Mat::zeros(1, 5, CV_64FC1) 或 cv::Mat::zeros(1, 8, CV_64FC1)。
   ```

## 无效尝试

- **** — The function expects a single-channel matrix for distortion coefficients; multi-channel types are not accepted and trigger the assertion. (90% 失败率)
- **** — An empty Mat has type CV_8UC1 by default; the assertion fails because it is neither CV_32FC1 nor CV_64FC1. Use cv::Mat() with proper type or a zero matrix. (70% 失败率)
