private void button_OpenCameraStream(object sender, EventArgs e) { CameraForm form = new CameraForm(true); form.Img += ChonTuFile; form.vid += SetVideo; //form.Location = m_list_pannel[m_index_pannel].Location; form.StartPosition = FormStartPosition.CenterScreen; if (form.ShowDialog() == DialogResult.OK) { if (form.index == -1) { return; } panel1.Refresh(); m_isBitmap = false; if (m_video != null) { m_video.Dispose(); } //mo webcam if (form.index == 0) { m_video = new VideoCapture(); m_isVideo = m_video.Open(0); if (m_isVideo) { m_thread = new Thread(bw_DoWork); //m_thread.IsBackground = true; m_thread.Start(); } } else { m_video = new VideoCapture(); //mo video if (form.index == 1) { m_isVideo = m_video.OpenVideo(form.m_url); } //link stream else if (form.index == 2) { m_isVideo = m_video.Open(form.m_url, m_width, m_height); } if (m_isVideo) { m_thread = new Thread(bw_DoWork); //m_thread.IsBackground = true; m_thread.Start(); } } } }
private void càiĐặtCameraToolStripMenuItem_Click(object sender, EventArgs e) { CameraForm form = new CameraForm(); //form.Location = m_list_pannel[m_index_pannel].Location; form.StartPosition = FormStartPosition.CenterScreen; if (form.ShowDialog() == DialogResult.OK) { if (form.index == -1) { return; } //MessageBox.Show(form.index.ToString() + ":" + form.m_url); if (m_service != null) { m_service.stop(); m_service.Dispose(); } m_service = new Service(); m_service.m_panel = panel_video; m_service.m_text_name = lbl_HoTen; m_service.m_text_confident = lbl_TrongSo; m_service.m_panel_result = panel_img; m_service.m_face_recog = m_face_recog; m_service.m_faceTracking = m_faceTracking; m_service.m_isFaceRecog = m_isFaceRecog; m_service.m_isFaceTrack = m_isFaceTrack; m_service.m_text_time = lbl_Time; m_service.m_listView_Thumb = listView_thumbnail; m_service.m_folder_unknow_Image = m_store_unknow; m_service.m_folder_know_Image = m_store_know; m_service.listView_report = listView_report; m_service.panel_db_img = panel_db_img; if (form.index == 0) { m_service.m_index = form.index; m_service.start(); } else { m_service.m_index = form.index; m_service.m_url = form.m_url; m_service.start(); } } }