-3
file_path = path.relpath(file_path_images)
with open(file_path, 'r') as f:
for line in f:
splitLine = line.split(' ')
ls.append(splitLine[1].strip())
img.append(splitLine[0])
print(img[0:10])
我得到:
['./2425/1/115_Lube_45484.jpg',
'./2425/1/114_Spencerian_73323.jpg',
'./2425/1/113_accommodatingly_613.jpg',
'./2425/1/112_CARPENTER_11682.jpg',
'./2425/1/111_REGURGITATING_64100.jpg',
'./2425/1/110_savannas_67969.jpg',
'./2425/1/109_unfix_82473.jpg',
'./2425/1/108_CAGOULES_10765.jpg',
'./2425/1/107_TRANSITS_80259.jpg',
'./2425/1/106_looped_45230.jpg']
現在我想讀我的圖片:
for image in img:
image=cv2.imread(image)
不過,我需要更新路徑並用替換'.'
210得到如下路徑:
'/home/Downloads/mnt/ramdisk/max/90kDICT32px/2425/1/115_Lube_45484.jpg'