First time here? Check out the FAQ!

Ask Your Question
6

android::camera on google Glass

asked Sep 5 '13

Manuel gravatar image

updated Sep 6 '13

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?

Preview: (hide)

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 (Apr 3 '14)edit

1 answer

Sort by » oldest newest most voted
-3

answered Oct 11 '13

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?

Preview: (hide)

Comments

i doubt, that you even read the question

berak gravatar imageberak (Oct 11 '13)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 (Nov 15 '13)edit

Question Tools

1 follower

Stats

Asked: Sep 5 '13

Seen: 864 times

Last updated: Oct 11 '13