簡體   English   中英

在沉浸式全景圖像中檢測人臉

[英]Detect human faces in an immersive panorama image

這是可能使用jQuery的臉檢測插件(我用這個 )來檢測一種身臨其境的360°全景影像的人臉(我用krpano 1.19 PR5(建2016年5月24日),工具(演示版)制作全景圖文件和krpano html5查看器進行渲染。您可以從此處下載整個程序包)?

面部檢測插件可與簡單的2D圖像和HTML5畫布配合使用。 krpano查看器還會在畫布中渲染目標全景圖塊。 以下是在瀏覽器中呈現全景圖像的html文件的代碼。

 <!DOCTYPE html> <html> <head> <title>krpano - test_pano_3</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=edge" /> <style> @-ms-viewport { width:device-width; } @media only screen and (min-device-width:800px) { html { overflow:hidden; } } html { height:100%; } body { height:100%; overflow:hidden; margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#FFFFFF; background-color:#000000; } </style> </head> <body> <a href="#" id="try-it">Try It</a> <script src="test_pano_3.js"></script> <div id="pano" style="width:100%;height:100%;"> <noscript><table style="width:100%;height:100%;"><tr style="vertical-align:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript> <script> embedpano({swf:"test_pano_3.swf", xml:"test_pano_3.xml", target:"pano", html5:"prefer", mobilescale:1.0, passQueryParameters:true}); </script> </div> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="jquery.facedetection.js"></script> <script> $(function () { "use strict"; $('#try-it').click(function (e) { e.preventDefault(); $('.face').remove(); var canvas = $("#krpanoSWFObject").find("canvas")[0]; $(canvas).faceDetection({ complete: function (faces) { console.log(faces); for (var i = 0; i < faces.length; i++) { $('<div>', { 'class':'face', 'css': { 'position': 'absolute', 'left': faces[i].x * faces[i].scaleX + 'px', 'top': faces[i].y * faces[i].scaleY + 'px', 'width': faces[i].width * faces[i].scaleX + 'px', 'height': faces[i].height * faces[i].scaleY + 'px' } }) .insertAfter(this); } }, error:function (code, message) { alert('Error: ' + message); } }); }); }); </script> </body> </html> 

這個:

var canvas = $("#krpanoSWFObject").find("canvas")[0];

應該不起作用,因為KRpano插件未實現find。 您應該嘗試以下方法:

var canvas = $("#krpanoSWFObject canvas");

返回canvas元素:)

問候,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM