0

I've seen many threads on this but cannot figure out what is the best possible way of doing camera capture without having a preview.

The way that I am doing it now is that I create a SurfaceTexture like this:
SurfaceTexture fakePreview = new SurfaceTexture(10);

The fakePreview object is not used for any other purpose and is just set as the preview texture, and disposed of when finished with the Activity.

The fakePreview SurfaceTexture is set and the preview then started like this:
mCamera.setPreviewTexture(fakePreview); mCamera.startPreview();

This seems to work fine, but I'm using a rather low-quality sensor and would like to get the highest possible capture quality out of it. So I'm always looking for ways to improve upon this.

I've seen a few methods other than this for starting the camera without showing preview such as setting up a preview normally but setting it's size to 0x0dp: https://stackoverflow.com/a/9745780/593340

As well as using a dummy surfaceholder.callback: https://stackoverflow.com/a/23621826/593340

My question is is there any advantages or disadvantages by using the method I described above?

If my method has issues, do the two other examples posted represent a better answer or are they just as bad?

Thirdly, am I gaining any performance by neglecting to show preview or am I just causing potential bugs by doing this?

Thanks for looking!

-Rob

Community
  • 1
  • 1
RobGries
  • 49
  • 1
  • 9
  • Anyone ever need to do this? I know it's out of the ordinary, but on a headless device it really does not make sense to show a preview. Can anyone even give a wild guess as to what is the best path here. As I've mentioned, the fakePreview surface texture appears to work fine. I'm just trying to ascertain what the best possible pattern to use. – RobGries May 20 '16 at 13:21
  • I have not attempted to implement a preview-less camera. I doubt that the preview approach will impact picture quality, though I could be wrong. – CommonsWare Aug 05 '16 at 12:49

0 Answers0