Discussing the nuts and bolts of software development

Monday, April 02, 2012

 

Real-time face detection with Android


In this post I will show you how to use the still image FaceDetector class from the Android SDK to achieve (mostly) real-time face detection.  The following method was used in the creation of the MonkeyCam application.

Since its first release, the Android SDK has made available the FaceDetector class, which “identifies the faces of people in a Bitmap graphic object”.  By using the FaceDetector on preview frames from the camera, we approximate the real-time face detection.  For example in the MonkeyCam application we achieved a rate of slightly over one second per frame which is in the same range as other solutions found around the Internet using more complex solutions like third party computer vision libraries.  Short of using the NDK to do GPU programming for the face detection algorithm this was a very usable compromise.


The Camera.PreviewCallback interface provides the onPreviewFrame callback to deliver copies of the preview frames as they are displayed.  The default image format is NV21 and I strongly recommend to stick with it as many cameras don’t support other formats and silently accept a different format from setPreviewFormat() only to return blank frames.  

Now that we have the preview frame in the NV21 format we need to convert it to a bitmap format so we can pass it to the FaceDetector.  Fortunately, since Android 2.2 we can use the YuvImage class to wrap our NV21 frame and then convert it to RGB_565 using its compressToJpeg method and decode the resulting stream into a Bitmap object using BitmapFactory.decodeStream().  For previous versions of the Android SDK you will have to do the conversion manually.

At this point all that is left to do is passing the newly created Bitmap frame to FaceDetector.findFaces and remember to re-add the callback buffer to the Camera object so onPreviewFrame gets called again.  At this point we now have a real-time face detection mechanism, it’s now time to let the creativity flow and add your own touch to make it into something special.


Edit [2012-12-21]: The source code for MonkeyCam as been released under Apache License 2.0 and can be found on github.

Labels: , , , , , , ,


Comments:
Nice but slow. Because of few redundant pixel conversions and copying.
FaceDetector internally converts Bitmap to grayscale, camera offers YUV, which already contains grayscale buffer, but FaceDetector doesn't accept anything else but RGB in Bitmap.

And you even mention conversion to/from JPG, which is overkill for realtime detection.

Shame, but FaceDetector is not good choice for this task to be fast.

Fast would be directly passing chroma values from YUV to detector lib.
 
Its Nice but we want portrait mode using front camera detect the face. Please give suggestions.
 
thanks for share

Chuyên cung cấp cầu nâng 1 trụ rửa xe oto giá rẻ cũng như máy nén khí hitachi giá tốt nhất cho các bạn.. máy rửa xe oto giá ưu đãi.. Sơn tùng lâm cung cấp máy nén khí giá rẻ cũng như máy rửa xe gia đình tốt và tư vấn ben nâng xe máydụng cụ rửa xe máy tại nhà giá rẻ


 
Thích chơi game lậu miễn phí như truy kich full vangkey office 2010 mới nhất cho bạn nào cần cũng như tha thu là gìchơi gunny lậu.... Chuyên tư vấn cách dịch vụ thành lập doanh nghiệp đà nẵng cũng như cách dang ky kinh doanh tai da nang giá rẻ
 
Information from this blog is very useful for me, am very happy to read this blog Kindly visit us @ Luxury Watch Box | Shoe Box Manufacturer | Luxury Cosmetics Box

 
Car Rental in Iran : Tehran -Tehran Airport - IKA-Shiraz - Isfahan-BandarAbbas
car rental tehran airport
iran attractions
iran tours
 
Trying to fix a problem with a too much homework left to do? here you go https://homeworkhelper.net/blog/too-much-homework
 
Dalam permainan judi tentunya anda harus mengontrol permainan dan deposit anda. Agar kekalahan yang anda alami tidak begitu besar. Anda juga tidak bisa menjadikan permainan judi sebagai hobi dan mengisi waktu luang anda saja
asikqq
http://dewaqqq.club/
http://sumoqq.today/
interqq
pionpoker
bandar ceme terpercaya
freebet tanpa deposit
paito warna
syair sgp
 
Awesome post. You Post is very informative. Thanks for Sharing.
Android Training Institute in Noida
 
Keuntungan yang melompat dari ratusan rendah ke ribuan menandakan ketergantungan yang berlebihan pada permainan celah, yang gagal membantu
data sgp
data sydney
datahk
syair sydney
syairsgp
datasgp
paito warna
http://warungsgp.com/
live hk 6d
live sydney
 

Pretty! This was a really wonderful article. Thanks for providing these details. online mobile repair marathahalli

Greetings! Very useful advice in this particular post! online lg display repair
 
It's the little changes that will make the most important changes. Many thanks for sharing! online iphone display repair

Hi there! This blog post could not be written much better! online nokia display repair
 
Assignment Help is completing the process of serving task staying in contact with customers with full interesting and veritable substance. All these are served from us which will reliably give the understudy best and full information on the focuses.
write my assignment
 
sangat mudah untuk bisa daftar slot sbobet, cukup melalui agen resmi dengan mengisi form yang disediakan di situs mereka.

saat ini telah banyak deposit judi slot tanpa potongan yang ditawarkan oleh agen taruhan online sehingga anda bisa mendapatkan keuntungan lebih banyak.

cara baru isi saldo judi yaitu deposit slot sbobet pulsa murah, cukup dengan transfer pulsa kedalam nomor yang ditunjuk oleh agen. Namun anda tetap membutuhkan nomor rekening bilamana anda ingin menarik uang kemenangan bermain slot online.

bandar slot sbobet deposit pulsa kini hadir untuk memudahkan anda dalam mengisi saldo slot online, namun tidak setiap agen memiliki fitur atau layanan ini.

main dingdong online saat ini sangat mudah dengan hadirnya game slot sbobet pulsa yang disediakan oleh bandar judi. Dengan adanya fitur ini telah meningkatkan jumlah member dan juga perputaran uang di dalamnya.
 
Are you looking to hire top quality Custom Term Paper Help Services and cheap Legitimate Term Paper Writing Services? Rather than risking abject failure, you should consider hiring Legitimate Term Paper Help Provider.
 
Custom Research Paper Services from a credible firm like our Legitimate Custom Research Paper Writing Company ensures that you attain excellence, especially in your College Research Paper Services endeavors.

 
Thanks for another informative website. The place else could I am getting that kind of information written in such a perfect means? I’ve a challenge that I’m simply now operating on, and I’ve been on the look out for such info.

Geek Squad Appointment |
Best Buy Geek Squad Appointment |
Best Buy Appointment |
Geek Squad Appointment Scheduling |
Best Buy Geek Squad Appointment Schedule |
BestBuy.com Appointments |
Geek Squad Appointments At Best Buy |
Make An Appointment With The Geek Squad |
Schedule Geek Squad Appointment |
 
Do you know that acquiring Cheap Custom Research Paper Services online is convenient? Seek Legitimate Custom Research Paper services from a credible firm for all your Research Paper Writing Help Assignments.

 
Tapi menjadi bersemangat biasanya hal yang buruk di meja poker. Para pemain menjadi bersemangat dan cenderung mengambil keputusan yang salah
98toto
data sdy
 
Geek Squad Chat is a well-known tech service provider company in the world. Our experts offer support for all types of technical problems faced in computers, laptops and smartphones. They even provide solutions for home appliances, TV, smart wearable and home theatre. We help our customers in setup, installation, repair, uninstallation, replacement, damage and other issues. Our dedicated support team is always available at your service and assures you for the quick resolutions. Book geek squad chat today and get your device fixed without wasting much time.
geek squad chat | |

 
Geek Squad Chat is a well-known tech service provider company in the world. Our experts offer support for all types of technical problems faced in computers, laptops and smartphones. They even provide solutions for home appliances, TV, smart wearable and home theatre. We help our customers in setup, installation, repair, uninstallation, replacement, damage and other issues. Our dedicated support team is always available at your service and assures you for the quick resolutions. Book geek squad chat today and get your device fixed without wasting much time.

geek squad chat with agent |
 
When students seek Business Research Writing Services, they are assured of receiving award winning Business Term Paper Writing Services and Business Assignment Writing Services that meets all their writing needs.

 
Awesome, thanks for the post.

youracclaim | lawrence | minecraft | slides | hackathon
 
collection of high-knowledge words
Data Sgp
Mbah Semar
 
Acquiring Computer Science Assignment Writing Services is convenient? Seek Computer Science Assignment Help Services from a reputable company for your Computer Science Coursework Writing Services online.

 
I am 35 this year and can beat any of my students on any problem. I am still working as a full time consultant at dissertation editing service. I love modern languages and programming.
 

I like the way of your article posting. It is very informative and have importance in future. Hey! If you guys having the issues regarding the printer call our toll free number or visit our website hp com setup at any time 24 x 7.

 
Indeed there are nursing custom writing companies whose ultimate goal is to provide Healthcare Writing Services since they are aware most nursing part-time students lack enough time to complete their college nursing assignments.

 
Psychology assignment writing projects are very difficult to complete and many students are always searching for Psychology Research Paper Services companies to help them complete their psychology coursework assignments.

 
Network engineer requirements include establishing, developing, and maintaining computer networks between organizations. They need to provide support to all users, including team members and clients and fix any issues that occur. They may also have to design new networks.
 
In the wake of following every one of these means your HP printer will doubtlessly get on the web and will work appropriately. Subsequent to taking a shot at these means you can without much of a stretch take care of every one of your issues. visit our website for any printer model issues like WPS Pin on HP Printer related any issues, etc.
 
I really impressed by our post. Thank you for sharing with us. If you are facing problem regarding the HP Envy Printer Offline Fix Windows 10 issues our team is always available for help you at any time in a day by the very few and simple step to resolve the issues by our expert technician. For more detail visit our website or call our toll free number.
 
It is a great post. DocsKart hosts all the documents that are necessary to carry out the business transactions smoothly. This place will evolve over a period of time and soon there will be a day when the documents needs of SMEs will be fulfilled in one place.


 
We are always available for your support regarding the HP Printer Wireless Setup troubleshooting and services. Our team is one of the most certified printer support which are always available 24 x 7. For more detail visit our website our call our toll free number.
 
I impressed by our post. If you are facing problem regarding the Setup HP Envy 5540 Printer Issues issues our team is always available for help you at any time in a day by the very few and simple step to resolve the issues by our expert technician. For more detail visit our website or call our toll free number.
 
Now a day it is very common issues regarding the Fix Epson Printer Error e-01, installation or setup of the new printer or a old one. Call us for troubleshooting your HP Printer related any issues or setup. Our team is always available for you at any time by certified expert. Thank you for the post.
 
Students find International Relations Research Paper Services as being of great assistance since they are able to complete their custom international research papers and international relations essay services on time.

 
Custom Social Science Writing Services is very popular for students in search for social science essay services and social science research paper services.


 
Social science coursework writing services are essential and it has become very popular for those seeking social science research paper writing services since most of them seek Social Science Writing Services.
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?