/// <summary> /// [Português] /// Ação do btnGetPicture, este evento tira a foto com o dispositivo de captura de imagem. /// <para></para> /// [English] /// Action btnGetPicture, this event takes a picture with the image capture device. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGetPicture_Click(object sender, EventArgs e) { CreatePosturalEvaluation(); if (radioManual.Checked) { if (!_manualPic) { pbGridPicture.Show(); pbGridPicture.Visible = true; _capturedPicture = new Bitmap(videoSourcePlayer.GetCurrentVideoFrame(), pbGridPicture.Size); Reset(_capturedPicture); draw = new Bitmap(original); videoSourcePlayer.Visible = false; btnGetPicture.Image = Properties.Resources.Pictures_new; _manualPic = true; gradeOk = false; lblMessage.Text = "Ajuste a malha do simetrógrafo."; EnableViewPics(false); DisableRadio(); } else { btnGetPicture.Image = Properties.Resources.Pictures; btnGetPicture.Text = "Tirar foto"; pbGridPicture.Visible = false; videoSourcePlayer.Visible = true; pbGridPicture.Controls.Clear(); _manualPic = false; gradeOk = false; lblMessage.Text = "Tire uma foto."; btnSaveEvaluation.Enabled = false; EnableViewPics(true); EnableRadio(); } } else { if (radioAutomatica.Checked) { if (!_backgroundAutomaticPic) { _backgroundImg = new Bitmap(videoSourcePlayer.GetCurrentVideoFrame(), pbGridPicture.Size); Reset(_backgroundImg); draw = new Bitmap(original); //videoSourcePlayer.Visible = false; btnGetPicture.Image = Properties.Resources.Pictures; _backgroundAutomaticPic = true; btnGetPicture.Text = "Tirar foto do paciente."; this.lblMessage.Text = "Tire uma foto do paciente."; EnableViewPics(false); DisableRadio(); } else { //voltar a captura //videoSourcePlayer.Visible = true; if (!_automaticPic) { pbGridPicture.Show(); pbGridPicture.Visible = true; videoSourcePlayer.Visible = false; _patientImg = new Bitmap(videoSourcePlayer.GetCurrentVideoFrame(), pbGridPicture.Size); draw = new Bitmap(original); Reset(_patientImg); btnGetPicture.Image = Properties.Resources.Pictures; _backgroundAutomaticPic = true; _automaticPic = true; gradeOk = false; btnGetPicture.Text = "Tirar foto do ambiente"; this.lblMessage.Text = "Ajuste a malha do simetrógrafo."; DisableRadio(); } else { btnGetPicture.Image = Properties.Resources.Pictures; btnGetPicture.Text = "Tirar foto do ambiente"; pbGridPicture.Visible = false; videoSourcePlayer.Visible = true; pbGridPicture.Controls.Clear(); _backgroundAutomaticPic = false; _automaticPic = false; gradeOk = false; lblMessage.Text = "Tire uma foto."; if (_selectionBox != null) { _selectionBox.Enabled = false; } btnSaveEvaluation.Enabled = false; _selectionBox = null; EnableViewPics(true); EnableRadio(); } } } } }
/// <summary> /// [Português] /// Evento MouseUp do pbGridPicture. /// <para></para> /// [English] /// PbGridPicture the MouseUp event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pbGridPicture_MouseUp(object sender, MouseEventArgs e) { if (!gradeOk) { gradeOk = true; grid = new Bitmap(original); if (radioAutomatica.Checked) { if (_selectionBox == null) { _selectionBox = new UserRect(new Rectangle(this._middle - 50, 200, 100, 100)); _selectionBox.SetPictureBox(this.pbGridPicture); pbGridPicture.Refresh(); } btnPointIdentification.Enabled = true; lblMessage.Text = "Alinhe o quadro de seleção delimitando a altura do paciente e clique em" + System.Environment.NewLine.ToString() + "Identificar pontos."; } else { lblMessage.Text = "Marque os pontos necessários para a avaliação postural."; } } }
private void button4_Click(object sender, EventArgs e) { imgFundo = new Bitmap("E:\\Felipe\\Faculdade\\TCC\\img\\Felipe\\Fundo.jpg"); imgPaciente = new Bitmap("E:\\Felipe\\Faculdade\\TCC\\img\\Felipe\\Posterior.jpg"); imgTratada = new Bitmap(util.ProcessImage(imgPaciente, imgFundo)); pictureBox2.Image = imgPaciente; rect = new UserRect(new Rectangle(10, 10, 100, 100)); rect.SetPictureBox(this.pictureBox2); }