Вы можете сделать это так:
#!/usr/bin/env python3
import re
import cv2
import numpy as np
import pandas as pd
# Open spreadsheet
excel_file = 'spreadsheet.xlsx'
ss = pd.read_excel(excel_file)
# Extract filenames and coordinates
FandC = []
for index,row in ss.head().iterrows():
filename = row['filename']
coords = row['Pixel coords']
# Use regex to find anything that looks like a bunch of digits possibly with decimal point
x, y, r = re.findall(r'[0-9.]+',coords)
print(f'DEBUG: filename={filename}, x={x}, y={y}, r={r}')
FandC.append({'filename': filename, 'x':x, 'y':y, 'r':r})
Теперь у вас есть список имен файлов и координат в FandC
, который выглядит следующим образом:
DEBUG: filename=M116_13331848_13109013315679.jpg, x=1345.83, y=1738, r=44.26
DEBUG: filename=M116_13331848_13109013315679.jpg, x=776.33, y=698.17, r=65.72
DEBUG: filename=M116_13331848_13109013315679.jpg, x=1215.5, y=485.67, r=61.16
DEBUG: filename=M116_13331848_13109013315679.jpg, x=1439.33, y=502.67, r=64.73
DEBUG: filename=M116_13331848_13109013315679.jpg, x=793.33, y=1661.5, r=86.03