0

私の Android カメラは画像全体を onPreviewFrame に渡していますが、ピクセル範囲に対応するバイトだけが必要です。たとえば、ピクセルが 480x640 の画像が渡されます。Rect(100,100,200,200) の範囲のピクセルを含む新しい byte[] 配列が必要です

public void onPreviewFrame(byte[] arg0, Camera arg1) {
    // arg0 = 460,800 BYTES
    // the camera's resolution is at 640 x 480
    // arg0 format is NV21
}
4

1 に答える 1

0

http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.htmlを使用してみてください

そして、BitmapRegionDecoder クラスのメソッド newInstance(InputStream stream, boolean isShareable) と、次に使用することができます

BitmapRegionDecoder decoder = newInstance(stream,false)
Bitmap region = decoder.decodeRegion(new Rect(x, y, x1, y1), null);
于 2012-08-15T18:47:33.967 に答える