As per my knowledge, you're using the PIL to enhance a NumPy array.cv2 which converts images path into NumPy array. This process will not work using the PIL image operations.
Load the image using the PIL command then enhance the image using PIL enhancement then convert into NumPy array so that you can pass it to cv2 using resize() method.
Code to do it:
from PIL import Image
from PIL import ImageEnhance
import cv2
import glob
import numpy as np
dataset = glob.glob('input/*.png')
other_dir = 'output/'
for img_id, img_path in enumerate(dataset):
img = Image.open(img_path) # this is a PIL image
enhancer = ImageEnhance.Sharpness(img) # PIL wants its own image format here
enhanced_im = enhancer.enhance(8.0) # and here
enhanced_cv_im = np.array(enhanced_im) # cv2 wants a numpy array
cl2 = cv2.resize(enhanced_cv_im, (1024,1024), interpolation = cv2.INTER_CUBIC)
cv2.imwrite(f'{other_dir}/enhanced_{img_id}.png',cl2)
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch