Android - Taking many camera pictures in short amount of time - android

I have an Android application in mind that would require taking as many camera pictures as possible in say about 1 or 2 seconds.
I've thought of two possibilities:
1) Take various pictures for 2 seconds.
2) Record a video for 2 seconds and extract the frame images.
Which option do you suggest?
Do you think it would be possible to have at least 5 images per second with current hardware?

i suggest the second. Because if the shutter speed of camera is low, the the app cant take multiple photos in one or two second. So better capture video and extract frames. but the problem is that video quality my be lower than image.

The fastest Method is to use the video function (multiple Frames per second).
But if you want to have hq pictures, it depends on your device:
This should help:
Android camera takePicture() method execution time
http://www.workreloaded.com/2011/06/how-to-use-the-android-camera/

Im quite sure extracting frames from video will be all blurry, at least when objects or the phone are moving. Just take a video and pause it to check.

Related

(Camera2 API) Can I run 2 ImageReader instances of different configs at the same time?

I am modifying (Java) the TF Lite sample app for object detection. It has a live video feed that shows boxes around common objects. It takes in ImageReader frames at 640*480.
I want to use these bounds to crop the items, but I want to crop them from a high-quality image. I think the 5T is capable of 4K.
So, is it possible to run 2 instances of ImageReader, one low-quality video feed (used by TF Lite), and one for capturing full-quality still images? I also can't pin the 2nd one to any Surface for user preview, pic has to be captured in the background.
In this medium article (https://link.medium.com/2oaIYoY58db) it says "Due to hardware constraints, only a single configuration can be active in the camera sensor at any given time; this is called the active configuration."
I'm new to android here, so couldn't make much sense of this.
Thanks for your time!
PS: as far as I know, this isn't possible with CameraX, yet.
As the cited article explains, you can use a lower-resolution preview stream and periodically capture higher-rez still images. Depending on hardware, this 'switch' may take time, or be really quick.
In your case, I would run a preview capture session at maximum resolution, and shrink (resize) the frames to feed into TFLite when necessary.

How to improve captured image resolution with Camera2 API android?

I am using this project android-camera2-secret-picture-taker to capture image without open camera view, but the captured images is very bad like this
any help to make this better?
thanks
[Edit]
I tried other phones and it works fine, I take this bad images on Huawei Y6II only and I don't know why? the phone camera is 13 mpx and works fine with native camera app.
Did you issue only a single capture request to the camera device? (No free-running preview or such).
Generally, the auto-exposure, focus, and white-balance routines take a second or so of streaming before they stabilize to good values.
Even if you don't want a preview on screen, you need to request 10-30 frames of data from the camera to start before you save a final image. Or to be more robust, set a repeating request targeting some low-resolution SurfaceTexture, and wait until the CaptureResult CONTROL_AE_STATE / AWB_STATE fields reach CONVERGED, and the AF_STATE field is what you want as well (depends on what AF mode you're using). Then capture your image.
This is a wildly blind guess, but hey, worth a try.
If you used some code snippet from the web which suggests to get a list of supported image sizes and just pick the first one - well this has backfired for me on Huawei devices (more than one model) because Huawei seems to provide the list in the ascending order of resolution (i.e. smallest-first), whereas most other devices I've seen does that in descending order (i.e. largest-first).
So if this is a resolution issue, it might be worth a check.

How to get frames from video files and process them in real time

I'm writing an application to add some effects by editing frames (like moving pixels, removing, adding... not just put effects on it) from video files. Is there a way to get frames and render edited frames to the screen in real time?
Many thanks in advance.

Copy consecutive frames from video

I'm trying to copy a part of a video, and save it as a GIF into the disk. The video can be local or remote, and the copy should be 2s max. I don't need to save every single frame, but every other frame (12-15 fps). I have the "frames to gif" part working, but the "get the frames" part is not great.
Here is what I tried so far:
- MediaMetadataRetriever: too slow (~1s per frame on a Nexus4), and only works with local files
- FFmpegMediaMetadataRetriever: same latency, but works with remote video
- TextureView.getBitmap(): I'm using a ScheduledExecutorService and every 60ms, grab the Bitmap (while playing...) It works well with small size getBitmap(100, 100), but for bigger ones (> 400), the whole process becomes really slow. And as the doc says Do not invoke this method from a drawing method anyway.
It seems that the best solution would be to access every frame while decoding, and save them. I tried OpenCV for Android but couldn't find an API to grab a frame at a specific time.
Now, I'm looking into those samples to understand how to use MediaCodec, but while running ExtractMpegFramesTest.java, I can't seem to extract any frame ("no output from decoder available").
Am I on the right track? Any other suggestion?
edit: went further with ExtractMpegFramesTest.java, thanks for this post.
edit 2: just to clarify, what I'm trying to achieve here is to play a video, and press a button to start capturing the frames.

cut a video file into many images and combine it in Android

I just started to study android so I barely know android library.
Would you introduce some library so I can figure out the problem?
The reason I'm trying it is that there is no available parameter to manage shutter speed.
I would like to exposure image sensor a long time but I found it's not supported by firmware.
So I planned to record a video and cut it. Then, combine it together so it would be like long shutter speed picture.
Thank you for reading
I don't really understand what you're trying to do.
How capturing multiple frames will allow you to simulate different shutter speed.
Assuming you know what you're doing, check out this SO.
You can start recording for any time period you want, save all the images to files/memory and then do whatever you want with the frames.

Categories

Resources