Is there any way to have a camera preview using the camera2 library while running the application? I only need one method which is able to show in the app the camera preview (not taking pictures or opening the camera APP).
Take a look at CameraView, an unofficial support library widget for drawing camera preview easily (It can also take snapshots, but you can ignore that part).
Related
I want to develop camera functionality for my app where I have to capture 10 images. The camera should not close, rather it should continuously take pictures while I hold the shutter button. I am using intent for opening the camera, but after taking one image the camera is stopping. How can I achieve the desired functionality?
You would need to write your own camera code, using android.hardware.Camera and/or the android.hardware.camera2.* classes. There is no Intent structure that camera app developers are required to support that handles your use case.
Got stuck In a situation, where working on a Camera app for android. The Camera should be customized and
Customized Camera
and not just the built-in. That's fine. I want camera to detect the eyes, while capturing the photo.
But I have few questions:
What to do for preview of a camera
Whether to use TextureView or SurfaceView
After capturing the image, where should it be shown
What is openCV, if I work with Texture- or SurfaceView do I still need openCV
You can start with one of many tutorials, or pick up some boilerplate from GitHub. There is no big difference whether to use TextureView or SurfaceView. You don't need OpenCV unless you need some real time image processing. It is your free choice whether to show captured picture, where and when.
OpenCV is a library that provides implementations of various features, like face detection, image processing etc.
If you plan to use OpenCV, then it provides its own implementation of CameraView that can be used for the CameraPreview.
OpenCV should be used as its methods are rigorous and efficient.
you may want to refer this for your project
https://github.com/hosek/eyeTrackSample
I've looked for tutorials on how to do this but everything I've found uses the deprecated Camera class. Can anybody point me to good resources on how I can show a live camera preview in my app? Or possibly show me some example code with the bare minimum needed to pull up a live preview of the camera?
I want to built my own camera app in android including the following options pinch to zoom and autofocus without using camera intent. I already gone through some samples from Git hub but I couldn't make use of them.So, I decided to start learning Camera API from Google developers. Here I need a complete steps to develop my app and what to learn like camera, surface view and anything else.
Thanks in advance
I have done what you want to be done recently.
For android, there are 2 camera APIs
the camera api
and the camera2 api
camera api is deprecated on android api 21. starting from android api 21, you have to use camera2 api. so you have to learn both of them.
Camera api brother with SurfaceView.
Camera2 api brother with TextureView.
Camera2 api is quit alot different from Camera api, and also is much more complicated than Camera api.
You may want to take a look at my project SimpleCameraView, it is much clear than other projects. I just created this repository yesterday.
Things to Need to Learn to Build Custom Camera APP
Setting Camera,FlashLight and FILE_STORAGE Permissions in Manifest
SurfaceView and How to Use it.
Manual Control of Flash Light.
Lazy Loader for Displaying Images Taken without Memory Leaking.
And you can go through this for Sample : Build Custom Camera
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.