Ask Your Question

CameraBridgeViewBase from service

asked 2013-09-09 11:26:19 -0500

FreeVMS gravatar image

How use Java Camera in Background(into Service)?

in service at the moment I can only native camera connect.

Java Camera(CameraBridgeViewBase) need initialization with VIEW, like this:

 mOpenCvCameraView = (CameraBridgeViewBase) findViewById(;
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2013-09-11 00:20:14 -0500

itay gravatar image

updated 2013-09-11 00:22:15 -0500

If i understand well, you can try this:

Define JavaCameraView like you do but change the height to 0:

                opencv:show_fps="false" />

It just disapear the camera view but you can still work normaly. This is work for me.

edit flag offensive delete link more


I'm mot sure, that it works well on all devices. JavaCameraView adopts camera resolution to view size, so I'm not sure that camera would initialize correctly if View size is zero.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-09-11 01:23:07 -0500 )edit

I tried the same but it does not work, I am unable to get onCameraFrame callback. Actually onCameraViewStarted itself is not coming, which means camera is not getting initialized

Rishi gravatar imageRishi ( 2013-09-11 04:44:27 -0500 )edit

answered 2013-09-09 12:09:37 -0500

Moster gravatar image

I dont really get the question 100%, but I assume you want to use the JavaCameraView from opencv?

Ive posted source code to use either NativeCameraView or JavaCameraView here:

edit flag offensive delete link more

answered 2013-09-10 09:00:08 -0500

JavaCameraView is inherited from Android View class. So it is a view and you cannot use it in Service directly. It uses standard android.hardware.Camera class, so you can re-implement the same behavior without view object.

edit flag offensive delete link more


Hi Alexander. Could you explain more where and which methods must be reimplemented? In JavaCameraView? I've tested one 1*1 pixel surface as well as invisible surface but none of the methods were successful. The device that I'm testing on is LG G3. Thanks!

Galaxy gravatar imageGalaxy ( 2015-02-23 03:55:08 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-09-09 11:26:19 -0500

Seen: 1,348 times

Last updated: Sep 11 '13