歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android中人臉識別技術

Android中人臉識別技術

日期:2017/3/1 10:18:44   编辑:Linux編程

Android自帶的人臉識別技術只能識別出人臉在畫面中的位置,中心點,眼間距,角度等基本特性,提供給上層應用使用。實際上,咱們也可以 port OpenCV等庫到Android中,來完成相關功能(僅僅只是猜測而已,自己並沒有真正動手實踐過)。

1. 相關背景

Google 於2006年8月收購Neven Vision 公司 (該公司擁有 10 多項應用於移動設備領域的圖像識別的專利),以此獲得了圖像識別的技術,並很快應用到免費的 Picasa 相冊管理程序中,提供基於人臉識別的相片管理功能,另外還推出了一個新項目叫Goggle ,能從照片中識別世界各地的地標建築,同樣Google 也把人臉識別功能添加到了Android 中。不過由於個人隱私等相關因素,Google Goggles好像暫時屏蔽了人臉識別功能 。

2. Android 中的人臉識別技術

底層庫:android/external/neven/

framework 層:frameworks/base/media/java/android/media/FaceDetector.java

Java 層接口的限制:

  • 只能接受 Bitmap 格式的數據
  • 只能識別雙眼距離大於 20 像素的人臉像(當然,這個可在framework層中修改)
  • 只能檢測出人臉的位置(雙眼的中心點及距離)
  • 不能對人臉進行匹配(查找指定的臉譜)

3. 人臉識別技術的應用

A. 為 Camera 添加人臉識別的功能:使得 Camera 的取景器上能標識出人臉范圍;如果硬件支持,可以對人臉進行對焦。

B. 為相冊程序添加按人臉索引相冊的功能:按人臉索引相冊,按人臉分組,搜索相冊。

4.Neven庫給上層提供的主要方法:

android.media.FaceDetector .FaceDetector(int width, int height, int maxFaces)
public FaceDetector (int width, int height, int maxFaces)
Since: API Level 1

Creates a FaceDetector, configured with the size of the images to be analysed and the maximum number of faces that can be detected. These parameters cannot be changed once the object is constructed.

Parameters
width
the width of the image

height
the height of the image

maxFaces
the maximum number of faces to identify

int android.media.FaceDetector .findFaces(Bitmap bitmap, Face [] faces)
public int findFaces (Bitmap bitmap, Face[] faces)
Since: API Level 1

Finds all the faces found in a given Bitmap . The supplied array is populated with FaceDetector.Face s for each face found. The bitmap must be in 565 format (for now).

Parameters
bitmap
the Bitmap graphic to be analyzed

faces
an array in which to place all found FaceDetector.Face s. The array must be sized equal to the maxFaces value set at initialization

Returns
the number of faces found

Throws
IllegalArgumentException
if the Bitmap dimensions don't match the dimensions defined at initialization or the given array is not sized equal to the maxFaces value defined at initialization

Copyright © Linux教程網 All Rights Reserved