新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
基于HTML5的人臉識(shí)別技術(shù)
然后打開下面地址:

創(chuàng)新互聯(lián)公司主營北流網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app開發(fā),北流h5微信小程序搭建,北流網(wǎng)站營銷推廣歡迎北流等地區(qū)企業(yè)咨詢
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)的效果包括:
還能識(shí)別眼睛
人臉識(shí)別的核心代碼:
頁面:
XML/HTML Code
復(fù)制內(nèi)容到剪貼板
JavaScript Code
復(fù)制內(nèi)容到剪貼板
- publicclass FaceDetection {
- privatestaticfinal String CASCADE_FILE ="resources/haarcascade_frontalface_alt.xml";
- privateint minsize = 20;
- privateint group = 0;
- privatedouble scale = 1.1;
- /**
- * Based on FaceDetection example from JavaCV.
- */
- publicbyte[] convert(byte[] imageData) throws IOException {
- // create image from supplied bytearray
- IplImage originalImage = cvDecodeImage(cvMat(1, imageData.length,CV_8UC1, newBytePointer(imageData)));
- // Convert to grayscale for recognition
- IplImage grayImage = IplImage.create(originalImage.width(), originalImage.height(), IPL_DEPTH_8U, 1);
- cvCvtColor(originalImage, grayImage, CV_BGR2GRAY);
- // storage is needed to store information during detection
- CvMemStorage storage = CvMemStorage.create();
- // Configuration to use in analysis
- CvHaarClassifierCascade cascade = newCvHaarClassifierCascade(cvLoad(CASCADE_FILE));
- // We detect the faces.
- CvSeq faces = cvHaarDetectObjects(grayImage, cascade, storage, scale, group, minsize);
- // We iterate over the discovered faces and draw yellow rectangles around them.
- for (int i = 0; i < faces.total(); i++) {
- CvRect r = new CvRect(cvGetSeqElem(faces, i));
- cvRectangle(originalImage, cvPoint(r.x(), r.y()),
- cvPoint(r.x() + r.width(), r.y() + r.height()),
- CvScalar.YELLOW, 1, CV_AA, 0);
- }
- // convert the resulting image back to an array
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- BufferedImage imgb = originalImage.getBufferedImage();
- ImageIO.write(imgb, "png", bout);
- return bout.toByteArray();
- }
- }
原文鏈接:http://www.html5china.com/course/20120528_3742.html
網(wǎng)頁題目:基于HTML5的人臉識(shí)別技術(shù)
地址分享:http://www.dlmjj.cn/article/djoeeci.html


咨詢
建站咨詢
