我沒有如何應用於圖片的不同效果的任何想法,如何在像棕褐色,黑色和白色,模糊等位圖上應用不同的圖像效果(濾鏡)?
我已經看到了效果類的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