我没有如何应用于图片的不同效果的任何想法,如何在像棕褐色,黑色和白色,模糊等位图上应用不同的图像效果(滤镜)?
我已经看到了效果类的EffectFactory类和Effect类有一个方法apply 但我不知道该怎么在inputTexId传递和optputTexId,并从我得到新的更新的图像,如何在imageView中存储更新的图像,
请帮我解决这个问题。 是否有任何开源库可用于为图像提供效果。
感谢,
我没有如何应用于图片的不同效果的任何想法,如何在像棕褐色,黑色和白色,模糊等位图上应用不同的图像效果(滤镜)?
我已经看到了效果类的EffectFactory类和Effect类有一个方法apply 但我不知道该怎么在inputTexId传递和optputTexId,并从我得到新的更新的图像,如何在imageView中存储更新的图像,
请帮我解决这个问题。 是否有任何开源库可用于为图像提供效果。
感谢,
我已经实施了Jerry's Java Image Processing Library。对我来说工作得很好。
下载AndroidJars。
编辑
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
//Find the bitmap's width height
int width = AndroidUtils.getBitmapOfWidth(getResources(), R.drawable.ic_launcher);
int height = AndroidUtils.getBitmapOfHeight(getResources(), R.drawable.ic_launcher);
//Create a filter object.
GaussianFilter filter = new GaussianFilter();
//set???? function to specify the various settings.
filter.setRadius(8.5f);
//Change int Array into a bitmap
int[] src = AndroidUtils.bitmapToIntArray(bitmap);
//Applies a filter.
filter.filter(src, width, height);
//Change the Bitmap int Array (Supports only ARGB_8888)
Bitmap dstBitmap = Bitmap.createBitmap(src, width, height, Config.ARGB_8888);
更详细的信息,您可以使用卡塔拉诺框架:
http://code.google.com/p/catalano-framework/
FastBitmap image = new FastBitmap(bitmap);
image.toRGB();
//Sepia
Sepia sepia = new Sepia();
sepia.applyInPlace(image);
//Blur
Blur blur = new Blur();
blur.applyInPlace(image);
//Emboss
Emboss emboss = new Emboss();
emboss.applyInPlace(image);
//Retrieve bitmap
bitmap = fb.toBitmap();
你的框架的性能如何?我刚刚开始测试一些图片过滤器,并且使用https://code.google.com/p/android-jhlabs/为我试用过的一种过滤器类型获得了非常差的性能。 – Liron 2013-10-14 01:31:25
取决于您使用的过滤器。例如JHLABS中的GaussianFilter应该使用可分离高斯,因此在Catalano框架中使用GaussianBlur的速度要快得多,因为在同一点使用两个方向。但我使用Catalano框架,AForge.NET和Accord.NET测试了基准,还有一些Catalano框架的过滤器优于AForge.NET,反之亦然。 版本1.2正在为并行处理提供新功能。您只需将Catalano.Imaging.Filters更改为Catalano.Imaging.Concurrent.Filters。敬请关注 ! – 2013-10-14 11:18:55
你的ETA是什么? – Liron 2013-10-14 12:41:14
这是一个很好的图书馆,易与gradle这个集成,它是快速 和高效能救了我的一天:
https://github.com/wasabeef/picasso-transformations
这是它是如何使用的例子:
Transformation trans1 = new ContrastFilterTransformation(getActivity(), 1.5f);
Transformation trans2 = new BrightnessFilterTransformation(getActivity(), 0.2f);
Picasso.with(getActivity()).load(uri)
.transform(trans1).transform(trans2).into(imageview3);
您也可以尝试this项目是处理许多Bitmap Processing
过滤器: -
,因为它是Java和母鹿它的像素标签处理速度并不像大多数基于C++的库那样快,但是如果位图大小不是很大,例如缩略图,它会很好用。
你是否在面向Java的应用程序或Android应用程序中实现 – blackjack 2013-05-06 08:45:56
对于android我的朋友,尚未面向Java的应用程序。他们正在对“image”的“整数阵列”进行操作。坏消息是这个库是专门针对android的。但是我们仍然可以从java文件中获取逻辑。 – 2013-05-06 09:24:46
你可以举一个例子如何使用这个库与位图。 – Singhak 2013-12-01 10:31:42