What I am doing is drawing an image from the camera on to a canvas
, then convert a view
containing an image into a bitmap
and draw it on t
Bitmaps retrieved from the camera are going to be massive (2000+ px wide). Your SurfaceView where you draw the image is only as large as your device resolution (~1000px wide). When you draw the one onto the other, you need to scale it, or it will end up 1/2 the size it should be (as in your screenshots). Here's how I'd modify your code.
view.setDrawingCacheEnabled(true);
viewCapture = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
//Source Rect sized to the surface view.
Rect src = new Rect(0, 0, viewCapture.getWidth(), viewCapture.getHeight());
//Destination RectF sized to the camera picture
RectF dst = new RectF(0, 0, myImage.getWidth(), myImage.getHeight());
canvas.drawBitmap(viewCapture, src, dst, paint);
I know you make some effort to set the camera parameters and size, but either it's not working or you need to take a different approach. I think this should work, though. Your second screenshots, where the Android guy is clipped in both images suggest it's just a simple scaling problem.
Hope that helps!