Currently learning reading image by csv and crop it with the data in the csv and i got I/O Error at my data image
the csv has data like below
filename width height class xmin ymin xmax ymax
Data16_173_55.jpg 600 338 Membuka Smartphone 476.25 100.14815 518.125 148.03148
Data16_173_56.jpg 600 338 Membuka Smartphone 474.68753 95.14074 517.1875 153.0389
Data16_173_57.jpg 600 338 Membuka Smartphone 468.125 93.26296 518.125 149.5963
Data16_173_58.jpg 600 338 Membuka Smartphone 470.3125 101.08704 519.0625 148.34444
and i am currently trying to crop it and replace the image using looping code by reading the filename, here's the code
import shutil
import os
from PIL import Image
import cv2
import pandas as pd
data = pd.read_csv('labels.csv')
for index, row in data.iterrows():
input_name = os.path.join("imagesXRP", row["filename"])
xmin = row["xmin"]
ymin = row['ymin']
xmax = row["xmax"]
ymax = row['ymax']
im = Image.open(input_name)
im1 = im.crop((xmin, ymin, xmax, ymax))
im1.save(input_name)
any answer would be help
thank you so much !
OSError: [Errno 5] Input/output error: 'imagesXRP/Data16_173_55.jpg'
imagesXRPexist and already placed in the same folder as your python file?./imagesXRPinstead ofimagesXRPin theos.path.join?