我的想法是:
1.0. [unsolved, hard image-detection] Breaking image into squares and removing borders, surely other techniques!
1.1. [unsolved] Imagemagick: crop (instructions here), remove certain borders -- this may take a lot of time to locate the grid, image detection problem (comparing white/black here) -- or there may be some magic wand style filter.
1.2. [unsolved] Python: you probably need this
from PIL import Image
.
显然,Gimp 的橡皮擦是解决此问题的错误方法,因为它速度慢且容易出错。您将如何以编程方式删除网格?
附言在 Graphics.SE 中随意讨论这个问题 here包含更多物理和机械技巧。
最佳答案
如果所有图像都由灰色网格上的黑线组成,您可以调整白色阈值以移除网格(例如使用 ImageMagick):
convert -white-threshold 80% with-grid.png without-grid.png
您可能必须对确切的阈值进行试验。 80% 的样本图像对我有用。这将使线条像素化。但也许重新采样可以将其减少到可接受的数量,例如与:
convert -resize 200% -white-threshold 80% -resize 50% with-grid.png without-grid.png
关于python - 如何以编程方式删除黑色网格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11342797/