Ich versuche, das Bild von der Kamera mit diesem Projekt https://github.com/googlesamples/android-vision/tree/master/visionSamples/FaceTrackercamerasource Takepicture nicht funktioniert
den Code zu erfassen und speichern Bild zu erfassen ist in Gesichtsnachführung Aktivität Java-Datei
final CameraSource.ShutterCallback shutterCallback = new CameraSource.ShutterCallback() {
@Override
public void onShutter() {
Log.d(TAG, "onShutter");
Toast.makeText(view.getContext(),"sd",Toast.LENGTH_SHORT).show();
}
};
CameraSource.PictureCallback myPictureCallback_JPG = new CameraSource.PictureCallback(){
@Override
public void onPictureTaken(byte[] arg0) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);
//save file
String path = Environment.DIRECTORY_DCIM.toString();
//Toast.makeText(getApplicationContext(),path,Toast.LENGTH_SHORT).show();
OutputStream fOut = null;
File file = new File(path, "FitnessGirl"+".jpg"); // the File to save to
try{
fOut = new FileOutputStream(file);
bitmapPicture.compress(Bitmap.CompressFormat.JPEG, 85, fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
MediaStore.Images.Media.insertImage(getContentResolver(),file.getAbsolutePath(),file.getName(),file.getName());
fOut.flush();
fOut.close(); // do not forget to close the stream
}catch (FileNotFoundException exception){
}catch (IOException e){
}
//save file
}};
mCameraSource.takePicture(shutterCallback, myPictureCallback_JPG);
obigen Code ist nicht arbeiten, kann jemand helfen?
Sie Antwort auf diese gefunden? – NGR