Simple Camera2 API code in Android - android

I am developing an app to do some image processing operations on a captured image. I used camera2basic sample as a base to my project but it sometimes takes long time to capture and sometimes crashes which annoying me.
Is there a simple authentic code simpler than camera2basic to use camera2 API with opencv or can I use intent to use the Android camera.

There are a number of projects which aim to put a robust and simpler wrapper aoerund the Android Camera2 API, and they generally support the earlier camera API also.
The two most poplar at the moment seem to be:
https://github.com/Fotoapparat/Fotoapparat
https://github.com/wonderkiln/CameraKit-Android
They are not perfect - take a look at the issues lists and decide yourself.
I have used Fotoapparat and while I did see at least one issue, I found it simpler and more robust than the basic Camera2Basic example code.

If you just want an image to work with, you can use the standard Android image capture intent to get the default camera app to take a picture for you.
See "Taking Photos Simply" in the Android developer docs.

Related

How to show camera preview in Activity?

I came across many solutions on how to preview camera in Activity. But, they all use the deprecated hardware.camera for display.
How to do this using camera2? Any example for this available?
Your natural starting point would be the overview here and set of code samples here. The Camera2Basic samples include code that you wouldn't need if you only want a preview (for example it also contains code necessary for saving a still image). However, I'd recommend starting there and then removing any code that you don't need for your particular purposes.

Auto-zoom feature for QR Code scanner with Google vision

I want to build auto-zoom feature for QR scanner app. I'm using android google vision library.
When user align camera to QR code, if distance from camera to QR code is so far, library cannot decode it, I want camera auto zoom-in into QR code to it can decode. I think camera need to know objects similar with QR. Are there any way to do it?
Following this sample
https://github.com/googlesamples/android-vision
I tried to work with Google Vision, but it just hasn't worked out for me. My use case was simply to read a QR code.
I ended up using Zxing library, and it was really painless if I may add.
I should only mention that, afaik, if you want to read QR code that is perhaps too small, zooming might not help.
[ How can I add zoom in/out gesture in Android vision CameraSource ]
This question might have what you are looking for. They recommend making a call to startSmoothZoom(int) that zooms the physical camera for (int) seconds. You will probably have to modify the CameraSource.cs script in android-vision.
Note: This was depcrecated in API level 21. If this affects you, use the Camera2 api. This is discussed here:
[ android camera2 handle zoom ]. Camera2 is recommended for new applications.

Using webrtc for android,how to save a image in the video call?

I don't know how to get the video frame , so I can't save the image.
Give me some tips. Thanks a lot.
As canvas and rest of the facilities are unavailable in Android we can dodge this situation by taking screenshots and introducing animation in our app's UI. screenshot image can be stored at configured location and resused it later for exchanging it to other party
Edit: One can take reference from AppRTC to capture surfaceview()
https://codereview.webrtc.org/1257043004/
GLSurfaceView () should not work as webrtc library has the hold of camera and screen. One has to build extended class to get Videorenderer and get the snap of frame , Once done one can display the frame using customized api displayFrame() mentioned by cferran in opentok android examples.
You can also use OpenTok library but that is chargeable when compared to webRTC.
If you are interested in using a third party library here is an example on how to implement this use case: https://github.com/opentok/opentok-android-sdk-samples/tree/master/Live-Photo-Capture
If you prefer to use directly WebRTC, here you can find generic information about how to build WebRTC on Android: https://webrtc.org/native-code/android/

Filter Commonsware Cwac Image Android

I am wondering does anyone know how is the best way to implement filters using commonsware-cwac.
I want to update the camera preview each time the user chooses a different filter
Andrew
If you are looking to use filters, do not use the CWAC-Camera library. You are trying to write a real camera app, and that is not what my library is for. Quoting the README:
The targeted use case is an app that might otherwise have relied upon ACTION_IMAGE_CAPTURE, but needs greater reliablilty and somewhat greater control (e.g., capture images directly to internal storage).
If you are trying to write "a camera app" — an app whose primary job is to take pictures — this library may be unsuitable for you.
Please use the Camera2 (Android 5.0+) and Camera (Android 4.4 and older) APIs directly.

Face Recoginition Android/iOS

I want to do Face recoginition (Not Face Detection) in my Android and iOS app. I have studied a lot on Web and found following possible solutions:
1.) openCV: I don't want to go into writing my own API using this. Also, I don't have prior experience in JNI for Android.
2.) Betaface API So far this is good.
3.) Sky Biometrics is also Good.
Now, I am searching for the solution from 3-5 days and came to know that I can use above API (so far I have decided to purchase license for Sky Biometrics). And this API will provide me a list of Features for the faces it recognised.
But, Now I am confused That how to use these features and save in my local data base to recognise faces from the pictures.So My queries are following
1.) How to convert Face features to Actual working Face recognition API means What is the actual algo or solution I can use to merge diffrent face features of a same person to identify him correctly.
2.) Uploading images and then creating database for Face-features set is a very time taking process. Do any one knows any Android/iOS Face Recoginition SDK to do this so that I can do this accurately and timely with no or less time taking process.
3.) Both solution-2 and 3 can be used with Images. Is there any other solution is available which can do the same with less efforts but with more accuracy.
OpenBR may be also interesting for you: http://openbiometrics.org/
Finally I am using Rekognition API. And this is good enough to serve my purpose.

Categories

Resources