module 'cv2' has no attribute 'ximgproc'
时间: 2023-08-03 22:05:16 浏览: 173
no moudel named cv2
引用\[1\]:出错:AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’,出错原因也很简单,就是CV2的库冲突了,安装了多个,只需要这么操作就可以了: pip uninstall opencv-contrib-python opencv-python pip install opencv-contrib-python 。 引用\[2\]:AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’ 1. AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’ Traceback (most recent call last): File "superpixel-inceptionV1OnFire.py", line 92, in <module> slic = cv2.ximgproc.createSuperpixelSLIC(small_frame, region_size=22) AttributeError: module 'cv2.cv2' has no attribute 'ximgproc' 2. pip list | grep opencv (venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ pip list | grep opencv opencv-python 3.3.1.11 WARNING: You are using pip version 19.1.1, however version 19.2.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (venv) strong@foreverstrong:~/venv/tensorflow_work/fire-detection-cnn$ 3. 安装 opencv-contrib-python 。 引用\[3\]:遇到该问题时,网友多是建议补个包,即 pip3 install opencv-contrib-python 我在补完之后又出现下面这样的错误: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: 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 ‘cv::xfeatures2d::SIFT::create’ 貌似是该算法被申请了专利还是咋的,将opencv版本退到3.4.2即可解决,卸载之前的包,然后 pip3 install opencv-python == 3.4.2.16 pip3 install opencv-contrib-python == 3.4.2.16 AttributeError: module ‘cv2.cv2’ has no attribute ‘estimateRigidTransform’ 。
问题: module 'cv2' has no attribute 'ximgproc'
回答: 当出现module 'cv2' has no attribute 'ximgproc'的错误时,这通常是由于OpenCV库的版本冲突引起的。解决方法是卸载已安装的OpenCV库,然后重新安装opencv-contrib-python库。可以使用以下命令来解决这个问题:pip uninstall opencv-contrib-python opencv-python,然后再使用pip install opencv-contrib-python来重新安装opencv-contrib-python库。这样应该能够解决module 'cv2' has no attribute 'ximgproc'的问题。
#### 引用[.reference_title]
- *1* [AttributeError: module ‘cv2.cv2‘ has no attribute ‘ximgproc‘解决方法](https://blog.csdn.net/Wddym/article/details/121236311)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [AttributeError: module cv2.cv2 has no attribute ximgproc](https://blog.csdn.net/chengyq116/article/details/98470820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'(问题已解决,亲测有效!)](https://blog.csdn.net/weixin_41063476/article/details/87713860)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文