Jan-01-2025, 06:35 AM
Here I am trying to loop through each image file in a folder .
The code :
The code :
import cv2 import numpy as np import os # Directory containing jpg files directory = r"F:/PyProject/PyCode/Images" imgs=[] # Loop through each file in the directory for filename in os.listdir(directory): imgs = cv2.imread(filename) alpha = 2.0 beta = -130 new = alpha * imgs + beta new = np.clip(new, 0, 255).astype(np.uint8) # file name should be 01_filename.jpg cv2.imwrite("index_filename.'jpg'", new)
Error:new = alpha * imgs + beta
~~~~~~^~~~~~
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
Not able to find where I am going wrong: