-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUI-demo.py
68 lines (52 loc) · 2.15 KB
/
UI-demo.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
import sys
from PyQt5.QtGui import QColor, QPixmap
from PyQt5.QtWidgets import QApplication, QFileDialog, QFrame, QPushButton, QWidget, QLabel, QComboBox
class Demo(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.query = None # path of query image
self.gallery = None # path of gallery image
self.btn1 = QPushButton("Choose query image", self)
self.btn1.move(350, 20)
self.btn1.clicked.connect(self.showDialog)
self.btn2 = QPushButton("Choose gallery image", self)
self.btn2.move(1350, 20)
self.btn2.clicked.connect(self.showDialog)
self.btn3 = QPushButton("Search", self)
self.btn3.move(900, 450)
self.btn3.clicked.connect(self.person_search)
self.label1 = QLabel(self)
self.label1.setGeometry(200, 100, 500, 700)
self.label1.setStyleSheet("border: 2px solid black")
self.label1.setScaledContents(True)
self.label2 = QLabel(self)
self.label2.setGeometry(1200, 100, 500, 700)
self.label2.setStyleSheet("border: 2px solid black")
self.label2.setScaledContents(True)
self.method_box = QComboBox(self)
self.method_box.addItem('CVPR 2017')
self.method_box.addItem('faster-rcnn')
self.method_box.addItem('ssy')
self.method_box.move(900, 400)
self.setGeometry(1000, 500, 2000, 1000)
self.setWindowTitle("Person search demo")
self.show()
def showDialog(self):
sender = self.sender()
img_path, _ = QFileDialog.getOpenFileName(self, "Choose image", "./images", "All Files (*)")
pix = QPixmap(img_path)
if sender == self.btn1:
self.query = img_path
self.label1.setPixmap(pix)
else:
self.gallery = img_path
self.label2.setPixmap(pix)
def person_search(self):
if self.method_box.currentText() == 'CVPR 2017':
print("search")
if __name__ == "__main__":
app = QApplication(sys.argv)
demo = Demo()
sys.exit(app.exec_())