|
@@ -36,7 +36,6 @@ namespace ImpulseVision
|
|
|
|
|
|
};
|
|
|
CaptureTimer.Tick += CaptureTimer_Tick;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void CaptureTimer_Tick(object sender, EventArgs e)
|
|
@@ -75,7 +74,7 @@ namespace ImpulseVision
|
|
|
{
|
|
|
IsRecognized = true;
|
|
|
}
|
|
|
- this.Text = IsRecognized.ToString();
|
|
|
+ //this.Text = IsRecognized.ToString();
|
|
|
UserName = faceName;
|
|
|
NotifyPropertyChanged();
|
|
|
}
|
|
@@ -191,9 +190,9 @@ namespace ImpulseVision
|
|
|
SqlDataReader Res = Cmd.ExecuteReader();
|
|
|
if(Res.HasRows)
|
|
|
{
|
|
|
- FaceItem = new FaceData();
|
|
|
while (Res.Read())
|
|
|
{
|
|
|
+ FaceItem = new FaceData();
|
|
|
FaceItem.FaceImage = new Image<Gray, byte>(Application.StartupPath +"\\"+ Res["Picture"].ToString());
|
|
|
FaceItem.PersonName = Res["Firstname"].ToString();
|
|
|
FaceItem.LastName = Res["Lastname"].ToString();
|
|
@@ -257,8 +256,7 @@ namespace ImpulseVision
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
-
|
|
|
- //todo log
|
|
|
+ MessageBox.Show(ex.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -274,6 +272,8 @@ namespace ImpulseVision
|
|
|
//Eigen Face Algorithm
|
|
|
FaceRecognizer.PredictionResult result = recognizer.Predict(DetectedFace.Resize(100, 100, Inter.Cubic));
|
|
|
FaceName = NameList[result.Label];
|
|
|
+
|
|
|
+ this.Text = "UserID: " + FaceList[result.Label].UserID;
|
|
|
CameraCaptureFace = DetectedFace.ToBitmap();
|
|
|
}
|
|
|
else
|
|
@@ -638,35 +638,35 @@ namespace ImpulseVision
|
|
|
SelectedCameraID = 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void CmbCams_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- //если захват видео уже идёт
|
|
|
- if (Capture != null)
|
|
|
- {
|
|
|
- //captureTimer.Stop();
|
|
|
- Capture.Dispose();
|
|
|
- Capture = null;
|
|
|
- PbxEther.Image = null;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- MessageBox.Show(ex.Message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
- }
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ // //если захват видео уже идёт
|
|
|
+ // if (Capture != null)
|
|
|
+ // {
|
|
|
+ // //captureTimer.Stop();
|
|
|
+ // Capture.Dispose();
|
|
|
+ // Capture = null;
|
|
|
+ // PbxEther.Image = null;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //catch (Exception ex)
|
|
|
+ //{
|
|
|
+ // MessageBox.Show(ex.Message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
+ //}
|
|
|
|
|
|
- SelectedCameraID = CmbCams.SelectedIndex;
|
|
|
+ //SelectedCameraID = CmbCams.SelectedIndex;
|
|
|
|
|
|
- Capture = new VideoCapture(SelectedCameraID);
|
|
|
- //настройка кадров
|
|
|
- Capture.SetCaptureProperty(CapProp.Fps, 30);
|
|
|
- Capture.SetCaptureProperty(CapProp.FrameHeight, 450);
|
|
|
- Capture.SetCaptureProperty(CapProp.FrameWidth, 370);
|
|
|
- CaptureTimer.Start();
|
|
|
+ //Capture = new VideoCapture(SelectedCameraID);
|
|
|
+ ////настройка кадров
|
|
|
+ //Capture.SetCaptureProperty(CapProp.Fps, 30);
|
|
|
+ //Capture.SetCaptureProperty(CapProp.FrameHeight, 450);
|
|
|
+ //Capture.SetCaptureProperty(CapProp.FrameWidth, 370);
|
|
|
+ //CaptureTimer.Start();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void TimerCam_Tick(object sender, EventArgs e)
|
|
|
{
|
|
|
DsDevice[] Cams = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
|