public static void Run() { // ExStart:SkewImageCorrectionUsingAlgorithm // The path to the documents directory. string dataDir = RunExamples.GetDataDir_OCR(); // Load template file OmrTemplate template = OmrTemplate.Load(dataDir + "questions.amr"); // Load the image to be analyzed OmrImage image = OmrImage.Load(dataDir + "answers.jpg"); // Area of the image to be processed Rectangle area = new Rectangle(0, 0, image.Width, image.Height); // Grayscale conversion GrayscaleAlgorithm gs = new GrayscaleAlgorithm(); gs.Process(image, area); // Binarization AverageThresholdAlgorithm threshold = new AverageThresholdAlgorithm(); threshold.Process(image, area); // Skew correction SkewCorrectionAlgorithm skewCorrection = new SkewCorrectionAlgorithm(); skewCorrection.Process(ref image, area); // save image image.AsBitmap().Save(dataDir + "result_out.jpg"); // ExEnd:SkewImageCorrectionUsingAlgorithm }