2

我正在做一个基于图像处理的项目,我正在编辑任何具有 40 多种不同效果(如棕褐色、浮雕、雕刻等)的单个图像。现在的问题是,每当我使用任何高分辨率高清图像时,都会花费大量时间至少 15 分钟才能加载该图像上的所有效果。如何减少这个时间,我没有使用 OpenCV API。下面是我的代码。

   public class Image_add_effects extends Activity implements OnClickListener{
ImageView image;
HorizontalScrollView view;

ImageView mSwitcher;
ArrayList<Bitmap>array_image;
Bitmap image_compress;
 BitmapDrawable drawable,drawable_image;
 Bitmap changed_image;
 Gallery g;
 ImageView img1,img2,img3,img4,img5;
 Bitmap bit1,bit2,bit3,bit4,bit5;


@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.add_effects);
    setBodyUi();
    System.loadLibrary("PhotoProcessing");

     changed_image=Image_effects.image_change;
     ByteArrayOutputStream stream = new ByteArrayOutputStream();
     //System.out.println("yourSelectedImage"+yourSelectedImage);
     changed_image.compress(Bitmap.CompressFormat.JPEG, 100, stream); 

    new SendImage().execute();
}

public class SendImage extends AsyncTask<String, Process, String> {

    ProgressDialog pb;
    String the_string_response;
    String image_str;

    @Override
    public void onPreExecute() {

        pb = ProgressDialog
                .show(Image_add_effects.this, null, "Processing....");


    }

    @Override
    protected String doInBackground(String... params) {




        bit1=(Effects_change.doInvert(image_compress));
        bit2=(Effects_change.doHighlightImage(image_compress));
        bit3=(Effects_change.applyGaussianBlur(image_compress));
        bit4=(Effects_change.sharpen((image_compress),20));
        bit5=(Effects_change.applyMeanRemoval(image_compress));
        bit6=(Effects_change.smooth((image_compress),8));
        bit7=(Effects_change.emboss(image_compress));
        bit8=(Effects_change.engrave(image_compress));
        bit9=(Effects_change.applyHueFilter((image_compress),9));

        bit10=(Effects_change.doGreyscale(image_compress));
        bit11=(Effects_change.doGamma((image_compress),0.6, 0.6, 0.6));
        bit12=(Effects_change.doGamma((image_compress),1.8, 1.8, 1.8));
        bit13=(Effects_change.doColorFilter((image_compress), 1.0, 0, 0));
        bit14=(Effects_change.doColorFilter((image_compress), 0, 1, 0));
        bit15=(Effects_change.doColorFilter((image_compress), 0, 0, 1));
        bit16=(Effects_change.doColorFilter((image_compress), 0.5, 0.5, 0.5));
        bit17=(Effects_change.doColorFilter((image_compress), 1.5, 1.5, 1.5));
        bit18=(Effects_change.createSepiaToningEffect((image_compress),100, 1.5, 0.6, 0.12));
        bit19=(Effects_change.createSepiaToningEffect((image_compress),200, 0.88, 2.45, 1.43));
        bit20=(Effects_change.createSepiaToningEffect((image_compress),255, 1.2, 0.87, 2.1));

        return null;
    }

    @Override
    public void onPostExecute(String result) {
        super.onPostExecute(result);

        img1.setImageBitmap(bit1);
        img2.setImageBitmap(bit2);
        img3.setImageBitmap(bit3);
        img4.setImageBitmap(bit4);
        img5.setImageBitmap(bit5);

        pb.dismiss();
    }

}

我在上面的代码中使用这个链接:http: //xjaphx.wordpress.com/2011/06/21/image-processing-grayscale-image-on-the-fly/

当我正在制作一个 Android 应用程序时,由于我是图像处理的新手,所以我做同样的事情变得越来越困难。如何为图像添加效果?

4

1 回答 1

0

尝试使用Catalano 框架。这是解释如何使用的文章。

于 2014-01-14T01:19:17.850 回答