internal string Run() { var fileName = @"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe"; var img = Image.FromFile(targetLocation); var bmp = new Bitmap(img); StringBuilder sb = new StringBuilder(); for (int j = 0; j < bmp.Height; j++) { var val = 0x0; for (int i = 0; i < bmp.Width; i++) { var isBlack = SplitFile.Calculate(bmp.GetPixel(i, j)); if (isBlack) { val |= (isBlack ? 1 : 0); val = val << 1; } } sb.Append(val.ToString("x4")); } var findValue = FindHashText(sb.ToString()); if (findValue == null) { var p = Process.Start(new ProcessStartInfo(fileName, string.Format("{0} stdout -l chi_sim -psm 10", targetLocation)) { RedirectStandardOutput = true, UseShellExecute = false, StandardOutputEncoding = Encoding.UTF8 }); var value = p.StandardOutput.ReadToEnd().Trim(); p.WaitForExit(); var newValue = new DicValue { HashText = sb.ToString(), Location = targetLocation, Value = value }; Insert(newValue); DbDictionary[newValue.HashText] = newValue.Value; Console.WriteLine(newValue.Value); return(value); } Console.WriteLine(findValue); return(findValue); }
static void Main(string[] args) { var files = ListFile.List("d:\\装备名"); //var files = ListFile.List(@"D:\Out\Y"); //foreach (var file in files) //{ // var split = new SplitFile(file); // split.SplitX(file); //} int i = 1; foreach (var file in files) { var split = new SplitFile(file); split.Page = i++; split.SplitY(); } }