I want create a image filter which will create a cartoonizer effect. What I am trying is something like this -
Please help with the procedure to achieve this. I need this to be done in Java.
If a working code is not possible, at least give me some idea how generally this things are done. As there is a lot of websites do this now a days, I assume this should not be too difficult.
What I have tried so far is this -
BufferedImage in = ImageIO.read(new File(basePath + "in11.jpg"));
BufferedImage out = new BufferedImage(in.getWidth(), in.getHeight(), BufferedImage.TYPE_INT_ARGB);
EdgeFilter edgeFilter = new EdgeFilter();
edgeFilter.filter(in, out);
GrayscaleFilter grayscaleFilter = new GrayscaleFilter();
grayscaleFilter.filter(out, out);
InvertFilter invertFilter = new InvertFilter();
invertFilter.filter(out, out);
But this is a code for create a sketch effect (I am using JHLabs Filters from this link ). Output is this -
Now my assumption is if I able to implement a filter which will decrease the number of colours in my image and then if I overlay it with the sketch image I might get my desire effect. But I don't know hot to implement that.
Another way is to use bilateral smoothing filter on its extreme paramters (smooth very much): see example and code.
OpenCV lib is ok for this, it also supports Java, or you can use JavaCV as Java-openCV proxy.