简体   繁体   中英

android face detection coordinate

I am using Android's api 14 Camera Face Detection to draw rectangle over face detected by the camera. It works in most devices (Galaxy Nexus, S4, S Note 2). But in S3 SGH-T999 and SGH-I747 (Tmobile and AT&T locked versions) the Face.rect object returned was outside the normal range of [-1000, 1000]. Specifically, Face.rect.left = -1165 (or other numbers < -1000).

Quote from the documentation [Camera.Face.rect] : "The coordinates can be smaller than -1000 or bigger than 1000. But at least one vertex will be within (-1000, -1000) and (1000, 1000)."

This is the method that i use [link here] : onFaceDetection(android.hardware.Camera.Face[], android.hardware.Camera)

Other data:

  • app is set to portrait only
  • app use front facing camera only

My questions are:

  1. Have anyone experienced the same problem?
  2. What does it mean by this smaller than -1000 coordinate ?
  3. How to solve this problem in order to correctly draw the correct rectangle over detected face?

I have looked around for a week and did not find this problem asked by other users. Again, my app works fine in other devices except those two.

Thanks in advance.

I am facing similar kind of issue. What I found is, the face rectangle, obtained from onFaceDetection callback, is from different co-ordinate system in different android phones. I tested my application in Samsung and Micromax. it follows the rectangle coordinates values as per the android documents (ie -1000 to 1000).

When I tested my application on Sony xperia L and Sony xperia M, I observed that it does not follow the coordinate according to android doc. Rather it follows coordinates which has origin (0,0) at right top corner of the screen for portrait mode.

When I applied the matrix according to that, I found the perfect rectangle plotting. This lead me to dig little more into android stack. I believe that it is the vendor of the android phone who manipulate the rectangle coordinate not android original stack.

My question is is there any way to find out that the rectangle obtained, follows which coordinate system before drawing the rectangle?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM