hi all, How can I convert the camera preview to a bitmap without use Takepicture ? The goal is to analyze the colors present inside the current preview.
When I try to create bitmap (50x50 pixels of the current view) the result view is green with black lines. Apparently the preview uses the YUV color and I have to translate it in RGB to create my bitmap. I'm using a method found decodeYUV on this group: http://groups.google.fr/group/android-developers/browse_thread/thread/c85e829ab209ceea Below my code and thanks by advance for your help public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Camera.Parameters parameters = mCamera.getParameters(); parameters.setPictureFormat(PixelFormat.YCbCr_422_SP); parameters.setPreviewSize(50, 50); mCamera.setParameters(parameters); mCamera.startPreview(); } Camera.PreviewCallback mPreviewCallback = new Camera.PreviewCallback() { public void onPreviewFrame(byte[] data, Camera camera) { int[] pixels = new int[50 * 50]; decodeYUV(pixels, data, 50, 50); Bitmap bfInit = Bitmap.createBitmap(pixels, 50, 50, Bitmap.Config.ARGB_8888); if (bfInit != null) { imgfinal.setImageBitmap(bfInit); }} -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en