Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Opencv mean shift filtering // exact colors

$
0
0
I am using Opencv to posterize a picture with the function pyrMeanShiftFiltering, but i don't know how to posterize it to the exact 32 colors i need. I don't even know how to tell it that i need exactly 32 colors. This is my code so far. public void run(Mat image, double windowSize, double colorValue){ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Imgproc.pyrMeanShiftFiltering(image,image,windowSize,colorValue,2,new TermCriteria(TermCriteria.MAX_ITER|TermCriteria.EPS, 50, 0.001)); String filename = "/Posterized_"+ (int)windowSize +"."+ (int)colorValue + ".jpg"; System.out.println(String.format("Done. Writing %s", filename)); Imgcodecs.imwrite(filename, image); } public static void main (String[] args) { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat image = Imgcodecs.imread("/Soccer.jpg"); posterize po = new posterize(); po.run(image,10,10); } Any suggestions? Thank you in advance.

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>