Discussion:
Camera preview to an invisible SurfaceView
Boshik
2008-12-19 15:35:40 UTC
Permalink
Hi Guys,

Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.

I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?


Thanks,
Alex
Mark K
2008-12-19 16:46:40 UTC
Permalink
I don't think this is possible. Doesn't seem like Android supports
'headless' graphics implementations.

Mark
Post by Boshik
Hi Guys,
Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.
I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?
Thanks,
Alex
blindfold
2008-12-19 20:54:23 UTC
Permalink
Post by Boshik
Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.
Just do not use setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) and
the preview remains invisible. (The surface view itself may be
visible, but now without the camera preview, so you have full control
over what you display.)
Post by Boshik
I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?
Yes, my app at http://www.seeingwithsound.com/android.htm does exactly
that.

Without the SURFACE_TYPE_PUSH_BUFFERS, the preview callback will still
give you the (header-less) image data[] that you can use to fill a
Bitmap, although you must use your own (very slow, pixel-by-pixel)
preview decoder for that because Android SDK 1.0r2 is still lacking
any support for preview decoding. The bitmap can then be drawn to a
Canvas for display at any size and anywhere on the screen.

Regards
Post by Boshik
Hi Guys,
Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.
I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?
Thanks,
Alex
Boshik
2008-12-20 09:37:27 UTC
Permalink
Thank you very much! Now it works! in the emulator BUT on my G1 it
shows only black screen.
The problem possibly caused by using GLSurfaceView (from the API
Demos) as a preview surface. Is it possible to avoid that?
Post by blindfold
Post by Boshik
Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.
Just do not use setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) and
the preview remains invisible. (The surface view itself may be
visible, but now without the camera preview, so you have full control
over what you display.)
Post by Boshik
I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?
Yes, my app athttp://www.seeingwithsound.com/android.htmdoes exactly
that.
Without the SURFACE_TYPE_PUSH_BUFFERS, the preview callback will still
give you the (header-less) image data[] that you can use to fill a
Bitmap, although you must use your own (very slow, pixel-by-pixel)
preview decoder for that because Android SDK 1.0r2 is still lacking
any support for preview decoding. The bitmap can then be drawn to a
Canvas for display at any size and anywhere on the screen.
Regards
Post by Boshik
Hi Guys,
Is it possible to capture camera snapshots to bitmaps WITHOUT creating
a visible surface view? All samples I saw over internet uses camera
preview directly to a surface view and the surface view underneath
must be visible.
I need a way to capture camera images in the background and only then
show captured images somewhere on the screen. Is it possible?
Thanks,
Alex
blindfold
2008-12-20 10:04:46 UTC
Permalink
Post by Boshik
The problem possibly caused by using GLSurfaceView (from the API
Demos) as a preview surface. Is it possible to avoid that?
Don't know, I use a SurfaceView but no OpenGL, so maybe the hardware
acceleration and buffers on the G1 make the difference when using
OpenGL. I have no experience with that.
Post by Boshik
Thank you very much! Now it works! in the emulator BUT on my G1 it
shows only black screen.
The problem possibly caused by using GLSurfaceView (from the API
Demos) as a preview surface. Is it possible to avoid that?
Loading...