Wieso zeigt Python das Bild nicht richtig an?

Hallo,

ich bin mal wieder auf ein Problem gestoßen, dass ich mit Google wohl einfach nicht lösen kann...
Folgendes sind die von mir importierten Module:

from tkinter import *
from tkinter.filedialog import askopenfilename
from threading import Thread
from PIL import Image, ImageTk
import cv2
import threading
import os
import time
import pickle

Und ein Ausschnitt des Codes meines Video Editors:

global Medien_Importierungen, Maximale_Breite, Maximale_Höhe
Videopfad = askopenfilename(filetypes =[('Video Files', '*.mp4')])
Geladenes_Video = cv2.VideoCapture(Videopfad)
Rückgabe, Einzelbild = Geladenes_Video.read()
if Einzelbild.shape[0] / Maximale_Höhe > Einzelbild.shape[1] / Maximale_Breite:
    height = Maximale_Höhe
    width = int(Einzelbild.shape[1] * height / Einzelbild.shape[0])
else:
    width = Maximale_Breite
    height = int(Einzelbild.shape[0] * width / Einzelbild.shape[1])
Einzelbild = cv2.resize(Einzelbild, (width, height))
Tkinter_Bild = ImageTk.PhotoImage(image=Image.fromarray(cv2.cvtColor(Einzelbild, cv2.COLOR_BGR2RGB)))
Thumbnail = Label(Medien, image = Tkinter_Bild)
if Medien_Importierungen % 2 == 0:
    Thumbnail.place(x = Fenster.winfo_screenwidth() * 0.01, y = Fenster.winfo_screenheight() / 10 + (Fenster.winfo_screenwidth() * 0.01 + Maximale_Höhe) * (int(Medien_Importierungen / 2)))
else:
    Thumbnail.place(x = Fenster.winfo_screenwidth() * 0.11, y = Fenster.winfo_screenheight() / 10 + (Fenster.winfo_screenwidth() * 0.01 + Maximale_Höhe) * (int(Medien_Importierungen / 2)))
Medien_Importierungen += 1   

Statt einem Bild wird jetzt nur ein weißes Bild angezeigt. Durch das verdoppeln der Zeile, in der ich die Funktion

Geladenes_Video.read()

angewendet habe, wurde auch nichts gelöst...

Bitte helft mir...

Alex

programmieren, Code, Programmiersprache, Python, Python 3, Tkinter

Meistgelesene Beiträge zum Thema Code