我想從一個位圖拆分不同的形狀成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 –