2

I have a layout where the top part is used to display some data (eg. simple UI widgets) and the bottom part has a SurfaceView where I display a CameraPreview.

In order for this SurfaceView to extend the whole width of the screen and at the same time maintain a correct aspect ratio, the SurfaceView actually goes offscreen which is fine since I actually want the app to be divided evenly between the top part and the bottom part.

The problem is that I now want to retrieve only the visible part of the SurfaceView (ideally as a bitmap) but if I try to do it by setting a PictureCallBack, the aspect ratios of the picture data returned are just not quite the same as the ones shown in the SurfaceView (I've tried with all of the available getSupportedPictureSizes).

Any ideas how to tackle this problem? I've attached an image which better illustrates this problem. enter image description here

Henrique
  • 4,921
  • 6
  • 36
  • 61

1 Answers1

0

https://code.google.com/p/zxing/downloads/list

it contains a barcode scanner project in that they have used a rectangle and capture particular area from the surfaceview it will be useful for u .. Hope so they use viewFinderView class to capture the area from the surface

Venkatesh S
  • 5,466
  • 1
  • 25
  • 30
  • Thanks, I took a look at it but it was overly complicated. What I ended up doing was actually working directly with Camera.PreviewCallback and crop the correct image size I needed from the byte[] data provided by this method and not Camera.PictureCallback. – Henrique Nov 06 '13 at 14:23
  • If anyone else is trying to solve a similar issue, let me know and I'll post the code here. – Henrique Nov 06 '13 at 14:25
  • Can you please share your code here. Working on the same issue. – RVG Jan 20 '14 at 09:43