// will be simplified
        public void ProcessFrame(object sender, EventArgs arg)
        {
            //get frame from the Camera

            Mat frame = new Mat();
            Mat grayFrame = new Mat();

            double thresh_med;
            double thresh_e2;

            System.Drawing.Image OrgImage;
            System.Drawing.Image OrgImage1;

            _capture.Retrieve(frame);

            CvInvoke.CvtColor(frame, grayFrame, ColorConversion.Bgr2Gray);
            Image<Rgb, Byte> tothermo = grayFrame.ToImage<Rgb, Byte>(); // original
            Image<Gray, Byte> tothermo1 = grayFrame.ToImage<Gray, Byte>();

            OrgImage = tothermo.ToBitmap();
            OrgImage1 = tothermo.ToBitmap();

            pictureBox4.Image = OrgImage1;

            _imagedata.MakeFalse((Bitmap)OrgImage);
            pictureBox1.Image = OrgImage;

            pictureBox1.Refresh();
            pictureBox4.Refresh();

            double[] minVal;
            double[] maxVal;
            System.Drawing.Point[] minLoc;
            System.Drawing.Point[] maxLoc;
            grayFrame.MinMax(out minVal, out maxVal, out minLoc, out maxLoc);

            _imagedata.sizex = OrgImage.Width;
            _imagedata.sizey = OrgImage.Height;

            if (hand_mode)
            {
                _imagedata.centerx = mouse_x;
                _imagedata.centery = mouse_y;
            }
            else
            {
                _imagedata.centerx = maxLoc[0].X;
                _imagedata.centery = maxLoc[0].Y;
            }

            _imagedata.GraphFill(tothermo1);

            // thresh calculate
            if (hand_mode)
            {
                thresh_med = grayFrame.Bitmap.GetPixel(_imagedata.centerx, _imagedata.centery).R / 2;
                thresh_e2 = grayFrame.Bitmap.GetPixel(_imagedata.centerx, _imagedata.centery).R / Math.Exp(2);
            }
            else
            {
                thresh_med = maxVal[0] / 2;
                thresh_e2 = maxVal[0] / Math.Exp(2);
            }

            _beamparameters.BeamSizeDetect(thresh_med, thresh_e2, _imagedata);
        }