Exemplo n.º 1
0
 private void button9_Click(object sender, EventArgs e)
 {
     //picB2.Image = ImgeTool.circle((Bitmap)(picB1.Image), 100);
     ImgeTool.delDisplayImg delDiplay = new ImgeTool.delDisplayImg(displayPicBox);
     ImgeTool.displayCircle((Bitmap)(picB1.Image), delDiplay, true, 50, 50);
     //picB2.Image = ImgeTool.displayCircle((Bitmap)(picB1.Image), 100);
 }
Exemplo n.º 2
0
 private void button4_Click(object sender, EventArgs e)
 {
     //picB2.Image = ImgeTool.BlindWindow((Bitmap)picB1.Image, 10, "H", 10);
     ImgeTool.delDisplayImg delDiplay = new ImgeTool.delDisplayImg(displayPicBox);
     ImgeTool.displayBlindWindow((Bitmap)picB1.Image, delDiplay, "V", 10);
     //Bitmap bmp = (Bitmap)(picB1.Image);
     ////picB2.Image =
     //Graphics g = picB2.CreateGraphics();
     //g.DrawImage(ImgeTool.getSubImage(bmp, 0, 0, bmp.Width, bmp.Height),0,0);
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap bmp1 = (Bitmap)picB1.Image;
            Bitmap bmp2 = new Bitmap(bmp1.Width, bmp1.Height, bmp1.PixelFormat);

            for (int i = 0; i < bmp1.Height; i++)
            {
                for (int j = 0; j < bmp1.Width; j++)
                {
                    Color clr;
                    clr = ImgeTool.myGetPixel(bmp1, j, i);
                    //clr = bmp1.GetPixel(j, i);
                    ImgeTool.mySetPixel(bmp2, clr, j, i);
                    //bmp2.SetPixel(j, i, clr);
                }
                picB2.Image = bmp2;
                picB2.Refresh();
            }
        }
Exemplo n.º 4
0
 private void button8_Click(object sender, EventArgs e)
 {
     picB2.Image = ImgeTool.deform((Bitmap)(picB1.Image), 4, 50f, picB1.Image.Height);
 }
Exemplo n.º 5
0
 private void button6_Click(object sender, EventArgs e)
 {
     ImgeTool.delDisplayImg delDiplay = new ImgeTool.delDisplayImg(displayPicBox);
     ImgeTool.displayZoom((Bitmap)(picB1.Image), delDiplay, !true, 50, 50);
 }
Exemplo n.º 6
0
 private void button3_Click(object sender, EventArgs e)
 {
     picB2.Image = ImgeTool.GetRotateImage(picB1.Image, 45);
 }
Exemplo n.º 7
0
        private void button2_Click(object sender, EventArgs e)
        {
            Font font = new Font("黑体", 48);

            picB2.Image = ImgeTool.WriteEmbossed((Bitmap)(picB1.Image), "情报中心", font, 10, picB1.Image.Height / 4);
        }
Exemplo n.º 8
0
 private void button12_Click(object sender, EventArgs e)
 {
     //picB2.Image = ImgeTool.sector((Bitmap)(picB1.Image), 99,15,45);
     ImgeTool.delDisplayImg delDiplay = new ImgeTool.delDisplayImg(displayPicBox);
     ImgeTool.displayRadar((Bitmap)(picB1.Image), delDiplay, true, 10, 20);
 }
Exemplo n.º 9
0
 private void button10_Click(object sender, EventArgs e)
 {
     ImgeTool.delDisplayImg delDiplay = new ImgeTool.delDisplayImg(displayPicBox);
     ImgeTool.displaySquare((Bitmap)(picB1.Image), delDiplay, true, 50, 60);
 }
Exemplo n.º 10
0
        /// <summary>
        ///  a simple version of get area from imgage including subtitle that is it has just the excat subtitle with fixed top and bottom
        /// </summary>
        /// <param name="binDat"></param>
        /// <param name="colLeft"></param>
        /// <param name="rowTop"></param>
        /// <param name="colLen"></param>
        /// <param name="rowLen"></param>
        /// <param name="bFixedRow"></param>
        /// <returns></returns>
        public ArrayList getSimpleSquareDat(byte[,] binDat, ref int colLeft, ref int colLen, double cdf_H, double cdf_L, double des_H, double des_L, bool bFixedRow)
        {
            int colPtr;
            int ttlCol;

            ttlCol = binDat.GetLength(1);
            int ttlRow;

            ttlRow = binDat.GetLength(0);
            bool retVal = true;

            //search the left column of the square
            colPtr = colLeft;
            int rowLen = ttlRow;

            // calculat the vertical points number for each horizontal points
            double[] hstGramVal = new double[ttlCol];
            int      affectLen  = 6;// used to set the adjacent point value to 1 ,if their neighbours are not zero.
            int      sumPtr     = 0;

            for (int c = 0; c < ttlCol; c++)
            {
                for (int r = 0; r < ttlRow; r++)
                {
                    hstGramVal[c] += binDat[r, c]; // line density
                }
                //if (c > affectLen)
                //{
                //    if (hstGramVal[c] != 0 && hstGramVal[c - affectLen] != 0)
                //        for (int subC = c - affectLen + 1; subC < c; subC++)
                //        {
                //            hstGramVal[subC] = hstGramVal[subC] == 0 ? 1 : hstGramVal[subC];
                //        }
                //}
                hstGramVal[c] = hstGramVal[c] / 255.0 / ttlRow;
                if (hstGramVal[c] != 0 && sumPtr == 0)
                {
                    sumPtr = c;
                }
                if (sumPtr != 0)
                {
                    if (c - sumPtr >= colLen)
                    {
                        hstGramVal = ImgeTool.removeNoise(hstGramVal, sumPtr, c, cdf_H, cdf_L, des_H, des_L, true);

                        sumPtr = 0;
                    }
                }
            }


            // search the border from the midle part of the line...
            // while(true)
            {
                m_sqrAlist.Clear();
                long callTimes = 0;
                int  curPos, nextPos;
                int  searchStep = 1;//
                //curPos = ttlCol / 2;
                curPos = 0;
                int searchWidth;
                searchWidth = rowLen;                      // the default search width is the same avheight
                int mySchWidth = (int)(0.6 * searchWidth); // seach from the 60% of the default width , for chinese charater is not the exact squre
                mySchWidth = 2;
                while (true)
                {
                    callTimes++;

                    nextPos = getBorderAtLine(hstGramVal, curPos, searchStep);
                    if (nextPos < 0)
                    {
                        break;
                    }
                    int dist = Math.Abs(curPos - nextPos);
                    if (dist <= 1)//|| dist > searchWidth)
                    {
                        curPos    += 1;
                        searchStep = 1;
                    }
                    else
                    {
                        if (dist >= 1 && dist < mySchWidth)// adjacent column
                        {
                            curPos    += 1;
                            searchStep = 1;
                            goto Next;                             // change the curpos and begin a new search
                        }
                        else if (dist >= mySchWidth)               // && dist <= searchWidth)// find allmost an exact  border
                        {
                            SquareDat squareDat = new SquareDat(); // memory ....!!!!!!!!!!!!!!!

                            squareDat.col = searchStep < 0 ? nextPos : curPos;

                            squareDat.row    = 0;
                            squareDat.rowLen = 0;// NA
                            squareDat.colLen = Math.Abs(curPos - nextPos);
                            m_sqrAlist.Add(squareDat);
                            curPos = nextPos + 1;
                            continue;
                        }
                        else// dist > searchWidth, it might be encounter an block of white point or black piont
                        {
                            //MessageBox.Show("Wrong process!");
                            throw new Exception("Your process is not correct!");
                        }
                    }
                    //if (nextPos == 0 && searchDir == -1)
                    //{
                    //    curPos = curPos = ttlCol / 2;
                    //    searchDir = 1;
                    //    continue;
                    //}
Next:
                    if (nextPos + searchStep >= ttlCol - 1)
                    {
                        // end codes....
                        break;
                    }
                }
            }

            // exit:
            return(m_sqrAlist);
        }