How to give the effect of posterization when viewing images?

I am trying to give Photoshop posterization effect for an image. This is a normal image.

enter image description here

after applying the posterization effect, it should look like this, this effect is taken from pixlr image editor

enter image description here

I want the software result to be accurate.

what I tried, I'm trying to get a similar effect with the SaturationFilter effect, since I can not find the posterization method for android.

here is my function http://pastie.org/8007887

and the resulting image, as shown below, not similar to the ported Photoshop effect, I tried to go through several levels of saturation, but no luck. I hope someone will guide me properly.

enter image description here

found some way, http://developer.android.com/reference/android/media/effect/EffectFactory.html here is a guideline for the posterization effect, and this applies for level 14 of the Android API, how about a device that uses level API <14โ‰ค

+6
source share
3 answers

There is a good library available called Java Image Processing JHLabs .

There are many image processing filters available. I also use this library in my application. It is also very compatible with Android.

You can also download the source code and run the sample application.

JAR Download: http://www.jhlabs.com/ip/filters/Filters.zip

+2
source

You can use the following
1. Android + Open CV
2. Android + Openframeworks

http://www.openframeworks.cc/setup/android-eclipse/
check sample on
https://github.com/nkint/ofxPosterize

+1
source

You can apply this effect by playing in different source code.

I suggest you go with this url and check out another effect https://xjaphx.wordpress.com/learning/tutorials/

The most significant function that I could see is mentioned below, try changing it to suit your needs

int width = mImage.getWidth(); int height = mImage.getHeight(); int[] pixels = new int[width * height]; mImage.getPixels(pixels, 0, width, 0, 0, width, height); for(int x = 0; x < pixels.length; ++x) { pixels[x] = (pixels[x] == fromColor) ? targetColor : pixels[x]; } Bitmap newImage = Bitmap.createBitmap(width, height, mImage.getConfig()); newImage.setPixels(pixels, 0, width, 0, 0, width, height); return newImage; 
+1
source

Source: https://habr.com/ru/post/946562/


All Articles