我正尝试使用网络摄像头以不同的曝光量连续拍摄几张照片。
网络摄像头事件处理程序:
void cam_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
imageorg = new Image<Bgr, byte>(eventArgs.Frame);
imageBox1.Image = imageorg;
if (BurstCapON)
saveonephoto();
}
激活按钮:
private void button2_Click(object sender, EventArgs e)
{
folderBrowserDialog1.ShowDialog();
currexpousure = 0;
cam.SetCameraProperty(CameraControlProperty.Exposure, currexpousure, CameraControlFlags.Manual);
BurstCapON = true;
}
照片保存Expousure迭代功能
private void saveonephoto()
{
string filename = String.Format(@"\img{0:00}_{1:00}.jpg", filenumerator, currexpousure);
while(File.Exists(folderBrowserDialog1.SelectedPath + filename))
{
filenumerator++;
filename = filename = String.Format(@"\img{0:00}_{1:00}.jpg", filenumerator, currexpousure);
}
if (currexpousure >= 100)
BurstCapON = false;
else
currexpousure += 10;
cam.SetCameraProperty(CameraControlProperty.Exposure, currexpousure, CameraControlFlags.Manual);
imageorg.Save(folderBrowserDialog1.SelectedPath + filename);
}
我收到具有不同曝光度的照片,例如第一张照片应该是最暗的,但不是。如何将更改的参数与捕获的照片同步?