My goal is to get as high FPS as possible. I will be happy with BW small frames, but FPS should be maximum.
getSupportedPreviewFpsRange
on HTC WildFire S returns (9, 30). But when I try to draw preview image with most simple processing it visually get at about 12-15 FPS max.
After setting Parameters and startPreview()
method call I do this:
camera.setPreviewCallback(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] bytes, Camera camera) {
Bitmap bitmap = Bitmap.createBitmap(size.width, size.height, Bitmap.Config.ARGB_8888);
int[] colors = new int[size.width * size.height];
for (int i=0; i < colors.length; i++){
colors[i] = getBWColor(bytes[i]);
}
bitmap.setPixels(colors, 0, size.width, 0, 0, size.width, size.height);
secondView.setImageBitmap(bitmap);
}
});
}
private static int getBWColor(byte b){
int res = 255;
for(int i=0;i<3;i++){
res = (res << 8) + b;
}
return res;
}
Is there way to get it as fast as possible? =(