Processingで階調化フィルタを作ったので残しておくことにしました。
[ 使用例 ]
[ プログラム ]
プログラムを実行するとpdeファイルと同じディレクトリ内にフィルタリングされた画像が保存されます。
//階調数 int th = 3; void setup() { PImage i = loadImage("入力画像.png"); int w = i.width; int h = i.height; for(int x = 0; x < w; x++) { for(int y = 0; y < h; y++) { color c1 = i.get(x, y); color c2 = color(Get_Tone(red(c1)), Get_Tone(green(c1)), Get_Tone(blue(c1))); i.set(x, y, c2); } } i.save("出力画像.png"); } float Get_Tone(float p) { float tmp1 = 255.0 / th; float tmp2 = ceil(p / tmp1) * tmp1; return(tmp2); }