Ask Your Question
3

Another way to use camera

asked 2012-07-27 13:06:14 -0600

Astor gravatar image

updated 2012-07-27 13:07:35 -0600

I'm developing Android project that uses device camera as image input. I decided to use OpenCV native (c++) interface because of perfomance.

My test (and personal) device is Mororola Defy. Unfortunatelly there's a known issue that Motorola (and some other) devices have black screen even on non-native (basic) samples.

Fortunatelly there's known fix of that problem. And it worked fine for me.

The problem is that perfomance of such method is very low - I have simple application (no image processing, just showing image on device screen) and it has 5fps on both Motorola Defy and Sony Ericsson Arc S (image size is 640x480).

So my quesion is very simple - is there any other way of fixing that problem? Or the only solution for me now is to wait for the bugfix? In Android Marker I've seen apps that use OpenCV library and their perfomance is actually good.

Thanks for any advice!

edit retag flag offensive close merge delete

Comments

Nice description, but no good answer yet :( Could you please provide links to the apps? Do they work on your Motorola Device?

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-07-28 03:52:05 -0600 )edit

Thanks Kirill to your answer. Just type in Google Market "OpenCV" and choose any of founded results. And, yes, these applications worked on my motorola. Actually I was a bit wrong - their perfomance isn't much higher then my application. But anyway looking for a good way to boost application.

Astor gravatar imageAstor ( 2012-07-29 04:03:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-07-28 12:00:47 -0600

sammy gravatar image

I've found that a very good way to process frames on Android is to open a camera preview (the one used to take photos) and register a delegate for the onPreview() event. You usually have a high framerate.

But you have to offload the processing to another thread. The best way is to immediately make a copy of the frame and send it to another thread, to process. Failing to do so will turn your system upside down, because if another frame comes and you still process the previous one, the callback will mess everything up.

All this is done in Java, and you have to link it to JNI in order to use C++.

edit flag offensive delete link more

Comments

Sounds good! Can you post link to tutorial or code? Because I'm new in Android development.

Astor gravatar imageAstor ( 2012-07-29 04:05:14 -0600 )edit

I have no code to post, but you can look at developer.android.com, at camera samples.

sammy gravatar imagesammy ( 2012-07-29 06:17:45 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-07-27 13:06:14 -0600

Seen: 1,258 times

Last updated: Jul 28 '12