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?