aboutsummaryrefslogtreecommitdiffstats
path: root/app/AroundView.qml
blob: 1967610152f0d8694cdc801c3aaa923e02a379df (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
 * Copyright (C) 2019 DENSO TEN Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import QtQuick 2.6
import QtQuick.Controls 2.0
import OpenCV 1.0
import QtGraphicalEffects 1.0

ApplicationWindow {
	visible: true
	width: 1280
	height: 720
	title: qsTr("around view!")


	//Car image
	Image {
		id: car
		anchors.centerIn: parent
		source: './images/HMI_Radiocontrol_Car.png'
		z: 3
	}

	//border
	Rectangle {
		width: 5
		height: 1550
		anchors.bottom: back_rec.bottom
		anchors.bottomMargin:371
		visible: true
		color: "blue"

		transformOrigin: Rectangle.BottomLeft
		rotation: 45

		z: 2
	}
	Rectangle {
		width: 5
		height: 1550
		anchors.right: parent.right
		anchors.bottom: back_rec.bottom
		anchors.bottomMargin:371
		visible: true
		color: "blue"

		transformOrigin: Rectangle.BottomLeft
		rotation: -45
		z: 2
	}

	//front
	Rectangle {
		id: front_rec
		width: 1080
		height: 910
		anchors.bottom: car.verticalCenter
		anchors.horizontalCenter: parent.horizontalCenter
		visible: false

		Camera1 {
			id: camera1
			property int ret: 0
			anchors.fill: parent
		}
	}

	//mask
	Image {
		id:front_mask
		source: "images/triangle_front_full.png"
		sourceSize: Qt.size(1080, 540)
		smooth: true
		visible: false
	}

	OpacityMask {
		anchors.fill: front_rec
		source: front_rec
		maskSource: front_mask
		z: 1
	}


	//back
	Rectangle {
		id: back_rec
		width: 1080
		height: 910
		anchors.top: car.verticalCenter
		// anchors.topMargin : -100
		anchors.horizontalCenter: parent.horizontalCenter
		visible: false

		Camera0 {
			id: camera0
			property int ret: 0
			anchors.fill: parent
		}
	}

	//mask
	Image {
		id:back_mask
		source: "images/triangle_back_full.png"
		sourceSize: Qt.size(back_rec.width, back_rec.height)
		smooth: true
		visible: false
	}

	OpacityMask {
		anchors.fill: back_rec
		source: back_rec
		maskSource: back_mask
		z: 1
	}


	//left
	Rectangle {
		id: left_rec
		width: 1080
		height: 540
		anchors.top: parent.top
		anchors.topMargin: (parent.height/2)+(width/2)
		anchors.left: parent.left
		transformOrigin: Rectangle.TopLeft
		rotation: 270

		visible: true

		Camera2 {
			id: camera2
			property int ret: 0
			anchors.fill: parent
		}
	}


	//right
	Rectangle {
		id: right_rec
		width: 1080
		height: 540
		anchors.top: parent.top
		anchors.topMargin: (parent.height/2)+(width/2)
		anchors.right: parent.right
		transformOrigin: Rectangle.TopRight
		rotation: 90

		visible: true

		Camera3 {
			id: camera3
			property int ret: 0
			anchors.fill: parent
		}
	}

		Timer {
			id: timer
			property int frameRate: 30
			interval: 1000 / timer.frameRate
			running: true
			repeat: true

			onTriggered:  {
				camera0.update();
				camera1.update();
				camera2.update();
				camera3.update();
			}
	}

	Component.onCompleted: {
		camera0.ret=camera0.init(0,100)
		camera1.ret=camera1.init(1,-100)
		camera2.ret=camera2.init(2,0)
		camera3.ret=camera3.init(3,0)
	}
}