Esempio n. 1
0
        private PlateVerticalGraph HistogramYaxis(IplImage image)
        {
            PlateVerticalGraph graph     = new PlateVerticalGraph(this);
            IplImage           imageCopy = null;

            Int32 w = image.Width;
            Int32 h = image.Height;

            try
            {
                imageCopy = new IplImage(image.Size, image.Depth, image.NChannels);
                Cv.CvtColor(image, imageCopy, ColorConversion.RgbToHsv);

                for (Int32 y = 0; y < h; y++)
                {
                    Double counter = 0.0;
                    for (Int32 x = 0; x < w; x++)
                    {
                        counter += GetBrightness(imageCopy, x, y);
                    }
                    graph.AddPeak(counter);
                }
            }
            finally
            {
                if (null != imageCopy)
                {
                    Cv.ReleaseImage(imageCopy);
                }
            }

            return(graph);
        }
Esempio n. 2
0
        public void Normalize(Int32 method)
        {
            IplImage tempImage = null;
            Plate    clone1    = this.Clone();

            VerticalEdgeDetector(clone1.GetImage);
            //clone1.GetImage.SaveImage(@"C:\temp\newImages\newVerticalEdgeDetector.png");
            PlateVerticalGraph vertical = clone1.HistogramYaxis(clone1.GetImage);

            tempImage = CutTopBottom(image, vertical);
            Cv.ReleaseImage(image);
            image = tempImage;
            // JIVAN
            //plateCopy.image.SaveImage(@"C:\temp\newImages\newBEFOREVerticalCutTopBottom.png");
            tempImage = CutTopBottom(plateCopy.image, vertical);
            Cv.ReleaseImage(plateCopy.image);
            plateCopy.image = tempImage;
            // JIVAN
            //plateCopy.image.SaveImage(@"C:\temp\newImages\newVerticalCutTopBottom.png");
            Plate clone2 = this.Clone();

            if (1 == horizontalDetectionType)
            {
                HorizontalEdgeDetector(clone2.GetImage);
                //TODO JIVAN Remove these 2 lines when project gest done
                //clone2.ClearImage();
                //clone2 = new Plate(new IplImage(@"C:\temp\HorizontalEdgeDetector.png"));
                //clone2.GetImage.SaveImage(@"C:\temp\newImages\newCloneHorizontalEdgeDetector.png");
            }

            PlateHorizontalGraph horizontal = clone1.HistogramXaxis(clone2.GetImage);

            tempImage = CutLeftRight(image, horizontal, method);
            Cv.ReleaseImage(image);
            image     = tempImage;
            tempImage = CutLeftRight(plateCopy.image, horizontal, method);
            Cv.ReleaseImage(plateCopy.image);
            plateCopy.image = tempImage;
            // JIVAN
            //plateCopy.image.SaveImage(@"C:\temp\newImages\newHorizontalCutLeftRight.png");

            clone2.ClearImage();
            clone1.ClearImage();
        }
 public PeakComparer(PlateVerticalGraph pGraph)
 {
     graphHandle = pGraph;
 }
Esempio n. 4
0
 private IplImage CutTopBottom(IplImage origin, PlateVerticalGraph graph)
 {
     graph.ApplyProbabilityDistributor(new Graph.ProbabilityDistributor(0.0, 0.0, 2, 2));
     Graph.Peak p = graph.FindPeak(3)[0];
     return(GetSubImage(origin, new CvRect(0, p.Left, origin.Width, p.GetDiff)));
 }