我计算每个像素的亮度,然后将其与某个阈值进行比较.
y=0.3*R+0.59G*G+0.11*B
假设阈值为127:
const int threshold = 127; Bitmap bm = { some source bitmap }; byte[,] buffer = new byte[64,256]; for(int y=0;y 127) ? 1 : 0; } }