bitmap - Android: how to save the first preview frame from SurfaceView -


i wondering if possible save first frame camera preview, visible on surfaceview. within activity i've implemented surfaceholder.callback methods. when call startpreview on camera object , takepicture callback executed correctly, need take , save picture more quickly, take first visible frame of preview useful. can do?
suggestion appreciated.

it might seem incredibly simple, save first frame bitmap.

mcamera.setpreviewcallback(new previewcallback() {                 public void onpreviewframe(byte[] data, camera camera) {                      if (image == null) {                         out = new bytearrayoutputstream();                         yuvimage = new yuvimage(data, imageformat.nv21, camera                                 .getparameters().getpreviewsize().width, camera                                 .getparameters().getpreviewsize().height, null);                          yuvimage.compresstojpeg(new rect(0, 0, camera                                 .getparameters().getpreviewsize().width, camera                                 .getparameters().getpreviewsize().height), 0,                                 out);                          imagebytes = out.tobytearray();                         image = bitmapfactory.decodebytearray(imagebytes, 0,                                 imagebytes.length);                     }                  }             }); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -