我想从一个位图拆分不同的形状成sepperate位图。
我有一个工作系统,可以分类颜色。
所以我有一种颜色的各种形状的位图列表。
我有一个要求:我不想使用任何形状检测自由。
目前我只有一个简单的循环,循环中的位图低谷的所有像素,并检查是否有颜色的结论是,像素可以是旧的或新的形状的一部分。
C#抽象形状检测
变量列表
layeredColorSystem =位图
这是颜色分选系统的结果。
foreach (Color colorLayer in layeredColorSystem.Keys)
{
Bitmap layer = layeredColorSystem[colorLayer];
Bitmap shape = new Bitmap(input.Width, input.Height);
for (int x = 0; x < layer.Width; x++)
{
for (int y = 0; y < layer.Height; y++)
{
Color currentPixel = layer.GetPixel(x, y);
if (!currentPixel.Equals(colorLayer))
{
//no color here maybe a new shape can come up
} else
{
//color here maybe a part of an old shape maby a new shape.
}
}
}
}
所以我的问题是:我如何写一个简单的代码,检测的形状和将每个sepperate形状的位图的原始位图的大小相同?
提前致谢!
有没有问题! –
@JeremyThompson这个问题很明显:如何将所有形状从一个位图放入sepperate位图。 –
的2密切票表明它不清楚你在问什么......在任何情况下,这可能会帮助您:http://stackoverflow.com/questions/7782338/search-for-shapes-in-bmp-image-file –