I developing application for Android OS which helps you to draw with help of camera. App works in way that capture frames from camera trough onPreviewFrame(byte[] data, Camera camera)
, and from here picture is converted to binary black/white. In general app works, but i have following question:
Capture image trough onPreviewFrame is really slow. For now i skip frames but method is still slow.
YuvImage yuvImage = new YuvImage(data, ImageFormat.NV21, width, height, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); yuvImage.compressToJpeg(new Rect(0,0,width, height), 100, baos); byte [] imageData = baos.toByteArray(); Bitmap bmp = BitmapFactory.decodeByteArray(imageData , 0, imageData .length); bmp = Bitmap.createScaledBitmap(bmp, surfaceView.getMeasuredHeight(), surfaceView.getMeasuredWidth(), false); Bitmap bmps = ImageHelper.rotate(bmp, kot);
Is there any way to get picture faster?
I also noticed that every couple frames picutre is not the same (different histogram), although phone is completely still and light is the same.