Example #1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            blackBody["enabled"]     = check_black_enabled.Checked.ToString();
            blackBody["distance"]    = text_black_distance.Text;
            blackBody["emissivity"]  = text_black_emissivity.Text;
            blackBody["temperature"] = text_black_temp.Text;

            faceThermometryRegion["targetSpeed"]      = text_facetr_targetSpeed.Text;
            faceThermometryRegion["sensitivity"]      = text_facetr_sensitivity.Text;
            faceThermometryRegion["alarmTemperature"] = text_facetr_alarmTemperature.Text;

            var coutours = drawToolbar.coutours;

            if (coutours != null)
            {
                var getCoutours = drawToolbar.DrawArea.GetParameters();
                if (getCoutours != null)
                {
                    coutours.Add(getCoutours[0]);
                }
            }

            foreach (var coutour in coutours)
            {
                if (coutour.Count == 4)
                {
                    faceThermometryRegion["rectangle"] = new Rectangle(coutour[3].X * 1000 / drawAreaCamera.Width, coutour[3].Y * 1000 / drawAreaCamera.Height, (coutour[1].X - coutour[0].X) * 1000 / drawAreaCamera.Width, -(coutour[2].Y - coutour[1].Y) * 1000 / drawAreaCamera.Height);
                }
                else if (coutour.Count == 1)
                {
                    blackBody["point"] = new Point(coutour[0].X * 1000 / drawAreaIRCamera.Width, coutour[0].Y * 1000 / drawAreaIRCamera.Height);
                }
            }

            faceThermometryBasicParameter["emissivity"] = text_facetbp_emissivity.Text;
            faceThermometryBasicParameter["distance"]   = Convert.ToSingle(text_facetbp_distance.Text);

            if (com_bodytc_type.Text == "自动")
            {
                bodyTemperatureCompensation["type"]            = "auto";
                bodyTemperatureCompensation["smartCorrection"] = text_bodytc_smartCorrection.Text;
            }
            else
            {
                bodyTemperatureCompensation["type"]            = "manual";
                bodyTemperatureCompensation["smartCorrection"] = text_bodytc_smartCorrection.Text;
            }
            bodyTemperatureCompensation["environmentalTemperatureMode"] = com_bodytc_mode.Text == "自动" ? "auto" : "manual";
            bodyTemperatureCompensation["environmentalTemperature"]     = text_bodytc_environ.Text;

            if (!cell.SetFaceThermometryBasicParameter(null, faceThermometryBasicParameter) || !cell.SetFaceThermometryRegion(null, faceThermometryRegion) || !cell.SetBlackBody(null, blackBody) || !cell.SetBodyTemperatureCompensation(null, bodyTemperatureCompensation))
            {
                MessageBox.Show("设置失败!");
                return;
            }

            GetParameters();
            drawAreaCamera.ClearAll();
            drawAreaIRCamera.ClearAll();

            Rectangle rect = (Rectangle)faceThermometryRegion["rectangle"];

            Draw(drawAreaCamera, Color.Green, rect.X * drawAreaCamera.Width / 1000, rect.Y * drawAreaCamera.Height / 1000, rect.Width * drawAreaCamera.Width / 1000, rect.Height * drawAreaCamera.Height / 1000, true);

            Point point = (Point)blackBody["point"];

            Draw(drawAreaIRCamera, Color.Blue, point.X * drawAreaIRCamera.Width / 1000, point.Y * drawAreaIRCamera.Height / 1000);
            MessageBox.Show("设置完成!");
        }