{
  "id": "opencv/sift-patent-expired-license",
  "signature": "cv2.error: OpenCV(4.5.5) /tmp/opencv-4.5.5/modules/xfeatures2d/src/sift.cpp:120: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'SIFT_create'",
  "signature_zh": "cv2.error: OpenCV(4.5.5) /tmp/opencv-4.5.5/modules/xfeatures2d/src/sift.cpp:120: error: (-213:功能未实现) 此算法已申请专利且在此配置中被排除；请设置 OPENCV_ENABLE_NONFREE CMake 选项并重新编译库 在函数 'SIFT_create' 中",
  "regex": "This algorithm is patented and is excluded.*SIFT_create",
  "domain": "opencv",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "SIFT algorithm is disabled by default in OpenCV builds due to patent restrictions; non-free modules must be enabled at compile time.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于专利限制，SIFT 算法在 OpenCV 构建中默认禁用；必须在编译时启用非免费模块。",
  "versions": [
    {
      "version": "4.5.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.7.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.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Pip install opencv-python-headless doesn't include non-free modules; SIFT remains unavailable.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Setting OPENCV_ENABLE_NONFREE=ON via environment variable won't affect pre-built binary packages.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using cv2.xfeatures2d.SIFT_create() still requires non-free build; the function name doesn't change behavior.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install opencv-contrib-python which includes non-free modules by default: `pip install opencv-contrib-python`",
      "success_rate": 0.9,
      "how": "Install opencv-contrib-python which includes non-free modules by default: `pip install opencv-contrib-python`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Rebuild OpenCV from source with CMake flag: `cmake -DOPENCV_ENABLE_NONFREE=ON ..` then `make -j8` and `sudo make install`",
      "success_rate": 0.85,
      "how": "Rebuild OpenCV from source with CMake flag: `cmake -DOPENCV_ENABLE_NONFREE=ON ..` then `make -j8` and `sudo make install`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use AKAZE or ORB as patent-free alternatives: `akaze = cv2.AKAZE_create(); kp, des = akaze.detectAndCompute(img, None)`",
      "success_rate": 0.7,
      "how": "Use AKAZE or ORB as patent-free alternatives: `akaze = cv2.AKAZE_create(); kp, des = akaze.detectAndCompute(img, None)`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Install opencv-contrib-python which includes non-free modules by default: `pip install opencv-contrib-python`",
    "Rebuild OpenCV from source with CMake flag: `cmake -DOPENCV_ENABLE_NONFREE=ON ..` then `make -j8` and `sudo make install`",
    "Use AKAZE or ORB as patent-free alternatives: `akaze = cv2.AKAZE_create(); kp, des = akaze.detectAndCompute(img, None)`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.opencv.org/4.x/da/df5/tutorial_py_sift_intro.html",
  "official_doc_section": null,
  "error_code": "-213",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}