【问题标题】:Android - Slow image processingAndroid - 缓慢的图像处理
【发布时间】:2013-09-24 19:36:02
【问题描述】:

我正在做一个用于图像处理的安卓应用程序。

为了更快地做事,我曾经在示例图像上应用过滤器(使用 inSampleSize 作为谷歌推荐)

当我保存照片(并将效果应用于原始图像)时,该过程大约需要 16 秒才能完成(5 mpx 与银河系连结)所以我在想是否有更快的方法来处理图像。

这是我将效果应用于真实图像的代码:

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);//...

}

这是从互联网上试用该应用程序的效果:http://xjaphx.wordpress.com/2011/06/21/image-processing-grayscale-image-on-the-fly/

【问题讨论】:

标签: android image


【解决方案1】:

你可以利用这些积分

BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 4;
savePhoto.compress(CompressFormat.JPEG, 0, ostream);
savePhoto = imp.doEffect(BitmapFactory.decodeFile(pathToPhotoUsed,options));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-03
    • 2011-01-03
    • 1970-01-01
    相关资源
    最近更新 更多