-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
76 lines (51 loc) · 1.68 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import PIL
from tkinter import *
import customtkinter
from PIL import Image, ImageTk, ImageFilter
from tkinter import filedialog
import numpy as np
from ultralytics import YOLO
import cv2
import skimage
import mahotas
import mahotas.demos
import math
firstFrame = True
panelA = None
imageViewSize = (1920/2, 1080/2)
def createUI():
customtkinter.set_appearance_mode("dark")
customtkinter.set_default_color_theme("dark-blue")
global root
root = customtkinter.CTk()
root.geometry("500x350")
frame = customtkinter.CTkFrame(master = root)
frame.pack (pady = 20, padx = 60, fill = "both", expand = False)
button2 = customtkinter.CTkButton(master = frame, text = "-", command = nextBBox)
button2.pack (pady = 12, padx = 10)
image = cv2.imread("temp.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image1 = Image.fromarray(image)
button_image = ImageTk.PhotoImage(image1, size=imageViewSize)
global imageView
imageView = Label(image=button_image)
imageView.image = button_image
imageView.pack(padx=20, pady=10)
root.mainloop()
def nextBBox():
global firstFrame
global root
firstFrame = not firstFrame
print(firstFrame)
image = cv2.imread("prediction.jpg" if firstFrame else "temp.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image1 = Image.fromarray(image)
button_image = ImageTk.PhotoImage(image1, size=(500, 500))
global imageView
imageView.configure(image=button_image)
imageView.image = button_image
# global button
# button.pack_forget()
# button = customtkinter.CTkLabel(root, image=button_image, text="")
root.mainloop()
createUI()