I am facing error while defining a function to add border in an image
import cv2
def im_border(path: str, output: str = "output.png"):
im1 = cv2.imread(path)
border = cv2.copyMakeBorder(
im1, 20, 20, 20, 20, cv2.BORDER_CONSTANT, value = [128, 128, 128])
cv2.imwrite(output, border)
return None
im_border(r'C:\Users\manoj\OneDrive\Desktop\8a4c4b2b47cdcbb6d359140081f63478.jpg',r'C:\Users\manoj\OneDrive\Desktop')
Why this is giving an error The error is as follows -
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:730: error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_'