如何叠加 2 个二进制图像以在 Ubuntu 上保存白色?
How can I overlay 2 binary images to save the white color on Ubuntu?
假设有两个相同的二值图像(所有像素都是黑色的)。然后你拍摄第一张图像并将一些像素设为白色(例如,点 (10,10)
和 (11, 11)
)并对第二张图像的点 (5, 4)
执行相同的操作并保存结果图片为 image1.png
和 image2.png
。
目标是创建第三个图像 (result.png
),每个像素都为黑色,但有 3 个点:(5, 4)
、(10,10)
和 (11,11)
应该是白色的。如何在 Ubuntu 中自动执行此操作?
composite 看起来是一个值得研究的好命令。我尝试使用 composite -blend
然后没能找到正确的命令来保存白色。
给定 image1.png
白点 @ 10,10 & 11,11
convert -size 100x100 xc:black -fill white -draw 'point 10, 10' -draw 'point 11,11' image1.png
和 image2.png
白点 @ 5,4
convert -size 100x100 xc:black -fill white -draw 'point 5,4' image2.png
要按照您描述的方式组合它们,您可以使用 -compose
和 SCREEN
选项。
composite -compose SCREEN image1.png image2.png result.png
假设有两个相同的二值图像(所有像素都是黑色的)。然后你拍摄第一张图像并将一些像素设为白色(例如,点 (10,10)
和 (11, 11)
)并对第二张图像的点 (5, 4)
执行相同的操作并保存结果图片为 image1.png
和 image2.png
。
目标是创建第三个图像 (result.png
),每个像素都为黑色,但有 3 个点:(5, 4)
、(10,10)
和 (11,11)
应该是白色的。如何在 Ubuntu 中自动执行此操作?
composite 看起来是一个值得研究的好命令。我尝试使用 composite -blend
然后没能找到正确的命令来保存白色。
给定 image1.png
白点 @ 10,10 & 11,11
convert -size 100x100 xc:black -fill white -draw 'point 10, 10' -draw 'point 11,11' image1.png
和 image2.png
白点 @ 5,4
convert -size 100x100 xc:black -fill white -draw 'point 5,4' image2.png
要按照您描述的方式组合它们,您可以使用 -compose
和 SCREEN
选项。
composite -compose SCREEN image1.png image2.png result.png