addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [londroid] Android NDK & Image processing

From: Reuben
Sent on: Tuesday, March 20, 2012 4:46 PM

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]

Our Sponsors

  • Bloomberg

    Sponsoring & providing the speakers, venue & catering

  • The Telegraph

    Sponsoring the venue & catering

  • babylon

    Sponsoring & providing the speakers, venue & catering

  • Veon

    Providing speaker, drinks & catering

  • Twitter

    Sponsoring & providing the speakers, venue & catering

  • Google

    Offering Pizza & Beer to attendees at key events.

  • Novoda

    Organising speakers, dates, attendees and advocating attendance.

  • Microsoft

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

  • Badoo

    Sponsoring the food and drinks at the event on the 18th October

  • Monzo

    Pizza

  • Facebook

    Sponsoring & providing the speakers, venue & catering

  • SkillsMatter

    Offers use of their meeting areas and recording facilities

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