Hai to All
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.
Also refer this Link
You are calling the last three lines too early. You have to wait for the surface to be prepared before calling setPreviewDisplay() and you have to wait for the surface to be sized (surfaceChanged()) before calling startPreview(). This project has what you need.
You almost got the solution for the camera part, Check the code in the real device, i hope it would be working perfect in the device, since its the view from the emulator, you will be getting "white and black grids and a square moving above it." In the real device you will be getting the preview of what you are focusing on.
You are running your app on emulator, connect android based mobile to emulator and try it or copy that file into mobile and install it and then run it.
It will definatly show camera m
Related
I am trying to take 6 photos by rotating my phone for each 60 degree using camera2 api.
First time I need to take first photo using autofocus when focus area is the center of my screen.
And I have to keep this focus for the next 5 photos, it should not try to get new focus.
I have been trying to make it for a week. But the results are not as expected. I tried many ways and I faced few problems: images are blurry, the camera tries to find new focus for each photos, and so on.
It would be great if someone shows me direction :)
i don't know exact answer of your question..but i will try to tell you something's about your Question.
How to use flash without stopping camera feed?
above is link of my Answer.check that
i think ,in your App you have to put some condition for that.
Set your Flash mode regarding Rotation or whatever as you want..Like whenever Your Rotation is this, then Your Flash will this.
Like [On,Auto,Flash].
Hope this will help you...(:
I was looking for a method to use the camera on android devices without a surfaceview or a preview. I found out that, it is impossible to take picture without that preview. However, I have found a tutorial which is actually working taking pictures without a preview. Here is the link: http://www.vogella.com/articles/AndroidCamera/article.html
After switching the camera in the code from front to back-facing the app didn't crashed but it gave me an error 100. So it is only working with the front cam at the moment.
I am using a Samsung Galaxy S3(4.1.2) and i will test it on a Galaxy S2 and a Galaxy S3 Mini.
Anyone a good explanation for this?
You cannot take a picture without starting preview.
While some Android devices are more flexible, and allow takePicture to be called without preview running, this is technically against the API specifications.
It won't work on a large number of devices, so please don't rely on it. That tutorial is wrong, and presumably tested only on one of the devices that allows this behavior.
If you don't want a visible preview, see this question for ways to do that in Android versions >= 3.0.
Actually the time interval of question and answer is large, but may help others.
You can try this library to take picture even from service:
https://github.com/kevalpatel2106/android-hidden-camera
It uses a feature to draw over other apps and create a fake surface. Hope it helps.
I have doing a basic object detection on the camera preview screen in Android (greater than 3.2). For the devices which do not support processing on preview screen, I am buffering the preview screen, processing it and clearing the buffer. This part is working as desired.
What I now want is this app to run in the background while any other app is running in the foreground. I am using android service and am able to run a small test app in the background. However my concern is with the camera preview app.
I don't want to display the preview screen but use the preview screen information for processing. This might be too much to ask, but I wanted to know if this is even possible. I came across this link which shows some hope. Basically I want to process the video (preview) stream without displaying it on the screen. If this is doable, then I can think of putting this app in the background and some other app in the foreground.
Unfortunately I won't be able to share the code, however it is the standard logic of creating a surface view and starting the preview.
I would really appreciate any insight into this.
Check comments here.Basically he opens camera hardware, set preview callback and do startpreview without setting the previewDisplay (this might not work on every device). You can try this from your background service. All this will work if your foreground doesn't access the camera app. Please update this if it works. I am interested to know.
Hi I am wondering what the problem with the galaxy S is. I am using both a nexus S and a galaxy S phones for testing purposes. My whole app works pretty well on Nexus one. But when it comes to Galaxy S I cant see any video. Just hear audio.
Like I said above this doesn't happen on Nexus S. Is there something about the Galaxy S that messes with the SurfaceView? Sometimes I get a quick flash of the video before the screen goes black. My menu's and such still show up just not the video. Any help would be greatly appreciated. If you have know how to fix this kind of problem please help. I will add relevant code if necessary
I know for a fact that the video is playing because in one of the methods that stats the video player i put a logcat which tells me that video is starting to play.
Is it possible that the surface view is being hidden for some reason on the galaxy S?
I'm not sure if this is relevant to you, but i had a similar issue with image assets not displaying on this phone, turns out i needed to use the layout-xhdpi, even though all other phones would default to the standard image in the 'layout' directory
I finally figured out what the Problem was. I am changing some settings in for the aspect ratio. This somehow stops the image from showing up. I will update when i have found a solution.
Edit:
I call setAspectRatio on my my Video after it has been prepared and the video has started in the onPreparedListener.
Edit 2:
The best way around this error is to change the aspect Ration after VideSizeChanged listener is called the first time, as that is when the first dimensions of the video are found.
I want to develop a camera demo app using the following web page example.
http://marakana.com/forums/android/examples/39.html
After taking a photo, I want to display the captured image in the main activity. How can I do this? Thanks.
Best to use another example. I can't get this one to work. Judging by the other Camera questions in SO, I think lots of people have the same problem. But before you give up on Marakana's example completely, try moving the elements OUTSIDE the element. And include the Marko forgot.
By doing that, I got past the RuntimeException, and now get a completely different error, one I think is specific to my phone: it is trying to create a Preview with an 'invalid preview size' of 480x604. But Marko's code sets the size from the size of the preview surface created,, so the phone itself is defaulting to an invalid size for the Preview surface.