0

i'm doing an app for android for image processing.

To do things more fast i used to apply filters on a sample image (using inSampleSize as google reccomend)

when i save the photo (and so apply the effect to the original image) the process take about 16 seconds to finish (5 mpx with a galaxy nexus) so i was thinking if there is a faster way to process the image.

this is the code in which i apply the effect to the real image:

public void executeRealEffect(FileOutputStream ostream)
        throws InstantiationException, IllegalAccessException,
        ClassNotFoundException {//...

    ImageProcessing imp;
    imp = (ImageProcessing) Class.forName(effectUsed).newInstance();
    savePhoto = imp.doEffect(BitmapFactory.decodeFile(pathToPhotoUsed)); 

    savePhoto.compress(CompressFormat.JPEG, 100, ostream);//...

}

and this is an effect taken from internet to try the app : http://xjaphx.wordpress.com/2011/06/21/image-processing-grayscale-image-on-the-fly/

raff0z
  • 61
  • 1
  • 1
  • 5
  • possible duplicate of [Android : Converting color image to grayscale](http://stackoverflow.com/questions/8381514/android-converting-color-image-to-grayscale) – waqaslam Sep 24 '13 at 11:25
  • ok thanks for the link @Waqas and if i use the matrix it take 3-4 seconds and is more aceptable. for Selvin i found opencv for now – raff0z Sep 24 '13 at 12:19

1 Answers1

0

You can use these points

BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 4;
savePhoto.compress(CompressFormat.JPEG, 0, ostream);
savePhoto = imp.doEffect(BitmapFactory.decodeFile(pathToPhotoUsed,options));
Ameer
  • 2,709
  • 1
  • 28
  • 44