-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.qml
77 lines (59 loc) · 1.57 KB
/
main.qml
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
77
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.0
Window {
width: Screen.width
height: Screen.height
visible: true
title: qsTr("OpencvToQml")
Rectangle{
id: imageRect
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 800
height: 600
color: "transparent"
border.color: "black"
border.width: 3
Image{
id: opencvImage
anchors.fill: parent
fillMode: Image.PreserveAspectFit
property bool counter: false
visible: false
source: "image://live/image"
asynchronous: false
cache: false
function reload()
{
counter = !counter
source = "image://live/image?id=" + counter
}
}
}
Button{
id: startButton
x: imageRect.x/2 - startButton.width/2
y:imageRect.height/6 + imageRect.y
text: "Open"
onClicked: {
VideoStreamer.openVideoCamera(videoPath.text)
opencvImage.visible = true
}
}
TextField{
id:videoPath
x: startButton.x - startButton.width
y: startButton.y + startButton.height * 2
placeholderText: "Video Path or Video Index"
cursorVisible: true
width: startButton.width * 3
}
Connections{
target: liveImageProvider
function onImageChanged()
{
opencvImage.reload()
}
}
}