Exemplo n.º 1
0
        public static void OnePassOfWindow(System.Drawing.Image src, int width, int height)
        {
            Bitmap    bmpImage = new Bitmap(src);
            Rectangle cropRect = new Rectangle();
            Bitmap    newImage = new Bitmap(64, 128);

            for (int i = 0; i < src.Height - height; i += height / 4)
            {
                for (int j = 0; j < src.Width - width; j += width / 4)
                {
                    cropRect = new Rectangle(j, i, width, height);
                    newImage = bmpImage.Clone(cropRect, bmpImage.PixelFormat);
                    newImage = (Bitmap)ImageFunctions.ScaleImage(newImage, 64, 128);

                    HistogramsOfOrientedGradients hog = new HistogramsOfOrientedGradients();
                    hog.ProcessImage(newImage);
                    double[, ][] hogHistogram = hog.Histograms;

                    CompareHOG(hogHistogram);
                }
            }
        }
Exemplo n.º 2
0
        public static void OnePassOfWindow(System.Drawing.Image src, int width, int height, int step)
        {
            Bitmap bmpImage = new Bitmap(src);

            cropRect = new Rectangle();
            Bitmap newImage = new Bitmap(64, 128);

            for (int i = 0; i < src.Height - height; i += step)
            {
                for (int j = 0; j < src.Width - width; j += step)
                {
                    cropRect = new Rectangle(j, i, width, height);
                    newImage = bmpImage.Clone(cropRect, bmpImage.PixelFormat);
                    newImage = (Bitmap)ImageFunctions.ScaleImage(newImage, 64, 128);

                    HistogramsOfOrientedGradients hog = new HistogramsOfOrientedGradients();
                    hog.ProcessImage(newImage);
                    double[, ][] hogHistogram = hog.Histograms;
                    bool         t            = CompareHOG(hogHistogram);
                    if (t)
                    {
                        rectangleList.Add(cropRect);
                        newImage.Save(@"Output\image_" + Counter + ".png");
                    }
                    Counter += 1;

                    if (Counter % (ScanForm.countIter / 100) == 0)
                    {
                        progressValue++;
                        if (progressValue <= 100)
                        {
                            ScanForm.pb.Value = progressValue;
                        }
                        System.Threading.Thread.Sleep(10);
                    }
                }
            }
        }