AttributeError: module 'cv2' has no attribute 'bgsegm'
时间: 2023-09-21 22:11:20 浏览: 52
This error occurs when you try to access an attribute or function in the cv2 module that does not exist. In this case, it seems like you are trying to access the "bgsegm" module in cv2, but it is not available.
One possible reason for this error is that you are using an outdated version of OpenCV. The bgsegm module was introduced in OpenCV 3.0, so if you are using an older version, it may not be available.
To fix this error, you can try updating your OpenCV installation to the latest version. Alternatively, you can check if the bgsegm module is available in your current version of OpenCV by running the following code:
```python
import cv2
print(dir(cv2))
```
This will print a list of all the attributes and functions available in the cv2 module. Look for "bgsegm" in the list to see if it is available.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)