Ask Your Question
0

CameraBridgeViewBase from service

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

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(R.id.tutorial1_activity_java_surface_view);
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

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

itay gravatar image

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

If i understand well, you can try this:

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

            <org.opencv.android.JavaCameraView
                android:id="@+id/HelloOpenCvView"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:visibility="invisible" 
                opencv:camera_id="any"
                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

Comments

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 -0600 )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 -0600 )edit
0

answered 2013-09-09 12:09:37 -0600

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:

http://answers.opencv.org/question/19796/android-use-autofocus-with-camerabridgeviewbase/#19858

edit flag offensive delete link more
0

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

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

Comments

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 -0600 )edit

Question Tools

Stats

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

Seen: 1,799 times

Last updated: Sep 11 '13