Skip to content
Advertisement

module ‘cv2.cv2’ has no attribute ‘dnn_superres’

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.

import cv2
sr = cv2.dnn_superres.DnnSuperResImpl_create()
sr.readModel(args["model"])
sr.setModel(modelName, modelScale)

Advertisement

Answer

In case you are using python3, you need to download opencv with pip3

First uninstall opencv:

 pip uninstall opencv-python
 pip uninstall opencv-contrib-python

Then install latest version of opencv with pip3:

pip3 install opencv-contrib-python
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement