我不知道如何设置fuzz(y)参数用于flood fill:
图像的模糊成员定义了将两种颜色视为相同时可接受的容差。
这段代码正在工作,将所有像素从红色更改为绿色,但前提是它正好是红色:
ImageInfo imageInfo = new ImageInfo();
DrawInfo drawInfo = new DrawInfo(imageInfo);
PixelPacket targetColor = PixelPacket.queryColorDatabase("red");
PixelPacket greenColor = PixelPacket.queryColorDatabase("green");
drawInfo.setFill(greenColor);
int method = PaintMethod.FloodfillMethod;
boolean success = magickImage.colorFloodfillImage(drawInfo, targetColor, 0, 0, method);
null
基本上,我正在尝试做这个image magick控制台示例所做的事情:
convert cyclops.png -bordercolor white -border 1x1 \
-alpha set -channel RGBA -fuzz 20% \
-fill none -floodfill +0+0 white \
-shave 1x1 cyclops_flood_3.png
那么也许有一种方法可以在图像计算中添加任意参数呢?
Java的一个自己的洪水填充函数(访问了Boolean[],…)让你实现任何颜色比较算法!*自己击掌*
一旦有人找到更好的解决方案,被接受的答案就会被改变…