Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 674
ahmad iqbal Avatar asked Mar 12 '26 18:03

ahmad iqbal


1 Answers

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
like image 124
Elie Eid Avatar answered Mar 14 '26 07:03

Elie Eid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!