Exemple #1
0
        void CreateHistoBounds(PLATE_INFO plateDiagInfo)
        {
            int w = plateDiagInfo.plateImage.Width;
            int h = plateDiagInfo.plateImage.Height;

            int centerX = w / 2;
            int centerY = h / 2;

            plateDiagInfo.histoBounds          = new HistogramBounds();
            plateDiagInfo.histoBounds.leftEdge = centerX - 50;
            if (plateDiagInfo.histoBounds.leftEdge < 0)
            {
                plateDiagInfo.histoBounds.leftEdge = 10;
            }
            plateDiagInfo.histoBounds.rightEdge = centerX + 50;
            if (plateDiagInfo.histoBounds.rightEdge >= w)
            {
                plateDiagInfo.histoBounds.rightEdge = w - 10;
            }

            plateDiagInfo.histoBounds.topEdge = centerY - 10;
            if (plateDiagInfo.histoBounds.topEdge < 0)
            {
                plateDiagInfo.histoBounds.topEdge = 0;
            }

            plateDiagInfo.histoBounds.bottomEdge = centerY + 10;
            if (plateDiagInfo.histoBounds.bottomEdge < 0)
            {
                plateDiagInfo.histoBounds.bottomEdge = 0;
            }
        }
Exemple #2
0
        Bitmap CreateTestBinarizedImage(PLATE_INFO pi)
        {
            // get histogram
            int[,] plum = new int[pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height];

            PixelLib.Pixels.getPixelsFromImage(pi.plateImageUnprocessed, plum);

            CreateHistoBounds(pi);

            int[]        histo       = new int[256];
            int[]        integration = new int[256];
            Bitmap       hBmp        = new Bitmap(256, 100);
            HistoResults histoStats  = null;

            historgram(plum, histo, integration, true, hBmp, pi.histoBounds, out histoStats);

            int[,] binarizedLum = new int[pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height];

            BinarizeOnPlate(plum, binarizedLum, histoStats);

            Bitmap binBmp = new Bitmap(pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height);

            Pixels.putPixels(binBmp, binarizedLum);

            return(binBmp);
        }
Exemple #3
0
        void AddPlateTabToDiagPage(PLATE_INFO pi)
        {
            TabPage page = new TabPage();

            LPRInteractiveEditUC.LPRInteractiveEditUC LPRDiagDisplay;
            LPRDiagDisplay          = new LPRInteractiveEditUC.LPRInteractiveEditUC(m_AppData);
            LPRDiagDisplay.Location = new Point(10, 10);
            page.Controls.Add(LPRDiagDisplay);
            page.Text = (pi.plateNumber == null)? " ": pi.plateNumber;

            tabControlDiagdisplay.TabPages.Add(page);

            m_TabPageLPRDiagnosticsTable.Add(page, LPRDiagDisplay);

            Bitmap BinarizedPlateImage = CreateTestBinarizedImage(pi);

            // the binarized from the test method in this C# program:
            //     LPRDiagDisplay.PostPicture(BinarizedPlateImage, (pi.plateNumber == null) ? " " : pi.plateNumber);

            LPRDiagDisplay.PostPicture(pi.plateImage, (pi.plateNumber == null)? " ": pi.plateNumber);


            LPRDiagDisplay.PostHistogram(pi.histoBmp, pi.histString);

            for (int c = 0; c < pi.charImages.Count(); c++)
            {
                LPRDiagDisplay.PostCharImage(pi.charImages[c], c, " ");
            }
        }
Exemple #4
0
        void AddPlateTabToEditPage(PLATE_INFO pi)
        {
            TabPage page = new TabPage();

            LPRInteractiveEditUC.LPRInteractiveEditUC LPREditor;
            LPREditor          = new LPRInteractiveEditUC.LPRInteractiveEditUC(m_AppData);
            LPREditor.Location = new Point(10, 10);
            page.Controls.Add(LPREditor);
            page.Text = pi.plateNumber;

            tabControlLPRResults.TabPages.Add(page);

            m_TabPageLPREditorTable.Add(page, LPREditor);

            LPREditor.PostPicture(pi.plateImage, pi.plateNumber);
            char[] plateCharsArray = pi.plateNumber.ToCharArray();
            for (int c = 0; c < pi.numChars; c++)
            {
                LPREditor.PostCharImage(pi.charImages[c], c, plateCharsArray[c].ToString());
            }
        }
Exemple #5
0
        void DrawHistoBoundsOnPlateImage(PLATE_INFO plateDiagInfo)
        {
            CreateHistoBounds(plateDiagInfo);

            Graphics g = Graphics.FromImage(plateDiagInfo.plateImage);

            Point p1 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.topEdge);
            Point p2 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.topEdge);

            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.topEdge);
            p2 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.bottomEdge);
            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.bottomEdge);
            p2 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.bottomEdge);
            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.bottomEdge);
            p2 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.topEdge);

            g.DrawLine(new Pen(Color.Blue), p1, p2);
        }
Exemple #6
0
        void ProcessImage(Bitmap bmp)
        {
            try
            {
                listBoxRejectLog.Items.Clear();

                if (bmp == null)
                {
                    return;
                }

                // get the luminance array

                int[,] lum = GetLuminanceArray(bmp);



                int error = 0;

                LPROCR_Lib.LPR_PROCESS_OPTIONS processOptions;
                processOptions = new LPROCR_Lib.LPR_PROCESS_OPTIONS();
                processOptions.EnableAutoRotationRoll = 1;
                processOptions.EnableRotationRoll     = 1;

                int diagEnabled = 0;
                if (m_AppData.LPRDiagEnabled)
                {
                    diagEnabled = 1;
                }

                // read the image
                int plateCount = m_LPREngine.m_LPRFuntions.ReadThisImage(lum, (int)diagEnabled, ref processOptions, ref error);


                // extract the plate images and detected strings

                PLATE_INFO[] plateInfos = new PLATE_INFO[plateCount];


                // get the diag images (not plate, but full images)

                if (m_AppData.LPRDiagEnabled)
                {
                    ClearDiagDisplayTable();

                    byte[,] r = new byte[bmp.Width, bmp.Height];
                    byte[,] g = new byte[bmp.Width, bmp.Height];
                    byte[,] b = new byte[bmp.Width, bmp.Height];
                    error     = 0;
                    m_LPREngine.m_LPRFuntions.diagsGetImage(1, r, g, b, ref error);// get the full resolution image

                    Bitmap imageBmp = new Bitmap(bmp.Width, bmp.Height);

                    putPixelsIntoBmp(imageBmp, r, g, b);

                    pictureBoxDiag1.Image = imageBmp;

                    int w = 0;
                    int h = 0;

                    w = bmp.Width;
                    h = bmp.Height;



                    //  m_LPREngine.m_LPRFuntions.GetSubImageSize(ref w, ref h);

                    Bitmap subscalledBmp = new Bitmap(w, h);
                    r = new byte[w, h];
                    g = new byte[w, h];
                    b = new byte[w, h];

                    //m_LPREngine.m_LPRFuntions.diagsGetImage(0, r, g, b, ref error);// get the subscalled  image

                    int[,] edge = new int[w, h];

                    //                m_LPREngine.m_LPRFuntions.getEdgeMapSub(edge, ref error);
                    m_LPREngine.m_LPRFuntions.getEdgeMapFullRes(edge, ref error);

                    ColorizeEdgeMap(edge, r, g, b);

                    putPixelsIntoBmp(subscalledBmp, r, g, b);

                    pictureBoxDiag2.Image = subscalledBmp;


                    //               get the intergal image

                    r        = new byte[bmp.Width, bmp.Height];
                    g        = new byte[bmp.Width, bmp.Height];
                    b        = new byte[bmp.Width, bmp.Height];
                    imageBmp = new Bitmap(bmp.Width, bmp.Height);

                    m_LPREngine.m_LPRFuntions.GetIntegralImage(r, g, b);
                    putPixelsIntoBmp(imageBmp, r, g, b);
                    pictureBoxDiag3.Image = imageBmp;
                }


                //   get the plates

                for (int p = 0; p < plateCount; p++)
                {
                    float score = 0;

                    plateInfos[p] = new PLATE_INFO();

                    plateInfos[p].sourceImage    = bmp;
                    plateInfos[p].sourceFileName = jpegsToProcess[m_CurrentIndex];

                    // get the string from the plate

                    plateInfos[p].plateNumber = m_LPREngine.m_LPRFuntions.GetPlateString(p, ref score);


                    // exract a bitmap of the plate itself
                    int pw = 0;
                    int ph = 0;
                    m_LPREngine.m_LPRFuntions.GetPlateImageSize(p, ref pw, ref ph, false);


                    plateInfos[p].plateImage = new Bitmap(pw, ph);

                    m_LPREngine.m_LPRFuntions.GetPlateImage(p, plateInfos[p].plateImage);

                    plateInfos[p].numChars   = plateInfos[p].plateNumber.Length;
                    plateInfos[p].charImages = new Bitmap[plateInfos[p].numChars];

                    for (int c = 0; c < plateInfos[p].numChars; c++)
                    {
                        plateInfos[p].charImages[c] = null;

                        try
                        {
                            m_LPREngine.m_LPRFuntions.GetCharImage(p, c, out plateInfos[p].charImages[c], false);
                        }
                        catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.INFORMATIONAL); }
                    }
                }// end for each plate found

                if (plateCount == 0)
                {
                    // perhaps we really screwed up and did not find a plate when one is really there,
                    // allow the user to manually add the plate numbers

                    plateInfos = new PLATE_INFO[1];

                    plateInfos[0] = new PLATE_INFO();

                    plateInfos[0].sourceImage    = bmp;
                    plateInfos[0].sourceFileName = jpegsToProcess[m_CurrentIndex];

                    // get the string from the plate

                    plateInfos[0].plateNumber = "0";


                    plateInfos[0].plateImage = bmp;// use the main picture to fill the space


                    plateInfos[0].numChars = 0;

                    plateCount = 1;
                }

                // create a display
                ClearDisplayTable();
                for (int p = 0; p < plateCount; p++)
                {
                    AddPlateTabToEditPage(plateInfos[p]);
                }

                m_CurrentImageResult = plateInfos;

                m_HaveNewDataToStore = true;



                if (m_AppData.LPRDiagEnabled)
                {
                    try
                    {
                        // get the reject log
                        string   log = m_LPREngine.m_LPRFuntions.GetRejectLog();
                        string[] sp  = log.Split(',');
                        foreach (string s in sp)
                        {
                            listBoxRejectLog.Items.Add(s);
                        }

                        //   get the plate diagnostic images, and run a diagnostic histo on original plate images

                        int count = m_LPREngine.m_LPRFuntions.GetNumCandidatePlates();

                        for (int i = 0; i < count; i++)
                        {
                            int w = 0;
                            int h = 0;
                            m_LPREngine.m_LPRFuntions.GetCandidatePlateImageSize(i, ref w, ref h);

                            byte[,] r = new byte[w, h];
                            byte[,] g = new byte[w, h];
                            byte[,] b = new byte[w, h];

                            error = 0;

                            int sucess = m_LPREngine.m_LPRFuntions.GetDiagCandidatePlateImage(i, r, g, b, ref error);// get the full resolution image
                            if (sucess == 0)
                            {
                                continue;
                            }

                            Bitmap bt = new Bitmap(w, h);

                            putPixelsIntoBmp(bt, r, g, b);

                            PLATE_INFO plateDiagInfo = new PLATE_INFO();

                            plateDiagInfo.plateImage = bt;

                            DrawHistoBoundsOnPlateImage(plateDiagInfo);



                            // get the diagnostic char images from the OCR lib

                            for (int c = 0; c < plateDiagInfo.charImages.Count(); c++)
                            {
                                Bitmap cBmp = null;
                                m_LPREngine.m_LPRFuntions.GetDiagCharImage(i, c, out cBmp);
                                plateDiagInfo.charImages[c] = cBmp;
                            }

                            // run diag histogram display on each plate

                            {
                                Bitmap plateImageUnprocessed = new Bitmap(w, h);

                                m_LPREngine.m_LPRFuntions.GetCandidatePlateImage(i, out plateImageUnprocessed);


                                plateDiagInfo.plateImageUnprocessed = plateImageUnprocessed;

                                int[,] plum = new int[plateImageUnprocessed.Width, plateImageUnprocessed.Height];

                                PixelLib.Pixels.getPixelsFromImage(plateImageUnprocessed, plum);

                                int[]        histo       = new int[256];
                                int[]        integration = new int[256];
                                Bitmap       hBmp        = new Bitmap(256, 100);
                                HistoResults histStats   = null;
                                plateDiagInfo.histString = historgram(plum, histo, integration, true, hBmp, plateDiagInfo.histoBounds, out histStats);

                                plateDiagInfo.histoBmp = hBmp;
                            }


                            AddPlateTabToDiagPage(plateDiagInfo);
                        }
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); }
        }
Exemple #7
0
        Bitmap CreateTestBinarizedImage(PLATE_INFO pi)
        {
            // get histogram
            int[,] plum = new int[pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height];

            PixelLib.Pixels.getPixelsFromImage(pi.plateImageUnprocessed, plum);

            CreateHistoBounds(pi);

            int[] histo = new int[256];
            int[] integration = new int[256];
            Bitmap hBmp = new Bitmap(256, 100);
            HistoResults histoStats=null;
            historgram(plum, histo, integration, true, hBmp, pi.histoBounds, out histoStats);

            int[,] binarizedLum = new int[pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height];

            BinarizeOnPlate(plum, binarizedLum, histoStats);

            Bitmap binBmp = new Bitmap(pi.plateImageUnprocessed.Width, pi.plateImageUnprocessed.Height);

            Pixels.putPixels(binBmp, binarizedLum);

            return (binBmp);
        }
Exemple #8
0
        void AddPlateTabToDiagPage(PLATE_INFO pi)
        {
            TabPage page = new TabPage();

            LPRInteractiveEditUC.LPRInteractiveEditUC LPRDiagDisplay;
            LPRDiagDisplay = new LPRInteractiveEditUC.LPRInteractiveEditUC(m_AppData);
            LPRDiagDisplay.Location = new Point(10, 10);
            page.Controls.Add(LPRDiagDisplay);
            page.Text = (pi.plateNumber == null )? " ": pi.plateNumber;

            tabControlDiagdisplay.TabPages.Add(page);

            m_TabPageLPRDiagnosticsTable.Add(page, LPRDiagDisplay);

            Bitmap BinarizedPlateImage = CreateTestBinarizedImage(pi);

            // the binarized from the test method in this C# program:
               //     LPRDiagDisplay.PostPicture(BinarizedPlateImage, (pi.plateNumber == null) ? " " : pi.plateNumber);

              LPRDiagDisplay.PostPicture(pi.plateImage, (pi.plateNumber == null )? " ": pi.plateNumber);

            LPRDiagDisplay.PostHistogram(pi.histoBmp, pi.histString);

            for (int c= 0; c < pi.charImages.Count(); c++)
            {
                LPRDiagDisplay.PostCharImage(pi.charImages[c], c, " ");
            }
        }
Exemple #9
0
        void ProcessImage(Bitmap bmp)
        {
            try
            {

                listBoxRejectLog.Items.Clear();

                if (bmp == null) return;

                // get the luminance array

                int[,] lum = GetLuminanceArray(bmp);

                int error = 0;

                LPROCR_Lib.LPR_PROCESS_OPTIONS processOptions;
                processOptions = new LPROCR_Lib.LPR_PROCESS_OPTIONS();
                processOptions.EnableAutoRotationRoll = 1;
                processOptions.EnableRotationRoll = 1;

                int diagEnabled = 0;
                if (m_AppData.LPRDiagEnabled) diagEnabled = 1;

                // read the image
                int plateCount = m_LPREngine.m_LPRFuntions.ReadThisImage(lum,  (int)diagEnabled, ref processOptions, ref error);

                // extract the plate images and detected strings

                PLATE_INFO[] plateInfos = new PLATE_INFO[plateCount];

                // get the diag images (not plate, but full images)

                if (m_AppData.LPRDiagEnabled)
                {
                    ClearDiagDisplayTable();

                    byte[,] r = new byte[bmp.Width, bmp.Height];
                    byte[,] g = new byte[bmp.Width, bmp.Height];
                    byte[,] b = new byte[bmp.Width, bmp.Height];
                    error = 0;
                    m_LPREngine.m_LPRFuntions.diagsGetImage(1, r, g, b, ref error);// get the full resolution image

                    Bitmap imageBmp = new Bitmap(bmp.Width, bmp.Height);

                    putPixelsIntoBmp(imageBmp, r, g, b);

                    pictureBoxDiag1.Image = imageBmp;

                    int w = 0;
                    int h = 0;

                    w = bmp.Width;
                    h = bmp.Height;

                    //  m_LPREngine.m_LPRFuntions.GetSubImageSize(ref w, ref h);

                    Bitmap subscalledBmp = new Bitmap(w, h);
                    r = new byte[w, h];
                    g = new byte[w, h];
                    b = new byte[w, h];

                    //m_LPREngine.m_LPRFuntions.diagsGetImage(0, r, g, b, ref error);// get the subscalled  image

                    int[,] edge = new int[w, h];

                    //                m_LPREngine.m_LPRFuntions.getEdgeMapSub(edge, ref error);
                    m_LPREngine.m_LPRFuntions.getEdgeMapFullRes(edge, ref error);

                    ColorizeEdgeMap(edge, r, g, b);

                    putPixelsIntoBmp(subscalledBmp, r, g, b);

                    pictureBoxDiag2.Image = subscalledBmp;

                    //               get the intergal image

                    r = new byte[bmp.Width, bmp.Height];
                    g = new byte[bmp.Width, bmp.Height];
                    b = new byte[bmp.Width, bmp.Height];
                    imageBmp = new Bitmap(bmp.Width, bmp.Height);

                    m_LPREngine.m_LPRFuntions.GetIntegralImage(r, g, b);
                    putPixelsIntoBmp(imageBmp, r, g, b);
                    pictureBoxDiag3.Image = imageBmp;
                }

                //   get the plates

                for (int p = 0; p < plateCount; p++)
                {
                    float score = 0;

                    plateInfos[p] = new PLATE_INFO();

                    plateInfos[p].sourceImage = bmp;
                    plateInfos[p].sourceFileName = jpegsToProcess[m_CurrentIndex];

                    // get the string from the plate

                    plateInfos[p].plateNumber = m_LPREngine.m_LPRFuntions.GetPlateString(p, ref score);

                    // exract a bitmap of the plate itself
                    int pw = 0;
                    int ph = 0;
                    m_LPREngine.m_LPRFuntions.GetPlateImageSize(p, ref pw, ref ph, false);

                    plateInfos[p].plateImage = new Bitmap(pw, ph);

                    m_LPREngine.m_LPRFuntions.GetPlateImage(p, plateInfos[p].plateImage);

                    plateInfos[p].numChars = plateInfos[p].plateNumber.Length;
                    plateInfos[p].charImages = new Bitmap[plateInfos[p].numChars];

                    for (int c = 0; c < plateInfos[p].numChars; c++)
                    {
                        plateInfos[p].charImages[c] = null;

                        try
                        {
                            m_LPREngine.m_LPRFuntions.GetCharImage(p, c, out plateInfos[p].charImages[c], false);
                        }
                        catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.INFORMATIONAL); }
                    }

                }// end for each plate found

                if (plateCount == 0)
                {
                    // perhaps we really screwed up and did not find a plate when one is really there,
                    // allow the user to manually add the plate numbers

                    plateInfos = new PLATE_INFO[1];

                    plateInfos[0] = new PLATE_INFO();

                    plateInfos[0].sourceImage = bmp;
                    plateInfos[0].sourceFileName = jpegsToProcess[m_CurrentIndex];

                    // get the string from the plate

                    plateInfos[0].plateNumber = "0";

                    plateInfos[0].plateImage = bmp;// use the main picture to fill the space

                    plateInfos[0].numChars = 0;

                    plateCount = 1;
                }

                // create a display
                ClearDisplayTable();
                for (int p = 0; p < plateCount; p++)
                {
                    AddPlateTabToEditPage(plateInfos[p]);
                }

                m_CurrentImageResult = plateInfos;

                m_HaveNewDataToStore = true;

                if (m_AppData.LPRDiagEnabled)
                {
                    try
                    {
                        // get the reject log
                        string log = m_LPREngine.m_LPRFuntions.GetRejectLog();
                        string[] sp = log.Split(',');
                        foreach (string s in sp) listBoxRejectLog.Items.Add(s);

                        //   get the plate diagnostic images, and run a diagnostic histo on original plate images

                        int count = m_LPREngine.m_LPRFuntions.GetNumCandidatePlates();

                        for (int i = 0; i < count; i++)
                        {
                            int w = 0;
                            int h = 0;
                            m_LPREngine.m_LPRFuntions.GetCandidatePlateImageSize(i, ref w, ref h);

                            byte[,] r = new byte[w, h];
                            byte[,] g = new byte[w, h];
                            byte[,] b = new byte[w, h];

                            error = 0;

                            int sucess = m_LPREngine.m_LPRFuntions.GetDiagCandidatePlateImage(i, r, g, b, ref error);// get the full resolution image
                            if (sucess == 0) continue;

                            Bitmap bt = new Bitmap(w, h);

                            putPixelsIntoBmp(bt, r, g, b);

                            PLATE_INFO plateDiagInfo = new PLATE_INFO();

                            plateDiagInfo.plateImage = bt;

                            DrawHistoBoundsOnPlateImage(plateDiagInfo);

                            // get the diagnostic char images from the OCR lib

                            for (int c = 0; c < plateDiagInfo.charImages.Count(); c++)
                            {
                                Bitmap cBmp = null;
                                m_LPREngine.m_LPRFuntions.GetDiagCharImage(i, c, out cBmp);
                                plateDiagInfo.charImages[c] = cBmp;
                            }

                            // run diag histogram display on each plate

                            {

                                Bitmap plateImageUnprocessed = new Bitmap(w, h);

                                m_LPREngine.m_LPRFuntions.GetCandidatePlateImage(i, out plateImageUnprocessed);

                                plateDiagInfo.plateImageUnprocessed = plateImageUnprocessed;

                                int[,] plum = new int[plateImageUnprocessed.Width, plateImageUnprocessed.Height];

                                PixelLib.Pixels.getPixelsFromImage(plateImageUnprocessed, plum);

                                int[] histo = new int[256];
                                int[] integration = new int[256];
                                Bitmap hBmp = new Bitmap(256, 100);
                                HistoResults histStats = null;
                                plateDiagInfo.histString = historgram(plum, histo, integration, true, hBmp, plateDiagInfo.histoBounds, out histStats);

                                plateDiagInfo.histoBmp = hBmp;
                            }

                            AddPlateTabToDiagPage(plateDiagInfo);
                        }
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); }

                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); }
        }
Exemple #10
0
        void DrawHistoBoundsOnPlateImage(PLATE_INFO plateDiagInfo)
        {
            CreateHistoBounds(plateDiagInfo);

            Graphics g = Graphics.FromImage(plateDiagInfo.plateImage);

            Point p1 = new Point( plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.topEdge);
            Point p2 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.topEdge);

            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.topEdge);
            p2 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.bottomEdge);
            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.rightEdge, plateDiagInfo.histoBounds.bottomEdge);
            p2 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.bottomEdge);
            g.DrawLine(new Pen(Color.Blue), p1, p2);

            p1 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.bottomEdge);
            p2 = new Point(plateDiagInfo.histoBounds.leftEdge, plateDiagInfo.histoBounds.topEdge);

            g.DrawLine(new Pen(Color.Blue), p1, p2);
        }
Exemple #11
0
        void CreateHistoBounds(PLATE_INFO plateDiagInfo)
        {
            int w = plateDiagInfo.plateImage.Width;
            int h = plateDiagInfo.plateImage.Height;

            int centerX = w / 2;
            int centerY = h / 2;
            plateDiagInfo.histoBounds = new HistogramBounds();
            plateDiagInfo.histoBounds.leftEdge = centerX - 50;
            if (plateDiagInfo.histoBounds.leftEdge < 0) plateDiagInfo.histoBounds.leftEdge = 10;
            plateDiagInfo.histoBounds.rightEdge = centerX + 50;
            if (plateDiagInfo.histoBounds.rightEdge >= w) plateDiagInfo.histoBounds.rightEdge = w - 10;

            plateDiagInfo.histoBounds.topEdge = centerY - 10;
            if (plateDiagInfo.histoBounds.topEdge < 0) plateDiagInfo.histoBounds.topEdge = 0;

            plateDiagInfo.histoBounds.bottomEdge = centerY + 10;
            if (plateDiagInfo.histoBounds.bottomEdge < 0) plateDiagInfo.histoBounds.bottomEdge = 0;
        }
Exemple #12
0
        void AddPlateTabToEditPage(PLATE_INFO pi)
        {
            TabPage page = new TabPage();

            LPRInteractiveEditUC.LPRInteractiveEditUC LPREditor;
            LPREditor = new LPRInteractiveEditUC.LPRInteractiveEditUC(m_AppData);
            LPREditor.Location = new Point(10, 10);
            page.Controls.Add(LPREditor);
            page.Text = pi.plateNumber;

            tabControlLPRResults.TabPages.Add(page);

            m_TabPageLPREditorTable.Add(page, LPREditor);

            LPREditor.PostPicture(pi.plateImage, pi.plateNumber);
            char[] plateCharsArray = pi.plateNumber.ToCharArray();
            for (int c = 0; c < pi.numChars; c++)
            {
                LPREditor.PostCharImage(pi.charImages[c], c, plateCharsArray[c].ToString());
            }
        }