ImportError: cannot import name 'dnn_superres' for python example of super resolution with opencv

I had the same problem with Python 3.6.9 and opencv 4.2.0, but after the upgrade to 4.3.0, the problem disappeared. If you have no problem upgrading the version, try 4.3.0.


The key is in the documentation for opencv-python. dnn_superres is an extra module and requires you to install opencv-contrib-python

pip install opencv-contrib-python


your opencv version should be opencv4.2.0+, the same question: https://github.com/opencv/opencv_contrib/issues/2544

solution:

pip install --upgrade opencv-python
pip install --upgrade opencv-contrib-python