gdrive_path = "/content/gdrive" #Berittener Weg
from google.colab import drive
drive.mount(gdrive_path)
for a in range(0, 1280, 10):
print(a)
import glob
files = glob.glob("/content/gdrive/My Drive/ColabExp/*.png ") #Nur Dateien mit der Erweiterung png
files.sort() #Sortieren Sie die gefundenen Dateien
import tempfile
with tempfile.TemporaryDirectory() as tmpdir:
#Schreiben Sie die Datei in tmpdir
Oder
import tempfile
tmpdir = tempfile.TemporaryDirectory().name
import os
os.path.basename(files[i])
from tqdm import tqdm
for i, file in enumerate(tqdm(src_files)):
#wird bearbeitet
from PIL import Image
img = Image.new('RGB', (1280, 720), (255, 255, 255)) # 1280 x 720px
from PIL import ImageDraw
draw = ImageDraw.Draw(img)
draw.rectangle(((x0, y0), (x1, y1)), fill=(255, 0, 0)) #Quadrat
import cv2
cv2.imwrite(save_path, image)
img.save(path)
!ffmpeg -framerate 30 -i "$dst_img_dir/%06d.png " -vcodec h264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "$dst_mov_dir/out.mp4"
CSV
df = pd.read_csv(filepath)
CSV_DATA = StringIO("""x,y
10.0, 20.0
15.0, 30.0
20.0, 45.0
35.0, 80.0
""")
df = pd.read_csv(CSV_DATA, sep=",")
df.to_csv("out.csv")
from datetime import datetime
now_ts = int(datetime.now().timestamp())
Recommended Posts