Log in or register to post comments

Using Camera with surface view

January 28, 2011 - 4:49am #6

Hi I want to add a surface view over the camera view....Camera as mentioned in Image targets sample is opened in the native code...The surface view has to be transparent as it is given for glsurfaceview in the same sample.

When im trying to make the background of surfaceview as transparent and trying to draw some thing on it nothing is coming up...even camera is not getting opened....But with glsurfaceview it is hapenning as given in Image target example...

Please tell me where am I wrong.....

Re: Using Camera with surface view

January 28, 2011 - 6:57am #5

Hmm, why are you using a SurfaceView here? Are you trying to lay it on top of the existing GLSurfaceView, or are you replacing that one? The camera image is rendered in the GLSurfaceView, so if you replace it you will lose the camera background.

What are you trying to accomplish? It might be easier done with regular Android Views.

- Kim

Re: Using Camera with surface view

January 30, 2011 - 8:29pm #4

Iam trying to replace the GLSurfaceView.

Ok I will tell you my actual requirment.

I want to have an augmented view over the camera view.For this I made a normal class extending view class and tried to add it over the camera view using addContentView method like it is done for GlsurfaceView and also commented addContentView of GlSurfaceView as i dont need 3d drawing.

Unfortunately my camera is not getting opened but onDraw of my augmented view is getting called.

Is it because I commented the GlSurfaceView addContent method as you said earlier.In that case should i add both the views?

Re: Using Camera with surface view

January 30, 2011 - 9:18pm #3

As you mentioned that if we dont add glsurface view then camera wont render its background.So i added both the views and it is working now:)

Thanks a lot:)

I have one more doubt.What i need is if my application is able to find any trackable in a frame i.e. if it is able to detect any image then it should send something to a java code identifying which image it has detected so that my android code holds the control of what to do if an image has been detected.

Iam a little confused and new also about what to pass to the android code from native code which will be unique for the imge identified.

Re: Using Camera with surface view

January 31, 2011 - 8:28am #2

Great! I'm glad it's working now.

I suggest looking at the following thread for some ideas on sending target information from native to Java. The code snippets provided there will display a Toast message using the Android UI with the name of the currently visible target.


Let me know if you have any questions.

- Kim

Re: Using Camera with surface view

February 2, 2011 - 1:53am #1

Hi Kim

Thanks a lot...Its really helpful.:)

I got another doubt if you can help me.
Its in the below link:

Log in or register to post comments