Wednesday, December 18, 2013

Google Glass XE12 Release

Hi all,

XE12 Release 

During thanksgiving, I got my Google Glass Wear. It's a really interesting and exciting new device, you can see them as an extension of your smartphone. But you can do really more : Face Detection (even if Google don't want... ), Voice Control. You can imagine a lot of new usages and business.

At the beginning, just an Android Apps was available MyGlass, if you would to use the GPS or Send a message, you needed a Android phone.

Now, you can do almost the same with an iPhone, MyGlass will be available this week on the App Store : Read this post

All information about the new release: XE12 Release Note


UPDATE 12-18-2013 : Cool feature, you can wink to take a picture. You just need to calibrate the Google Glass in the Setting Menu.

My First Project : Face Detection

Just after to receive my new Glass, my first idea has been to create an Face Dectection App. I can not publish this application in the Glass Store because it's not authorize by Google.
At the beginning, I tried to use the API : Camera.FaceDetectionListener but It sounds like is not available on the Google Glass.


1.   public void onPreviewFrame(byte[] data, Camera camera) {
2.   Log.d(TAG, "onPreviewFrame");
 
3.   // face detection: first convert the image from NV21 to RGB_565
4.   YuvImage yuv = new YuvImage(data, ImageFormat.NV21,
                         i.   mWorkBitmap.getWidth(), mWorkBitmap.getHeight(), null);
5.   // TODO: make rect a member and use it for width and height values above
6.   Rect rect = new Rect(0, 0, mWorkBitmap.getWidth(), mWorkBitmap.getHeight()); 
 
7.   // TODO: use a threaded option or a circular buffer for converting streams?  
8.   //see http://ostermiller.org/convert_java_outputstream_inputstream.html
9.   ByteArrayOutputStream baout = new ByteArrayOutputStream();
10.  if (!yuv.compressToJpeg(rect, 100, baout)) {
11.        Log.e(TAG, "compressToJpeg failed");
12.  }
 
13.  BitmapFactory.Options bfo = new BitmapFactory.Options();
14.  bfo.inPreferredConfig = Bitmap.Config.RGB_565;
15.  mWorkBitmap = BitmapFactory.decodeStream(
16.           new ByteArrayInputStream(baout.toByteArray()), null, bfo);
 
17.  Arrays.fill(mFaces, null);        // use arraycopy instead?
18.  Arrays.fill(eyesMidPts, null);        // use arraycopy instead?
19.  mFaceDetector.findFaces(mWorkBitmap, mFaces);
20.  Log.d(TAG, ""+ mFaces.length);
21.  for (int i = 0; i < mFaces.length; i++)
22.  {
23.      face = mFaces[i];
24.       try {
25.           PointF eyesMP = new PointF();
26.           face.getMidPoint(eyesMP);
27.           eyesDistance[i] = face.eyesDistance();
28.           eyesMidPts[i] = eyesMP;
29.           Log.i("Face",
30.               i +  " " + face.confidence() + " " + face.eyesDistance() + " "
31.               + "Pose: ("+ face.pose(FaceDetector.Face.EULER_X) + ","
32.               + face.pose(FaceDetector.Face.EULER_Y) + ","
33.               + face.pose(FaceDetector.Face.EULER_Z) + ")"
34.               + "Eyes Midpoint: ("+eyesMidPts[i].x + "," + eyesMidPts[i].y +")"
35.               );
36.       }
37.       catch (Exception e)
38.       {
39.               if (true) Log.e("Face", i + " is null");
40.       }
41.  }
42.     invalidate(); // use a dirty Rect?
43.     // Requeue the buffer so we get called again
44.     mCamera.addCallbackBuffer(data);
45.  }



I posted my Google Glass app on my GitHub: 

Currently I think the code is not compatible with the new release XE12 but yes with XE11.
I'm gonna modified the code after having updated my Glass in XE12.

No comments:

Post a Comment