private void makeGrayscaleAndResizingToolStripMenuItem_Click(object sender, EventArgs e) { if (FBD.ShowDialog() == DialogResult.OK) { ImageFunctions.ConvertImage(FBD.SelectedPath, @"E:\Output"); } }
private void makeGrayscaleAndResizingToolStripMenuItem_Click(object sender, EventArgs e) { FBD = new FolderBrowserDialog(); if (FBD.ShowDialog() == DialogResult.OK) { DirectoryInfo myFolder = new DirectoryInfo(FBD.SelectedPath); ImageFunctions.ConvertImage(FBD.SelectedPath, @"E:\Output"); } }
public static void ImageScanning(string path) { System.Drawing.Image image = System.Drawing.Image.FromFile(@path); Bitmap grayscaleImage = ImageFunctions.MakeGrayscale3((Bitmap)image); grayscaleImage = ImageFunctions.ContrastStretch(grayscaleImage); AllPassesOfWindow(grayscaleImage); }
public static void ImageScanning(System.Drawing.Image image, int step) { rectangleList.Clear(); Bitmap grayscaleImage = ImageFunctions.MakeGrayscale3((Bitmap)image); grayscaleImage = ImageFunctions.ContrastStretch(grayscaleImage, 0.02, 0.01); AllPassesOfWindow(grayscaleImage, step); }
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); } } }
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); } } } }