public void Get_png_text_Tests() { Image image = Image.FromFile(Path.Combine(filePath, "seccode.jpg")); Bitmap bitmap = new Bitmap(image); Bitmap bitmask = new Bitmap(bitmap.Width, bitmap.Height); bitmap = ImgManager.SetContrast(bitmap, 100); string NewFile = Path.Combine(filePath, "seccode_" + Guid.NewGuid().ToString("N") + ".jpg"); bitmap.Save(NewFile); var nb = new Bitmap(Image.FromFile(NewFile)); var img = ImgManager.SetReplacesFloodFill(nb, 0, 0, Color.White); string imgNewFile = Path.Combine(filePath, "seccode_flood_" + Guid.NewGuid().ToString("N") + ".jpg"); img.Save(imgNewFile); ImgOcr.DataPath = datapath; var value = ImgOcr.GetStringFromImage(imgNewFile); Assert.IsEmpty(""); }
public void Initialize(string path) { this.imgeslideshow.Clear(true); FileInfo[] fileInfos = new DirectoryInfo(path).GetFiles(); List <string> fileDirModelList = new List <string>(); int i = 0; int curIndex = 0; foreach (FileInfo file in fileInfos) { if ((file.Attributes & FileAttributes.System) != FileAttributes.System && (file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { if (ExtersionList.Contains(file.Extension.ToLower())) { int width = 1920 * 2; // System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; int height = 1080 * 2; // System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; MemoryStream ms = ImgManager.GetImagebyMemoryStream(file.FullName, width, height); //MemoryStream ms = ImgCore.GetNewImageStream(file.FullName, width, height); this.imgeslideshow.AddItem(ms, file.FullName, null, file.FullName); i++; } } } this.imgeslideshow.InitSlidShow(0); }