Подогнать холст к windows - PullRequest
1 голос
/ 10 июля 2020

У меня есть изображение (1200 x 2064) из videp:

Я хочу отобразить его с помощью Tkinter. Итак, я сделал это:

cap = cv2.VideoCapture(path_video)
cap.set(1, 1)
ret, frame = cap.read()
self._root = tk.Tk()
self._root.minsize(height=frame.shape[0], width=frame.shape[1] + 150)
self._root.title("Image")
image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
image = Image.fromarray(image)
image = ImageTk.PhotoImage(image)
canvas_1 = tk.Canvas( self._root, height=frame.shape[0], width=150)
canvas_1.grid(row=0, column=0)
canvas_1.create_text(10, 10, anchor='nw', text='Pixel: ')
canvas_2 = tk.Canvas( self._root, height=frame.shape[0], width=frame.shape[1])
canvas_2.grid(row=0, column=1)
canvas_2.image = image
canvas_2.create_image(0, 0, anchor='nw', image=image)
self._root.mainloop()

Image I got

The image is cropped at the bottom (or my laptop screen is too small). I want to have the whole image in the canvas_2. How can I do that ?

Here is the real image

реальное изображение

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...