|
|
|
@ -25,9 +25,11 @@
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<h5>实时视频流</h5>
|
|
|
|
|
<img src="{{ url_for('video_feed') }}">
|
|
|
|
|
<button id="captureButton">Capture Frame</button>
|
|
|
|
|
<img id="frameImage" src="" alt="Captured Frame" style="display:none; width: 640px; height: 480px;">
|
|
|
|
|
<img src="{{ url_for('startvadio') }}">
|
|
|
|
|
<button type="button" onclick="capture()" >拍照</button>
|
|
|
|
|
<button type="button" onclick="startvadio()" >开始视频</button>
|
|
|
|
|
<button type="button" onclick="stopvadio()" >停止视频</button>
|
|
|
|
|
<!-- <img id="frameImage" src="" alt="Captured Frame" style="display:none; width: 640px; height: 480px;"> -->
|
|
|
|
|
<p> 小车控制界面</p>
|
|
|
|
|
<bodylink = "red">
|
|
|
|
|
<a href="control" target="_blank">小车控制</a>
|
|
|
|
@ -44,9 +46,7 @@
|
|
|
|
|
<button type="button" onclick="left()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-left" > </button>
|
|
|
|
|
<button type="button" onclick="stop()" class="btn btn-lg btn-primary glyphicon glyphicon-stop"> </button>
|
|
|
|
|
<button type="button" onclick="right()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-right" > </button>
|
|
|
|
|
<!-- ---------------------------------------- -->
|
|
|
|
|
<button type="button" onclick="takePhoto()">拍照</button>
|
|
|
|
|
<!-- ---------------------------------------- -->
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<button id="rear" type="button" onclick="back()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-down" style="margin-left: 56px;"> </button>
|
|
|
|
|
</div>
|
|
|
|
@ -91,6 +91,7 @@
|
|
|
|
|
ws.onclose = function (e) {
|
|
|
|
|
console.log('Client disconnected')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -98,31 +99,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('#captureButton').click(function() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/capture_frame', // 后端路由地址
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
// 将响应中的图像数据设置到img标签的src属性
|
|
|
|
|
$('#frameImage').attr('src', 'data:image/jpeg;base64,' + response);
|
|
|
|
|
// 显示图像
|
|
|
|
|
$('#frameImage').show();
|
|
|
|
|
},
|
|
|
|
|
error: function(error) {
|
|
|
|
|
console.log('Error:', error);
|
|
|
|
|
function capture() {
|
|
|
|
|
console.log("132465789891651354684");
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
|
|
type: "GET",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
url: "capture" ,
|
|
|
|
|
data: $('#form1').serialize(), //提交的数据
|
|
|
|
|
success: function (result) {
|
|
|
|
|
console.log(result); //打印服务端返回的数据(调试用)
|
|
|
|
|
if (result.resultCode == 200) {
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
},
|
|
|
|
|
error : function() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function startvadio() {
|
|
|
|
|
// console.log("132465789891651354684");
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
|
|
type: "GET",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
url: "startvadio" ,
|
|
|
|
|
data: $('#form1').serialize(), //提交的数据
|
|
|
|
|
success: function (result) {
|
|
|
|
|
console.log(result); //打印服务端返回的数据(调试用)
|
|
|
|
|
if (result.resultCode == 200) {
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
},
|
|
|
|
|
error : function() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function stopvadio() {
|
|
|
|
|
// console.log("132465789891651354684");
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
|
|
type: "GET",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
url: "stopvadio" ,
|
|
|
|
|
data: $('#form1').serialize(), //提交的数据
|
|
|
|
|
success: function (result) {
|
|
|
|
|
console.log(result); //打印服务端返回的数据(调试用)
|
|
|
|
|
if (result.resultCode == 200) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
;
|
|
|
|
|
},
|
|
|
|
|
error : function() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// $(document).ready(function() {
|
|
|
|
|
// $('#captureButton').click(function() {
|
|
|
|
|
// $.ajax({
|
|
|
|
|
// url: '/capture_frame', // 后端路由地址
|
|
|
|
|
// type: 'GET',
|
|
|
|
|
// success: function(response) {
|
|
|
|
|
// // 将响应中的图像数据设置到img标签的src属性
|
|
|
|
|
// $('#frameImage').attr('src', 'data:image/jpeg;base64,' + response);
|
|
|
|
|
// // 显示图像
|
|
|
|
|
// $('#frameImage').show();
|
|
|
|
|
// },
|
|
|
|
|
// error: function(error) {
|
|
|
|
|
// console.log('Error:', error);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
function printClicked() {
|
|
|
|
|
// console.log("132465789891651354684");
|
|
|
|
|
}
|
|
|
|
|
// ---------------------------------------
|
|
|
|
|
function takePhoto() {
|
|
|
|
|
window.location.href = "{{ url_for('take_photo') }}"; // 重定向到拍照请求
|
|
|
|
|
}
|
|
|
|
|
// ---------------------------------------
|
|
|
|
|
|
|
|
|
|
function forward() {
|
|
|
|
|
console.log("132465789891651354684");
|
|
|
|
|
$.ajax({
|
|
|
|
|