偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

基于HTML5的人臉識(shí)別技術(shù)

開發(fā) 前端 后端
本文介紹一個(gè)網(wǎng)站,演示了通過HTML5+JavaScript 技術(shù)實(shí)現(xiàn)的人臉識(shí)別,目前僅適用于 Chrome 瀏覽器,首先需要在地址欄輸入about:flags,然后找到啟用 MediaStream 這一項(xiàng),點(diǎn)擊啟用后重啟Chrome瀏覽器。

然后打開下面地址:

http://neave.com/webcam/html5/face/

當(dāng)你搖頭晃腦的時(shí)候,那副眼鏡會(huì)跟著移動(dòng)并幫你戴上眼鏡。

你可以查看網(wǎng)頁源碼來了解具體的實(shí)現(xiàn)細(xì)節(jié)。

———————————–我是分界線———————————————

這是一篇國外的文章,介紹如何通過 WebRTC、OpenCV 和 WebSocket 技術(shù)實(shí)現(xiàn)在 Web 瀏覽器上的人臉識(shí)別,架構(gòu)在 Jetty 之上。

實(shí)現(xiàn)的效果包括:

Face Detection result

還能識(shí)別眼睛

Eye Detection result

人臉識(shí)別的核心代碼:

頁面:

XML/HTML Code復(fù)制內(nèi)容到剪貼板
  1. <div> 
  2. <videoidvideoid="live"width="320"height="240" autoplay style="display: inline;"></video> 
  3. <canvaswidthcanvaswidth="320"id="canvas"height="240"style="display: inline;"></canvas> 
  4. </div> 
  5. <scripttypescripttype="text/javascript"> 
  6. var video = $("#live").get()[0];   
  7. var canvas = $("#canvas");   
  8. var ctx = canvas.get()[0].getContext('2d');   
  9. navigator.webkitGetUserMedia("video",   
  10. function(stream) {   
  11. video.src = webkitURL.createObjectURL(stream);   
  12. },   
  13. function(err) {   
  14. console.log("Unable to get video stream!")   
  15. }   
  16. )   
  17. timer = setInterval(   
  18. function () {   
  19. ctx.drawImage(video, 0, 0, 320, 240);   
  20. }, 250);   
  21. </script> 
JavaScript Code復(fù)制內(nèi)容到剪貼板
  1. publicclass FaceDetection {   
  2. privatestaticfinal String CASCADE_FILE ="resources/haarcascade_frontalface_alt.xml";   
  3. privateint minsize = 20;   
  4. privateint group = 0;   
  5. privatedouble scale = 1.1;   
  6. /**  
  7. * Based on FaceDetection example from JavaCV.  
  8. */ 
  9. publicbyte[] convert(byte[] imageData) throws IOException {   
  10. // create image from supplied bytearray 
  11. IplImage originalImage = cvDecodeImage(cvMat(1, imageData.length,CV_8UC1, newBytePointer(imageData)));   
  12. // Convert to grayscale for recognition 
  13. IplImage grayImage = IplImage.create(originalImage.width(), originalImage.height(), IPL_DEPTH_8U, 1);   
  14. cvCvtColor(originalImage, grayImage, CV_BGR2GRAY);   
  15. // storage is needed to store information during detection 
  16. CvMemStorage storage = CvMemStorage.create();   
  17. // Configuration to use in analysis 
  18. CvHaarClassifierCascade cascade = newCvHaarClassifierCascade(cvLoad(CASCADE_FILE));   
  19. // We detect the faces. 
  20. CvSeq faces = cvHaarDetectObjects(grayImage, cascade, storage, scale, group, minsize);   
  21. // We iterate over the discovered faces and draw yellow rectangles around them. 
  22. for (int i = 0; i < faces.total(); i++) {   
  23. CvRect r = new CvRect(cvGetSeqElem(faces, i));   
  24. cvRectangle(originalImage, cvPoint(r.x(), r.y()),   
  25. cvPoint(r.x() + r.width(), r.y() + r.height()),   
  26. CvScalar.YELLOW, 1, CV_AA, 0);   
  27. }   
  28. // convert the resulting image back to an array 
  29. ByteArrayOutputStream bout = new ByteArrayOutputStream();   
  30. BufferedImage imgb = originalImage.getBufferedImage();   
  31. ImageIO.write(imgb, "png", bout);   
  32. return bout.toByteArray();   
  33. }   
  34. }   

原文鏈接:http://www.html5china.com/course/20120528_3742.html

責(zé)任編輯:陳四芳 來源: html5中文網(wǎng)
相關(guān)推薦

2012-04-28 14:01:17

HTML5

2024-06-12 12:57:12

2021-10-13 15:15:22

人工智能AI人臉識(shí)別

2024-09-30 06:04:02

人臉識(shí)別Python機(jī)器學(xué)習(xí)

2021-09-07 09:01:07

人臉識(shí)別人工智能數(shù)據(jù)

2017-03-20 08:58:02

Python人臉識(shí)別AI

2021-08-13 10:01:19

人臉識(shí)別人工智能數(shù)據(jù)

2020-11-18 09:43:29

人臉識(shí)別AI人工智能

2024-11-01 07:00:00

人臉識(shí)別Python機(jī)器學(xué)習(xí)

2022-02-15 13:00:29

人工智能人臉識(shí)別機(jī)器學(xué)習(xí)

2024-07-18 00:00:25

PyTorch神經(jīng)網(wǎng)絡(luò)

2020-12-23 08:29:08

人臉識(shí)別AI人工智能

2017-07-24 15:06:02

代碼人臉識(shí)別實(shí)踐

2019-11-25 13:44:02

人臉識(shí)別AI人工智能

2021-08-06 09:30:34

人工智能AI人臉識(shí)別

2011-08-01 16:43:51

ibmdwHTML5Dojo

2011-09-08 09:38:46

HTML5 WidgeDojo

2009-10-12 08:52:31

HTML5標(biāo)準(zhǔn)

2021-02-03 14:43:40

人工智能人臉識(shí)別

2022-06-16 21:01:32

人臉識(shí)別人工智能生物識(shí)別
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)