public IPicAccess getSubPic(int x, int y, int w, int h) { MyPic r = new MyPic(new Size(w, h)); r.pTreshold = pTreshold; for (int yl = 0; yl < r.getDimenion().Height; yl++) { for (int xl = 0; xl < r.getDimenion().Width; xl++) { r.setPixel2(xl, yl, getPixel2(xl + x, yl + y)); } } return(r); }
public static char RecogniseChar(MyPic pic) { pic.ToFileIfConfigured("TextRecognitionLibrary.TextCourierNew10.SaveInput"); Size pSize = pic.getDimenion(); if (pic.getDimenion().Height != 10) { throw new ArgumentException("TextCourierNew10"); } doInitialisation_CourierNew10(); string unqIs2 = pic.ToUniqueString(); if (Dict.ContainsKey(unqIs2)) { char r = (char)Dict[unqIs2]; if (r == 99) { return('?'); } r += '0'; return(r); } else { // not there, so dump the file so it can be added to the configration if (unqIs2.Length < 110) { pic.ToFile(unqIs2); } } MyPic picBlack = pic.Threshold_AlmostBlack(); string unqIs = picBlack.ToUniqueString(); //string unqIs2 = pic.ToUniqueString(); return('?'); }