我一直在尝试构建一个数据捕获和生物识别(指纹)表单,其中网络摄像头连接到PC,这样当您单击添加/上传图像按钮时,系统将自动启动网络摄像头,当您使用网络摄像头拍摄时,图像会自动上传到表单。
一个简单的例子是申请新驾照的过程。警察会要求你填写一张表格,表格数据会被传输到软件中,然后你会被要求站在相机前拍照。在某些情况下,申请人的指纹也会被采集并上传到系统中。
我正在开发的web应用程序使用Dreamweaver,PHP和MySQL。现在我只熟悉PHP。不懂Java编程。
欢迎您的提示,并提前感谢您
麦克
发布于 2017-02-26 20:19:13
请尝试使用此代码获取图像捕获from agurchand on TheOnlyTutorials.com
index.html
<!DOCTYPE html>
<html>
<head>
<title>WebCam jQuery and PHP script</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<style>
#camera_wrapper, #show_saved_img{float:left; width: 650px;}
</style>
<script type="text/javascript" src="scripts/webcam.js"></script>
<script>
$(function(){
//give the php file path
webcam.set_api_url( 'saveimage.php' );
webcam.set_swf_url( 'scripts/webcam.swf' );
webcam.set_quality( 100 ); // Image quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
var camera = $('#camera');
camera.html(webcam.get_html(600, 460));
$('#capture_btn').click(function(){
//take snap
webcam.snap();
});
//after taking snap call show image
webcam.set_hook( 'onComplete', function(img){
$('#show_saved_img').html('<img src="' + img + '">');
//reset camera for next shot
webcam.reset();
});
});
</script>
</head>
<body>
<h1>Capture photo with Web Camera - PHP Script</h1>
<!-- camera screen -->
<div id="camera_wrapper">
<div id="camera"></div>
<br />
<button id="capture_btn">Capture</button>
</div>
<!-- show captured image -->
<div id="show_saved_img" ></div>
</body>
</html>
Saveimage.php
<?php
//set random name for the image, used time() for uniqueness
$filename = time() . '.jpg';
$filepath = 'saved_images/';
//read the raw POST data and save the file with file_put_contents()
$result = file_put_contents( $filepath.$filename, file_get_contents('php://input') );
if (!$result) {
print "ERROR: Failed to write data to $filename, check permissionsn";
exit();
}
echo $filepath.$filename;
?>有关the source部分,请参阅PHP。
还可以从https://code.google.com/p/jpegcam/下载webcam.js库
https://stackoverflow.com/questions/23685086
复制相似问题