I am trying to upscale image (performing super resolution) using OpenCV, but I am getting this error that module ‘cv2.cv2’ has no attribute ‘dnn_superres’. Any help would be greatly appreciated.
I am using 4.4.0.44 OpenCV version. Here is the code section.
JavaScript
x
5
1
import cv2
2
sr = cv2.dnn_superres.DnnSuperResImpl_create()
3
sr.readModel(args["model"])
4
sr.setModel(modelName, modelScale)
5
Advertisement
Answer
In case you are using python3, you need to download opencv with pip3
First uninstall opencv:
JavaScript
1
3
1
pip uninstall opencv-python
2
pip uninstall opencv-contrib-python
3
Then install latest version of opencv with pip3:
JavaScript
1
2
1
pip3 install opencv-contrib-python
2