Ejemplo n.º 1
0
        public void CallCalcuAeras()
        {
            int highVal = CalcuAeras.HIST_HIGH_VALUE;
            int lowVal  = CalcuAeras.HIST_LOW_VALUE;

            if (highVal < 0)
            {
                return;
            }
            if (CalcuAeras.PIX_DIS_RATIO < 0)
            {
                mCalcuAera.NBinaryImage_2Threshold((float)1.0, "pixel", LanguageControl.PIC_AREA, lowVal, highVal);
            }
            else
            {
                mCalcuAera.NBinaryImage_2Threshold((float)(CalcuAeras.PIX_DIS_RATIO * CalcuAeras.PIX_DIS_RATIO), CalcuAeras.AERA_UNIT, LanguageControl.PIC_AREA, lowVal, highVal);
            }
            ShowDstImage();
        }
Ejemplo n.º 2
0
        private void hScrollBar_ValueChanged(object sender, EventArgs e)
        {
            if (mProcessing)
            {
                return;
            }
            mProcessing = true;
            int width  = this.pictureBox_histogram.Width;
            int height = this.pictureBox_histogram.Height;

            if (this.hScrollBar_high.Value <= this.hScrollBar_low.Value)
            {
                this.hScrollBar_high.Value = this.hScrollBar_low.Value + 1;
            }
            int low_pos  = width * this.hScrollBar_low.Value / this.hScrollBar_low.Maximum;
            int high_pos = width * this.hScrollBar_high.Value / this.hScrollBar_high.Maximum;

            this.Refresh();
            mPen.Color = Color.GreenYellow;
            mGraph.DrawLine(mPen, new Point(low_pos, 0), new Point(low_pos, height));
            mGraph.DrawString(this.hScrollBar_low.Value.ToString(), new Font("宋体", 10f), Brushes.Yellow, new Point((low_pos > 15?low_pos - 15:low_pos), height / 3));
            mPen.Color = Color.Red;
            mGraph.DrawLine(mPen, new Point(high_pos, 0), new Point(high_pos, height));
            mGraph.DrawString(this.hScrollBar_high.Value.ToString(), new Font("宋体", 10f), Brushes.Yellow, new Point((high_pos > 10?high_pos - 10:high_pos), height / 5));
            //MessageBox.Show(low_pos + " " + high_pos);
            if (CalcuAeras.PIX_DIS_RATIO < 0)
            {
                mCal.NBinaryImage_2Threshold((float)1.0, "pixel", LanguageControl.PIC_AREA, this.hScrollBar_low.Value, this.hScrollBar_high.Value);
            }
            else
            {
                mCal.NBinaryImage_2Threshold((float)(CalcuAeras.PIX_DIS_RATIO * CalcuAeras.PIX_DIS_RATIO), CalcuAeras.AERA_UNIT, LanguageControl.PIC_AREA, this.hScrollBar_low.Value, this.hScrollBar_high.Value);
            }
            mMainForm.ShowDstImage();
            CalcuAeras.HIST_LOW_VALUE  = this.hScrollBar_low.Value;
            CalcuAeras.HIST_HIGH_VALUE = this.hScrollBar_high.Value;
            mProcessing = false;
        }