In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
HTML5-based face recognition technology is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Then open the following address:
Http://neave.com/webcam/html5/face/
When you shake your head, the glasses will move with you and help you put them on.
You can check the source code of the web page to find out the specific implementation details.
I'm the dividing line--
This is a foreign article, which introduces how to realize face recognition on Web browser through WebRTC, OpenCV and WebSocket technology, which is based on Jetty.
The effects achieved include:
Can also recognize the eyes.
The core code of face recognition:
Page:
XML/HTML
Var video = $("# live"). Get () [0]; var canvas = $("# canvas"); var ctx = canvas.get () [0] .getContext ('2d'); navigator.webkitGetUserMedia ("video", function (stream) {video.src = webkitURL.createObjectURL (stream) }, function (err) {console.log ("Unable to get video stream!")}) timer = setInterval (function () {ctx.drawImage (video, 0,0,320,240);}, 250)
JavaScript
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 (); iTunes +) {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 ();}} is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.