module 'cv2' has no attribute 'trackerboosting_create'
时间: 2023-04-26 13:06:33 浏览: 86
这个错误提示是因为在使用OpenCV的Python接口时,调用了一个不存在的函数trackerboosting_create。可能是因为你的OpenCV版本过低,或者你的安装中没有包含这个函数的模块。建议升级OpenCV版本或者重新安装包含该函数的模块。
相关问题
recognizer = cv2.face.LBPHFaceRecognizer_create() AttributeError: 'module' object has no attribute 'LBPHFaceRecognizer_create'
这个错误通常是由于OpenCV版本问题引起的。在OpenCV 4.0及以上版本中,创建LBPHFaceRecognizer的方法已经改变,必须使用`cv2.face.LBPHFaceRecognizer_create()`。而在OpenCV 3.x版本中,可以使用`cv2.face.createLBPHFaceRecognizer()`。
你可以通过以下代码检查OpenCV版本:
```
import cv2
print(cv2.__version__)
```
如果输出的版本号是4.0及以上,那么你应该使用`cv2.face.LBPHFaceRecognizer_create()`创建对象。如果输出的版本号是3.x,那么你应该使用`cv2.face.createLBPHFaceRecognizer()`创建对象。
cv2 has no attribute cv_32f
This error usually occurs when you try to use the attribute `cv_32f` with OpenCV's `cv2` module. The reason for this error is that there is no such attribute in the `cv2` module.
To fix this error, you can try changing the attribute from `cv_32f` to `CV_32F`, which is the correct attribute name in OpenCV's Python bindings. Alternatively, you can import the `cv` module instead of the `cv2` module and use the `cv.CV_32F` attribute.
Here's an example:
```python
import cv2 as cv
# create a new image
img = cv.imread('image.jpg')
# convert the image to float32
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
img = img.astype('float32')
# apply some filter
img = cv.GaussianBlur(img, (5, 5), cv.CV_32F)
# show the image
cv.imshow('image', img)
cv.waitKey(0)
cv.destroyAllWindows()
```
Note that `cv.CV_32F` is used instead of `cv2.cv_32f`.
阅读全文