Ask Your Question
6

android::camera on google Glass

asked 2013-09-05 07:59:48 -0600

Manuel gravatar image

updated 2013-09-05 18:15:51 -0600

Dear android/opencv developers, We recently received google Glass and wanted to continue using the android camera from the C side with building a camera wrapper as you do on OpenCV. With some ifdefs and hacks it works nicely for the different platforms and phones but for Glass I'm stuck. Did any of you try/play around with a custom camera wrapper for Glass?

The problem seem to be that somehow creating the SurfaceTexture fails or is not properly initialized. I already posted on StackOverflow for #google-glass but no answer there yet. I briefly repeat the things I tried and where it fails:

When we setup the preview we do

android::sp<android::SurfaceTexture> surfaceTexture(new android::SurfaceTexture(0x10)); 
if(pimpl->camera->setPreviewTexture(surfaceTexture) != 0)
{
   LOGE("setPreviewTexture call failed");
   return false;
}

There everything seems to be fine (even when you ask the camera if everything is fine, it lies and returns true), but later when you use the camera (e.g. dumpParameters()) the app crashes immediately. The part that I do not fully understand: When I remove the setPreviewTexture(..) call but still create the shared pointer of the SurfaceTexture you'll end up with a heap corruption when the shared pointer goes out of scope.

btw:

  • same behaviour when you use the OpenCV camera_wrapper for android.
  • I built our android camera wrapper agains android sources 4.0.4_r2.1 as Glass reports to be 4.0.4 and I simply used the latest sources.

Any idea/suggestion where/what to debug? Or did anyone manage to use the Glass camera with a native camera wrapper?

edit retag flag offensive close merge delete

Comments

I am having the same issue. I've tried generating my own SurfaceTexture using glGenTextures() and glBindTextures() instead of that "magic number", but to no avail.

RyanDuToit gravatar imageRyanDuToit ( 2014-04-02 18:04:33 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-3

answered 2013-10-11 10:57:38 -0600

Hi:

I am guessing you are using native apps instead of JavaCV. If that is the case I can't help you. But for the JavaCV part I can say that it works fine. If you downloaded the OpenCV4Android folder. You can run those examples and they should work right away. Did you try those?

edit flag offensive delete link more

Comments

i doubt, that you even read the question

berak gravatar imageberak ( 2013-10-11 11:14:20 -0600 )edit

That't the point. I don't use the Java part (at all). All the computation is done on native (C/C++) level.

Manuel gravatar imageManuel ( 2013-11-15 02:06:26 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-05 07:59:48 -0600

Seen: 814 times

Last updated: Oct 11 '13