addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Re: [londroid] Android NDK & Image processing

From: Neil G.
Sent on: Wednesday, March 21, 2012 11:18 AM
Hi all,


Thanks a lot for your feedback, I now have quite a few options to try which is great!

I'll let you all know how I get on and will post a tutorial once I've cracked it.

Thanks again!


Neil

232 Studios Ltd -----------------------------------------------------
Neil Glenister
Technical Creative & MD
-----------------------------------------------------
232
        Studios Ltd
Viral Media | Games | Apps | Interactive

118 Cavendish Road, London, SW12 0DE
M:[masked] | T:[masked]
Follow us: @232studios

-----------------------------------------------------

On 20/03/[masked]:49, Reuben wrote:

As long as you can avoid manipulating pixel values in Java (which will indeed be slow) you should be okay performance-wise... you may not need the NDK at all.

1. Converting from YUV to RGB, you don't need to do this.. you can just ask the OS to provide the preview image in RGB to start with. See Camera.Parameters.setPictureFormat() API at http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPictureFormat(int)

2. A simple yellow effect can be achieved with ColorMatrixColorFilter (see http://developer.android.com/reference/android/graphics/ColorMatrixColorFilter.html). This is a thin Java wrapper around some efficient native pixel manipulation. The matrix you'd use for yellowing would boost the red and green channels, i.e something like :

2,0,0,0,0,   // R
0,2,0,0,0,   // G
0,0,1,0,0,   // B
0,0,0,1,0    // A

You may need to experiment a bit to get the effect you need. 

HTH,


Reuben

On Mon, Mar 19, 2012 at 6:16 PM, Neil Glenister <[address removed]> wrote:
Hi all,


I've been pulling my hair out over some problems with an image processing app and wondered if any of you would be able to help/give advice...

The app essentially takes the live camera feed and applies a simple filter to it (e.g. yellow tint). The problem is that it runs far too slow. The app MUST run without any lag at all for it to be usable.

I've been told that the only viable option is to use the NDK (based on info from tight lipped companies who have achieved this) which I have tried and so far I haven't managed to get it to work. What I'm currently trying to do is push the two intensive parts through the NDK:

1/ Converting the camera image format from YUV to RGB
2/ Applying the filters

The filters and YUV>RGB is readily available in Java so it's "simply" a case of porting it to the NDK. I've tried http://nhenze.net/?p=253 but it doesn't work and I can't get a hold of the developer.

I guess my questions are:

a) Has anyone ever used the NDK with image processing?
b) Is there another way that's been tested and proven?

Thanks a lot in advance for any feedback!


Neil

-----------------------------------------------------
Neil Glenister
Technical Creative & MD
-----------------------------------------------------
232 Studios
                          Ltd
Viral Media | Games | Apps | Interactive

118 Cavendish Road, London, SW12 0DE
M:[masked] | T:[masked]
Follow us: @232studios

-----------------------------------------------------





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Neil Glenister ([address removed]) from The London Android Group - Londroid.
To learn more about Neil Glenister, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Reuben ([address removed]) from The London Android Group - Londroid.
To learn more about Reuben, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

This email message originally included an attachment.

Our Sponsors

  • Novoda

    Organising speakers, dates, attendees and advocating attendance.

  • SkillsMatter

    Offers use of their meeting areas and recording facilities

  • Microsoft

    Sponsoring the food, drinks & ping pong at the event on the 26th April

  • Google

    Offering Pizza & Beer to attendees at key events.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy