Esempio n. 1
0
        public void StartCorrect(HTuple hv_PCol, HTuple hv_PRow, HTuple picBoxWidth, HTuple picBoxHeight)
        {
            m_bCorrect   = true;
            this.hv_PCol = hv_PCol;
            this.hv_PRow = hv_PRow;
            HObject ho_image;
            //HObject ho_TransImage;
            HTuple width;
            HTuple height;

            Bitmap grab = (Bitmap)m_grabBmp.Clone();

            ImageConvert.Bitmap2HObjectBpp24(grab, out ho_image);

            //ho_image.WriteObject("E://Projects//周报//original.bmp");

            HOperatorSet.GetImageSize(ho_image, out width, out height);

            HTuple hv_zoomPRow = hv_PRow * (height / (1.0 * picBoxHeight));
            HTuple hv_zoomPCol = hv_PCol * (width / (1.0 * picBoxWidth));

            //MatchAlg.CorrectImage(ho_image, hv_zoomPRow, hv_zoomPCol, out hv_FirstHomMat2D, out hv_SecondHomMat2D);
            Point[] Points = new Point[4];
            for (int i = 0; i < 4; i++)
            {
                Points[i].X = (int)hv_zoomPCol[i].D;
                Points[i].Y = (int)hv_zoomPRow[i].D;
            }

            Dictionary <string, int>    TerminalSize     = new Dictionary <string, int>();
            Dictionary <string, double> CorrectImageSize = new Dictionary <string, double>();

            TerminalSize.Add("Width", 500);
            TerminalSize.Add("Height", 800);
            CorrectImageSize.Add("Height", 500);

            imagealg.TerminalSize     = TerminalSize;
            imagealg.CorrectImageSize = CorrectImageSize;
            imagealg.CalHomMat(grab, Points, ImageAlg.CORRECT_STRATEGY.DIRECT_CORRECT);
        }