我是编程新手,如果我问了一个愚蠢的问题,请原谅我。
我正在尝试显示从实时摄像头获得的实时图像。当我启动程序时,图片框能够显示该对象(参见图1)。当我删除该对象时,它会显示此图像(参见图2)。但问题是,当我放回对象时,我应该能够获得类似于图片 1 的图像,但它看起来像图片 2。
是不是因为图片框刷新不正常?
//R Mode Tab
private void RModeToolStripMenuItem_Click(object sender, EventArgs e)
{
// There is a method, which will obtain the data value and pass to this drawpix
drawPix(x, y, (int)data, (int)data, (int)data);
pictureBox.Refresh();
// Release camera buffer
camera.Release();
}
private void drawPix(int x, int y, int r, int g, int b)
{
((Bitmap)pictureBox.Image).SetPixel(x, y, Color.FromArgb(r, g, b));
return;
}
(Picture1)This is the image i get when i start the program
(Picture2)This is the image after i remove the object
对我来说,似乎一旦“黑色”被绘制到图片框上,它似乎就无法消失。