import cv2 #import a pretrained model sr = cv2.dnn_superres.DnnSuperResImpl_create() sr.readModel('models/EDSR_x3.pb') sr.setModel('edsr', 3) #load image img = cv2.imread('imgs/06.jpg') result = sr.upsample(img) #convert the input image to match the size of result resized_img = cv2.resize(img, dsize=None, fx=3, fy=3) cv2.imshow('img', img) cv2.imshow('resized_img', resized_img) cv2.imshow('result', result) cv2.waitKey(0)
pip install opencv-contrib-python or pip install opencv-contrib-python --upgrade