I am making an application using front camera and recently came up with this issue that outcomes of captured image and video are different(left-right inverted) from what I've seen through the display.
So for the image I could process it right after taking the picture because the size of the image wasn't too big - I used matrix preScale to mirror the image.
However, I have no idea how to do that with video capture. I already know that Android default camera does not mirror the front camera video output and lots of famous applications have compromised with default setting. But at the same time there are some camera related applications such as Instagram, Snow Camera, and B612 that do exactly what I want.
So my questions are,
Is it possible to mirror the front camera video output using Android MediaRecorder and Camera class? (That's what I've been using so far)
Or do you have to process the video after you take it? And if so, is there any nice and fast way of doing it?
It would be nice if any of you can answer it specifically. Thank you in advance!
Related
There are already plenty of threads about the android's front camera mirror flip issue but non of them answered my concern.
I just wanted to know if its possible to record what the Camera Preview is currently displaying instead of the media recorder's?
This way, I can be sure that the mirror image is what is going to be written to disk.
I want to capture image from the front facing camera.
Is there a way to detect front facing camera?
I searched a lot and the all the answers I found are quite old 2-3 yrs old.
Do I have to make a custom camera for it or is there any other way?
With the help of these links I was able to create my own front camera to take pictures
Android using front facing camera to take a picture
Access front camera
Android developer camera
Here is the link to final project
Custom Front Camera
This question may be slightly philosophical in nature, but would it be crazy to just capture a photo from the live preview instead of going through takePhoto?
I've found a few examples of how to do so: How to capture preview image frames from Camera Application in Android Programming? and Capture an image from the camera preview.
Right now I'm juggling through inconsistent different EXIF rotation behavior on various phones (it looks like you have a FullExifFixup for all Samsung devices, but I'm having different behavior between my S2 and S4) and I'm wondering if it wouldn't just be easier to grab the preview image.
Is this a stupid idea?
but would it be crazy to just capture a photo from the live preview instead of going through takePhoto?
It would be crazy with the library as it stands, simply because I don't expose the preview frames. :-) That's on the issue list.
it looks like you have a FullExifFixup for all Samsung devices, but I'm having different behavior between my S2 and S4
I don't have an S2 at the moment. If you can provide me with a reproducible test case (including details of the specific model of S2), post an issue, and I can see what I can do.
I'm wondering if it wouldn't just be easier to grab the preview image
It won't be at full resolution of the camera -- you'll be capped at the preview frame size. That being said, plenty of apps work with just the preview frames. Vine, for example, captures its video by capturing the preview frames, due to various problems they ran into when using MediaRecorder (there's a conference talk from a Vine employee that goes into more details).
I am developing an application where I have to take picture without using Media intent i-e without previewing this camera.How can I do this can anyone help me in this regard.
waiting for your reply
Altaf
You cannot take a picture without a preview. Whether it is the preview offered by the Intent or it is a preview that you create yourself with a SurfaceView when you use the Camera object, there has to be a preview.
Just use takePicture() directly on the camera object:
http://developer.android.com/reference/android/hardware/Camera.html#takePicture
I believe some of the older devices wouldn't capture correctly unless preview was setup, but I don't think that's an issue any more. And if you are looking to target devices that require preview you can just resize the preview surface to a single pixel somewhere and put another control on top of it. Still eats resources, but shouldn't be visible.
I am trying to create an app which periodically samples an image in the camera(preview?) and then does some processing on this image (i.e. face detection). I think this is the way to go about this., I have looked into OpenCV but don't think my knowledge is quite up to scratch to get it implemented well enough. My idea is to sample the image (raw format?), convert this to a bitmap image which then a FaceDetector object can detect the faces in the image and indicate this on screen.
Very much like the Native Camera app on the HTC Desire, which puts a grey square around the faces it sees before taking the picture.
Sam,
A sample is provided for capturing the preview stream from the camera: CameraPreview
This would be a great place to start.