Exemplo n.º 1
0
        public int getValidPlates(gxImage image, ref List <string> list)
        {
            int count = 0;

            lock (this)
            {
                try
                {
                    // Finds the first plate and displays it
                    //QueryPerformanceCounter(&counter_before);
                    bool found = _anpr.FindFirst(image);
                    //QueryPerformanceCounter(&counter_after);
                    //double anprTime = (double)(counter_after.QuadPart - counter_before.QuadPart) / freq.QuadPart;

                    list.Clear();

                    while (found)
                    {
                        string resultLoop = _anpr.GetText();

                        if (isValidPlateString(resultLoop))
                        {
                            //Console.WriteLine("[OK]" + resultLoop);
                            list.Add(getAdjustPlate(resultLoop));
                            count++;
                        }
                        else
                        {
                            //Console.WriteLine("[NG]" + resultLoop);
                        }

                        // Finds other plates
                        found = _anpr.FindNext();
                    }
                    //printf("\n");
                    //printf("\nMemLoad:%lf\tAnpr:%lf\n", loadTime, anprTime);
                }
                catch (gxException e)
                {
                    System.Diagnostics.Debug.WriteLine("Get Plates Failed : " + e.ToString());
                }
            }
            return(count);
        }
Exemplo n.º 2
0
        private static SerializeObject ProcessPhoto(SerializeObject anprInfo)
        {
            var anpr  = new cmAnpr("default");
            var image = new gxImage("default");

            image.Load(anprInfo.PhotoPath);

            if (!anpr.FindFirst(image))
            {
                throw new NotFoundPhotoException($"Nie znaleziono zdjęcia o ścieżce: {anprInfo.PhotoPath}");
            }
            var frame = anpr.GetFrame();

            anprInfo.Vehicles.First().PlateLPR   = anpr.GetText();
            anprInfo.Vehicles.First().Confidence = anpr.GetConfidence();
            anprInfo.Vehicles.First().PlateX     = frame.x1;
            anprInfo.Vehicles.First().PlateY     = frame.y1;
            //anprInfo.Vehicles.First().PlateHeight = ;
            //anprInfo.Vehicles.First().PlateWidth = ;

            //while (anpr.FindNext())
            //{
            //    frame = anpr.GetFrame();
            //    anprInfo.Vehicles.Add(new Vehicle
            //    {
            //        PlateLPR = anpr.GetText(),
            //        Confidence = anpr.GetConfidence(),
            //        PlateX = frame.x1,
            //        PlateY = frame.y1,
            //        //PlateHeight =
            //        //PlateWidth =
            //    });
            //}

            return(anprInfo);
        }