how can i get successive camera frame in android? -


i want capture successive shooting android camera hdr image using 2 image.
code not working. app shooting twice no sound(no shutter sound), , no save file have(there no file).
first, think file name same. so, changed file file code this,

    // create media file name     // add .sss identity     string timestamp = new simpledateformat("yyyy-mm-dd hh:mm:ss.sss").format(new date());      file mediafile;     if (type == media_type_image){         mediafile = new file(mediastoragedir.getpath() + file.separator +         "img_"+ timestamp + ".jpg"); 

second, using synchronized , startpreview(). still not work.

below capture code using "private camera mcamera".

// add listener capture button capturebutton = (button) findviewbyid(r.id.button_capture); capturebutton.setonclicklistener(     new view.onclicklistener() {         @override         public void onclick(view v) {             synchronized (mpicture) {                     // image camera                     camera.parameters cp = mcamera.getparameters();                     cp.setexposurecompensation(cp.getminexposurecompensation());                     mcamera.setparameters(cp);                     mcamera.takepicture(null, null, mpicture);                      // if delete below 5 line work correctly(but, 1 image can get)                     mcamera.startpreview();                      cp.setexposurecompensation(cp.getmaxexposurecompensation());                     mcamera.setparameters(cp);                     mcamera.takepicture(null, null, mpicture);                     mcamera.startpreview();                 }             }         }     ); 

and below picture callback method.

private picturecallback mpicture = new picturecallback() {     string tag = "hdr_tag";     @override     public void onpicturetaken(byte[] data, camera camera) {         file picturefile = getoutputmediafile(media_type_image);         if (picturefile == null){             log.d(tag, "error creating media file, check storage permissions");             return;         }          try {             fileoutputstream fos = new fileoutputstream(picturefile);             fos.write(data);             fos.close();         } catch (filenotfoundexception e) {             log.d(tag, "file not found: " + e.getmessage());         } catch (ioexception e) {             log.d(tag, "error accessing file: " + e.getmessage());         }     } }; 

can give me advice? thanks.
(i'm sorry english skill bad..)

you can image data continuously camera setting previewcallback camera.

camera.setpreviewcallback(previewcallback);  private camera.previewcallback previewcallback = new camera.previewcallback() {     @override     public void onpreviewframe(byte[] data, camera cam) {       //get image data here , save it..       } }; 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -