不好意思
請教各位前輩
因為我們最近在寫圖片二值化的手機mobile程式
而我們都參考網站上c#的程式去改成Mobile程式
但是我們發現我們將二值化程式讀到手機上
它處理的速度太慢了,我們也知道手機執行的速度不能跟桌電比
不知道前輩可以提供我們改善的方法嗎?
以下是我們的程式碼
二值化過程是由scollbar去決定它的閥值!
private void hScrollBar1_ValueChanged(object sender, EventArgs e)
{
Bitmap binarybmp = new Bitmap(pictureBox1.Image);
//int binaryrgb;
int threshold = hScrollBar1.Value;
for (int y = 0; y < binarybmp.Height; y++)
{
for (int x = 0; x < binarybmp.Width; x++)
{
Color c = binarybmp.GetPixel(x, y);
if (c.R < threshold)
binarybmp.SetPixel(x, y, Color.FromArgb(0, 0, 0));
else
binarybmp.SetPixel(x, y, Color.FromArgb(255, 255, 255));
}
pictureBox1.Refresh();
}
請前輩不吝指教