views:

227

answers:

3

I'm wondering how fast I can take pictures one after another withoud surprises from the phone (like fx: 'force close;)

Does any of you know that time?

I know that 500 milisec is safe time. When i experiment with 100, 200, 300 milisec there is error but who knows, maybe i do sth wrong.

A: 

That would really depend on the device you are using actually apart from the software problems. I would just run the tests on the phone by automatically taking some fixed number of pictures (like 1000), timing them and finding average time and standard deviation from that. Doing that on a couple of devices and the emulator would definitely give you a sense of how long it actually takes.

pvsnp
at the momenent the only way to make many pictures is to use timer (and there I type after how many milisec next picture should be taken)when I just make a loop(to take 1000 pics) then error appears. So there should be some delay probably. But I tested this on just 1 device.
rmaster
A: 

Well the Motorola droid can take 30fps video, so if you need really fast images, maybe you could use MediaRecorder

Nathan
A: 

This absolutely depends on what you define as "take a picture" - as Nathan mentioned, when recording video (basically a series of scaled-down, compressed pictures) you can "take" a picture every 30ms. But if you define "taking a picture" as copying a 5MP jpeg picture to the SD card, this will probably take longer.

You have to explicitly describe what you mean when you say "just make a loop(to take 1000 pics)," especially when you are complaining of errors.

Assuming you extend the Camera.PictureCallback interface, a lot of processing goes on behind the scenes before you get passed the picture (like jpeg compression, I believe). Have you tried throwing an event inside your implementation of onPictureTaken to take another picture? This might be a safe way of doing and testing what you want. Otherwise if you fire off a ton of "take a picture" events, some kind of heap overflow might happen, I don't know.

Edit: Roughly speaking, this is what I meant:

public void onPictureTaken(
        final byte [] data, final android.hardware.Camera camera) {
    saveDataToFile("/DCIM/tempjpeg.jpg", data);
    camera.takePicture(null, null, this);
}

Call takePicture as soon as you can - right in the callback! DO NOT USE THIS without modification, since this will loop forever. I tried this, and it works for a couple pics, then is just stops responding. If you stop it after two pics, it seems to take under a second on a Nexus One. Hopes that helps.

Rooke
yes, i think you are right, i tested it and more pictures i take, more time it takes to capture another picture etc... bad thingi will try with Camera.PictureCallback rawand then with taking somehow another picture in onPictureTaken(but actually i don't know how)
rmaster
basically i want to take about 2 pictures in 1 secondwith onPictureTaken it works with 1 picture, any next need more timei need just array of bytes that represent pictures pixels because i want to send it immediately to the computer
rmaster
i tried to use your method and it still gives the same results. when we call camera.takePicture stopPreview(); is called and you have to write camera.startPrewiew(); to make another pictureprobably starting prwiew takes time, what do you think about retrieving frames using :| camera.setPreviewCallback(new PreviewCallback() { public void onPreviewFrame(byte[] _data, Camera _camera) { // TODO Do something with the preview image. } }); ?this may work better
rmaster