Android :: Overlay Images Onto Camera Preview Surface View

Aug 23, 2010

I have a SurfaceView that is being used to draw custom animations and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the animations has a white- background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing cannot be done on the same SurfaceView. Is it possible to make a SurfaceView transparent? What is the best course to pursue the use of multiple views? My end goal is to essentially overlay the contents of another SurfaceView onto the Camera SurfaceView.

Android :: Overlay images Onto Camera Preview Surface View


Android :: Surface View Draw Images Overlay On Camera Preview

Aug 23, 2010

I have a SurfaceView that is being used to draw images, and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the images have a white-background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing cannot be done on the same SurfaceView. What is the best course to pursue the use of multiple views that involve managing the camera and drawing images? Is it possible to make a SurfaceView transparent?

View 4 Replies View Related

Android :: How To Draw Overlay On Surface View Used By Camera?

May 29, 2010

I have a simple program that draws the preview of the Camera into a SurfaceView. What I'm trying to do is using the onPreviewFrame method, which is invoked each time a new frame is drawn into the SurfaceView, in order to execute the invalidate method which is supposed to invoke the onDraw method. In fact, the onDraw method is being invoked, but nothing there is being printed (I guess the camera preview is overwriting the text I'm trying to draw).

This is a simplify version of the SurfaceView subclass I have:

public class Superficie extends SurfaceView implements SurfaceHolder.Callback {
SurfaceHolder mHolder; public Camera camera; Superficie(Context context) { super(context);
mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
} public void surfaceCreated(final SurfaceHolder holder) { camera = Camera.open();
try { camera.setPreviewDisplay(holder); camera.setPreviewCallback(new PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera arg1) { invalidar();
} } ); } catch (IOException e) {} } public void invalidar(){ invalidate(); }
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Camera.Parameters parameters = camera.getParameters(); parameters.setPreviewSize(w, h);
camera.setParameters(parameters); camera.startPreview(); }
@Override public void draw(Canvas canvas) { super.draw(canvas);
// nothing gets drawn :( Paint p = new Paint(Color.RED);
canvas.drawText("PREVIEW", canvas.getWidth() / 2, canvas.getHeight() / 2, p);
} }

View 1 Replies View Related

Android :: OpenGL On Top Of Camera Preview - Using Two Surface Views

Jul 19, 2009

I have openGL layered on top of camera view by using the 'workaround' specified at-http://groups.google.com/group/android-beginners/browse_thread/thread... and it works great.

However, has been mentioned before that surfaceviews were not designed to be layered ontop of each other- [url]

As you can notice in the code snippet thats mentioned in the first thread, to get openGL working on top of camera we are first setting the contentView to be the openGL view and then adding the camera (on top of it) instead of the other way around as one would expect it. I am assuming there's something strange going on in here as it has also been mentioned that Z-order is not supported on surface views- [url]

Now my question is will all devices have this behavior? Can I use this behavior in my app to get openGL layered on top of camera preview? Please answer this query, its so cool to have openGL over the camera preview! It opens up for some amazing stuff!

View 2 Replies View Related

Android :: Scaling - Animating Camera Preview Surface

Sep 20, 2010

I am using android.hardware.Camera to get a preview and display it on a custom SurfaceView that implements SurfaceHolder.Callback.

I am trying to zoom in to the camera preview surface by a specified scale (not using the camera's digital zoom) but I can't seem to find a correct way to do it. I also need to be able to zoom out and scale down the preview.

I was hoping to be able to do this using a ScaleAnimation but it doesn't seem to work on SurfaceView, nor the FrameLayout containing the SurfaceView.

I also tried setting the size of the SurfaceView using setLayoutParams but that doesn't seem to work too well on various hardware and it would be tough to animate smoothly.

How to achieve this effect? Right now I am starting to think I might have to implement this using GLSurfaceView but I'm very unsure.

View 2 Replies View Related

Android :: How To Overlay Image Over Camera Preview?

Jan 30, 2009

Does someone know how I can overlay an image over the camera preview?

View 6 Replies View Related

Android :: Camera Preview Layout UI Elements Overlay?

Dec 27, 2009

How do I write code which layouts UI elements (Buttons, etc) over camera preview on Android ?

View 2 Replies View Related

Droid :: How To Create Blur Surface From Android.view.Surface?

Jan 22, 2009

How do I create blur surface from android.view.Surface?

View 2 Replies View Related

Android :: Android: How To Initialize MediaRecorder Without A Valid Surface For Video Preview

Aug 9, 2009

I am building a camera app, where videos are continuously being captured and saved to the SD card. The videos are short (few minutes), and their length are preset with setMaxDuration().

The whole process works fine, while the main activity is in the foreground. But, when I go to another activity (e.g. settings), the video recording works in the background only until max duration is reached. The file is saved, but a new sequence can not be started
because prepare() fails, apparently because setPreviewDisplay() doesn't like not having a proper surface to attach to.

I tried to use a dummy Surface, a dummy SurfaceHolder, lockCanvas(), and various other tricks, but nothing works. Is there a way to initialize MediaRecorder without a valid surface?

View 3 Replies View Related

Android :: Building Drawable Images To Use On Surface Canvas

Sep 28, 2010

I have some images (.png format) that I use as drawables on the surface of canvas in my android app. The problem I have is mspaint only allows a rectangular image file, so whatever I draw on the screen always shows up in a box. Is there a (free) program or way I can edit the png files so that when they are drawn on the surface of my canvas, they are drawn to shape?

View 1 Replies View Related

General :: Camera Gallery Dims Images After View On Droid RAZR MAXX

Mar 16, 2014

I have a droid raxr maxx with android 4.1.2

Recently I did a bunch of updates and started using google now. My phone performance has been significantly degraded as a result.

My most pressing issue is that after taking a photo, when I go to view it, it shows as normal brightness for 1 second and then gets very dark. This happens for every image as I scroll through them individually. It appears that I now have some sort of editing option or maybe google photos or picassa has hijacked my viewer. When I click on the gallery app this dimming issue does no occur. I am unable to view photos from the camera after taking them.

View 1 Replies View Related

Android :: Is There Anything Like Itemized Overlay For Images?

Nov 18, 2010

I am searching for functionality which works like the itemizedOverlay on the mapview, only for Imageview. So that I can add items on specific locations on the image and trigger actions on tap of the item. I am building an application for Android where you get Floorplans and on this Floorplan the rooms should be marked and clickable to get more information.

View 1 Replies View Related

Android :: How To Add Image On Surface View?

Aug 29, 2009

I am trying to add an image on surface view. I have coded...

View 5 Replies View Related

Android :: How To Preview All Drawable Images?

Dec 15, 2009

Android framework has variety of icons and images - accessible as R.drawable.* - that can be used by applications for common tasks. Their names give some hint about what they are, but in many cases that's not sufficient. One has to use trial-n-error to find the right icon that fits one's purpose.

My question: Is there a way where I can preview all these images in one place, so that I can quickly decide which ones to use? I have looked inside android source code, but couldn't locate the root of these drawables.

View 2 Replies View Related

Android : How To Add Overlay View Over Other View In Droid?

Sep 24, 2010

I want to put button above image view. How can i do this?

View 2 Replies View Related

Android :: Possible To Start Surface View With Game Thread

Aug 7, 2010

I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way. I've used a couple Activities and xml documents to create a menu that loads when my game starts.When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties.I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu,I get a nullPointerException and it force closes.I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView.I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here.If you need the code snippets I can paste some here, but it's not really the specific code that's wrong.

View 1 Replies View Related

Android :: Way To Change Size Of Surface View On Phone?

Nov 11, 2010

I want to change the size of surface view at run time when it is changed to Landscape Mode?

View 1 Replies View Related

Android :: GL Surface View GlText Image2D GlDrawTexiOES

May 3, 2010

I'm trying to render a 640x480 RGB565 image using OpenGL ES on Android using GLSurfaceView and Native C code. Initially I had a 0x0501 error with glTexImage2D, which I was able to resolve by changing the image dimensions. But now, in the "drawFrame" call, when I do glDrawTexiOES to resnder the texture, I'm getting the following error on the Logs: drawtex.c:89: DrawTexture: No textures enabled I'm already doing glEnable(GL_TEXTURE_2D), is there anything else I should do? Is there a complete example showing GLSurfaceView with native code using textures?

View 4 Replies View Related

Android :: Not Able To Draw A Transparent Image On Surface View / Fix It?

Jul 6, 2010

My objective is to run a glowing animation on an image.I am changing the image alpha to produce this effect.

I have used basic AlphaAnimation provided in android framework but found that its slowing down other animations. So i extended a class from SurfaceView and created a thread to update it. ( Again here, i am manipulating alpha of the image ).

Everything seems fine, except that i am not able to draw a transparent image onto SurfaceView.Its showing black color on the transparent areas of the bitmap.code...

View 1 Replies View Related

Android :: Open GL Surface View Renders Black On First Start

Apr 1, 2009

I have an Activity that was created based on the TriangleRenderer example. It works flawlessly as a standalone project, but when I use it as the tab of a tabhost there is a problem. At startup the whole activity is just black - I can get touch events and do everything else but it doesnt show anything. When I change the orientation (and therefore recreate the activity) it all works well. Maybe the problem comes from the View focus. My SurfaceView is not focused when created inside of the tabhost. I tried to fiddle around with the methods available in my onCreate() and onPostCreate(), but couldnt find a way to get the SurfaceView focused. The following sourcecode blocks in the guardedRun() method because needToWait() is true because !mHasFocus is true. If I exclude the ! mHasFocus, it goes on but shows a black View anyways. Do you have any idea why it does work after orientation change, but not at the first startup? The Activity looks quite simple.

View 2 Replies View Related

Android :: Possible To Start Surface View With Game Thread Anytime / Other Than At Startup Of Program?

Aug 7, 2010

I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way.I've used a couple Activities and xml documents to create a menu that loads when my game starts. When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties.I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu, I get a nullPointerException and it force closes.I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView. I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here.If you need the code snippets I can paste some here, but it's not really the specific code that's wrong, I think it's the way I'm using(abusing) the language.

View 1 Replies View Related

HTC EVO 4G : Screen Face Up - Down On A Desk Surface / Affect Camera Lens On Back?

Oct 9, 2010

Do you put your EVO with the screen face up or down on a desk/surface? I put mine with the screen face up, but will this affect the camera lens on the back?

View 11 Replies View Related

Android :: AR Get Rotation Matrix / Camera Overlay?

Feb 23, 2010

I spend two weeks now trying to get this working with no success. Here is what I want to do: I have several geo points around the user and his phone. I want to display this point overlaying them on the input from the camera (kind of standard AR (Augmented Reality) app). Part of my requirements are that the user can use the phone in either landscape or portrait mode.My plan was like this.
1. Register for Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD 2. Pass the result to Sensor Manager.getRotationMatrix(), getting back the R matrix that should be telling me how to translate points from the Phone coordinate system (defined here: http://developer.android.com/reference/android/hardware/SensorEvent.html) to World coordinate system (x -> East, y -> North, z -> Sky) 3. I want to translate points from World to Phone so I take the inverse of R (I'm using Matrix.invertM()) to get R_In 4. Using the GPS I translate the geo points I want to display on the camera to points in the World coordinate system and then I run them through the R_In matrix to get their coordinates in the Phone system. 5. Draw the points in the screen only if the have (phone coordinates) z < 0 and x and y such that they are visible. This is my grand plan... however I have problems quite early (2). I do get the R matrix back and it looks good when I align the phone to the world coordinate system ( I get the identity matrix ). However when I try to translate an imaginary point from the Phone coordinate system say (0, 1, 0) to the World coordinate system I don't get the numbers I expect.

View 2 Replies View Related

Android :: Overlay Transparent Bitmap On Camera

Aug 10, 2010

I'm passing a bitmap through a bundle to an activity which I called cameraView on which the user has access to the camera of the device. I'd like to overlay that bitmap with transparency using the camera as the background. Is it possible? to put the bitmap in front of the camera? And how can I change the transparency level? Here is my code: This is the camview.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<SurfaceView android:id="@+id/surface_camera" android:layout_width="fill_parent"
android:layout_height="10dip" android:layout_weight="1"> </SurfaceView> </RelativeLayout>

And this is the java:
public class cameraView extends Activity implements SurfaceHolder.Callback{
SurfaceView mSurfaceView; SurfaceHolder mSurfaceHolder;
Camera mCamera; boolean mPreviewRunning=false; private Context mContext = this;
public void onCreate(Bundle icicle) { super.onCreate(icicle);
setContentView(R.layout.camview); Bundle f = getIntent().getExtras();
picture = f.getParcelable("bitmap"); mSurfaceView = (SurfaceView) findViewById(R.id.surface_camera); mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
} @Override // Create the Surface and Open the Camera
public void surfaceCreated(SurfaceHolder holder) { mCamera = Camera.open();
} @Override // Reacts for camera changes public void surfaceChanged(SurfaceHolder holder,
int format, int w,int h) { if (mPreviewRunning) { mCamera.stopPreview();
} Camera.Parameters p = mCamera.getParameters(); p.setPreviewSize(w, h);
mCamera.setParameters(p); try { mCamera.setPreviewDisplay(holder);
} catch (IOException e) { e.printStackTrace();
} mCamera.startPreview(); mPreviewRunning = true;
} @Override // When the camera is closed
public void surfaceDestroyed(SurfaceHolder holder) { mCamera.stopPreview();
mPreviewRunning = false; mCamera.release(); }
// When the picure is taken. This method gives the byte[] of the picture
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
public void onPictureTaken(byte[] imageData, Camera c) {
} };

View 3 Replies View Related

Android :: Camera Application With Compass Direction Overlay?

Jul 12, 2010

I'm a bit new to Android but after searching on the Market, the web and this forum, I can't seem to find anything like this but I feel like it has to exist (or hopefully will soon). I'm looking for a camera application that can place the current compass direction on the image (and stamp the saved image with the direction). The tilt of the phone would be cool to have, too, but just the compass would be great. I did find an application that shows the compass direction on over top of a feed from the camera ("Reality + Compass" by Udell Enterprises).

I want something just like this, but with the ability to save the image. In case you're wondering, I'd like to use this for bettering the storm spotting community. A problem when people send in images of clouds/storms/tornadoes/etc is that you never know (1) where the picture was taken and (2) in what direction. Ideally GPS location could be added, too, but for now I just want the compass. (Other image services can handle the location part fine, like Twitter for Android/Twitpic.)

(I'm on the HTC Aria, but I can sideload apps now thanks to the new version of HTC Sync.)

View 5 Replies View Related

Android :: Camera Preview Not Working On G2

Oct 20, 2010

I'm trying to get the camera preview running on my G2.

This is the code I'm testing with, which was taken from the sample code. It is using supplemental code supplied by Wu-Cheng, but its still throwing an error.

CODE:......................

View 14 Replies View Related

Android :: 2.1 Camera Preview Error

Aug 28, 2010

I have a problem with using the camera of an Android 2.1 phone (HTC Desire), maybe you can help me.
After calling camera.open() DDMS in Eclipse shows the following errors:

CODE:............

Test view in the emulator works fine, but on my phone only a popup is shown where I only can close the application.

View 2 Replies View Related

Android :: Cannot Get Camera Preview Example To Work

Oct 28, 2009

I upgraded to the 2.0 SDK yesterday. Don't know if that has anything to do with it. I can't get the Camera Preview example from the API Demos to work. I get the same error in both my emulator and on my G1:
E/AndroidRuntime( 4758): java.lang.RuntimeException: Fail to connect to camera service.

View 4 Replies View Related

Android :: Possible To Camera Capture Without A Preview?

Jun 30, 2010

Is it possible to capture an image without showing the camera preview?, i have a requirement that i should be able to capture the image from a thread or from a service, without disturbing the foreground application, where i do not want to show the camera preview, but still i want to capture the image in background and store it in the device. So is it possible to do using the Android 2.2 SDK version?

View 3 Replies View Related

Android :: How To Get A Camera Preview In Phone

Jun 25, 2009

Anybody know about the camera Api in android.when i used this Api it displayed a black and white grids and a squre moving above it.Anyone know how to get a real time camera preview please help me with some code.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved