saurabh wrote: [...] > The getPixel > function seems to be taking approx 1/100 of a second. Similarly, > checking whether each pixel satisfies the condition and then copying > it to Bitmap B also takes approx 1/100 second. Therefore, performing > these 2 operations for 547*450 = 246150 pixels takes a lot of time. Is > there any way to do this faster?
I'd be inclined to copy all the pixel data out of the Bitmap into a int[] array of pixels; process it in-place; and then copy it all back in again. That way the heavy lifting --- the image processing --- occurs using simple array accesses, which should be way faster than doing method calls on Bitmap. However... > I hope to use this for processing > each frame of a video in real-time. So, processing each picture must > not take more than a 1/20 of a second. ...not a chance! Hopefully this will be improved considerably when the JIT goes in, but right now simply filling an array of the right size with zeroes takes over a second. (I recently had to do something similar; I eventually got around it by pushing all the image processing off into native code via JNI, which of course is not officially supported and probably not a good choice unless you really need it.) -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup
signature.asc
Description: OpenPGP digital signature

