我正在尝试对图像进行阈值处理。“tif”类型的图像,我收到这个错误说
具有索引像素格式的图像不支持 SetPixel
这是我的代码,p11是图像名称
for (int r = 0; r < p11.Width; r++)
{
// whiteColor = 0;
// blackColor = 0;
for (int c = 0; c < p11.Height; c++)
{
num1 = int.Parse(p11.GetPixel(r, c).A.ToString()); // gets the alpha component value of this colout
num2 = int.Parse(p11.GetPixel(r, c).B.ToString()); // gets the Blue component value of this colout
num3 = int.Parse(p11.GetPixel(r, c).R.ToString()); // gets the Red component value of this colout
num4 = int.Parse(p11.GetPixel(r, c).G.ToString()); // gets the green component value of this colout
if( T <= num1 && T <= num2 && T <= num3 && T <= num4)
{
}
else
{
p11.SetPixel(r, c, Color.Black);
}
}
}