{
  "id": "opencv/undistort-points-empty",
  "signature": "cv::error: (-215:Assertion failed) distCoeffs.type() == CV_32FC1 || distCoeffs.type() == CV_64FC1 in function 'undistortPoints'",
  "signature_zh": "cv::error: (-215:断言失败) distCoeffs.type() == CV_32FC1 || distCoeffs.type() == CV_64FC1 在函数 'undistortPoints' 中",
  "regex": "Assertion failed \\(distCoeffs\\.type\\(\\) == CV_32FC1 \\|\\| distCoeffs\\.type\\(\\) == CV_64FC1\\)",
  "domain": "opencv",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The distortion coefficients matrix passed to cv::undistortPoints must be of type CV_32FC1 or CV_64FC1; other types cause an assertion failure.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给 cv::undistortPoints 的畸变系数矩阵必须为 CV_32FC1 或 CV_64FC1 类型；其他类型会导致断言失败。",
  "versions": [
    {
      "version": "4.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.10.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The function expects a single-channel matrix for distortion coefficients; multi-channel types are not accepted and trigger the assertion.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "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.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Convert distCoeffs to CV_32FC1: distCoeffs.convertTo(distCoeffs, CV_32F);",
      "success_rate": 0.95,
      "how": "Convert distCoeffs to CV_32FC1: distCoeffs.convertTo(distCoeffs, CV_32F);",
      "condition": "",
      "sources": []
    },
    {
      "action": "If no distortion, pass a zero matrix: cv::Mat::zeros(1, 5, CV_64FC1) or cv::Mat::zeros(1, 8, CV_64FC1).",
      "success_rate": 0.9,
      "how": "If no distortion, pass a zero matrix: cv::Mat::zeros(1, 5, CV_64FC1) or cv::Mat::zeros(1, 8, CV_64FC1).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "将 distCoeffs 转换为 CV_32FC1：distCoeffs.convertTo(distCoeffs, CV_32F);",
    "如果没有畸变，传递零矩阵：cv::Mat::zeros(1, 5, CV_64FC1) 或 cv::Mat::zeros(1, 8, CV_64FC1)。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga55b3f9b9c3f0c9b8e1f0a5b7c3e1f",
  "official_doc_section": null,
  "error_code": "-215",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-09-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}