Android (onPreviewFrame): Speichern NV21 Daten als JPEG-Datei

Ich habe den folgenden code für onPreviewFrame() Rückruf. Es ist nun in der Lage, die Daten zu speichern als JPEG-Datei und ich kann Sie in einem browser, aber nicht in der Windows Bild-Viewer. Gibt es etwas falsch mit meinem code?

YuvImage im = new YuvImage(data, ImageFormat.NV21, size.width,
                        size.height, null);
Rect r = new Rect(0,0,size.width,size.height);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
im.compressToJpeg(r, parameters.getJpegQuality(), baos);

try{
   FileOutputStream output = new FileOutputStream(String.format(
        "/sdcard/%s_%d.jpg", strPrevCBType, System.currentTimeMillis()));
   output.write(baos.toByteArray());
   output.flush();
   output.close();
}catch(FileNotFoundException e){
}catch(IOException e){
}

Dank,

artsylar

InformationsquelleAutor artsylar | 2011-07-13
Schreibe einen Kommentar