I read an image with OpenCV for processing and copy that image to another directory folder. But I get following error. How can solve this and can copy it perfectly?
image_file = os.path.join("<ROOT_PATH>", file_)
image = cv2.imread(image_file, cv2.IMREAD_UNCHANGED)
image = np.stack([image]*3, axis=-1) # make image 3-channel
crop_img = image[int(ymin):int(ymax), int(xmin):int(xmax)]
plt.imshow(crop_img)
shutil.copy2(crop_img, "<dst_folder>")
Error:
TypeError: expected str, bytes or os.PathLike object, not numpy.ndarray