6

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)
ahmad iqbal
  • 237
  • 5
  • 14
  • Did you look at this [-cannot-import-name-dnn-superres-for-python](https://stackoverflow.com/questions/61159469/importerror-cannot-import-name-dnn-superres-for-python-example-of-super-resol)? – Ahmet Nov 10 '20 at 05:49

1 Answers1

12

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
Community
  • 1
  • 1
Elie Eid
  • 703
  • 7
  • 11
  • or you just don't have opencv-contrib-python and need to install it without deleting anything – Elmir Aug 06 '22 at 09:41