ubuntu - 如何在 Ubuntu 上叠加 2 个二进制图像以保存白色?

标签 ubuntu image-processing graphics imagemagick image-segmentation

想象一下有两个相同的二进制图像(所有像素都是黑色的)。然后您拍摄第一张图像并将一些像素设为白色(例如,点 (10,10)(11, 11) )并对点 (5, 4) 执行相同的操作第二张图像的图像并将结果图像保存为image1.pngimage2.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

image1

image2.png带白点@ 5,4
convert -size 100x100 xc:black -fill white -draw 'point 5,4' image2.png

image2

要以您描述的方式组合它们,您将使用 -composeSCREEN选项。
composite -compose SCREEN image1.png image2.png result.png

result

关于ubuntu - 如何在 Ubuntu 上叠加 2 个二进制图像以保存白色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55241808/

相关文章:

docker - 从 docker 容器连接到 ubuntu 端口

python - Ubuntu、 python : Cannot import python shapely package

.net - 形状校正后如何获取像素坐标?

c++ - 如何将 OpenGL 加载到 Visual Studio 2012

php - x-debug 导致错误 'undefined property' 错误

c++ - 在 Ubuntu 中从 cpp 程序创建新文件

image-processing - 如何识别图像中存在的噪声类型

python - 如何在SimpleCV或opencv中计算边界内的标记区域

c++ - gluPickMatrix - 出了点问题,一个对象总是在现场

graphics - 打印机/绘图仪上的 Direct3D 输出