public static void Run()
        {
            // ExStart:UsingNotifierFactory
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "answers.jpg");

            // Get an instance of WordNotifier, Write a delegate to handle the Elapsed event and Display the recognized text on screen
            INotifier processorBlock = NotifierFactory.BlockNotifier();

            processorBlock.Elapsed += delegate
            {
                Console.WriteLine(processorBlock.Text);
            };

            // Add the word processor to the OcrEngine and Process the image
            ocrEngine.AddNotifier(processorBlock);
            ocrEngine.Process();
            // ExEnd:UsingNotifierFactory
        }
        public static bool FindTextInImageFile(string fileFullPath, string text, ref CancellationTokenSource cts)
        {
            try
            {
                // Create an instance of OcrEngine class
                var ocr = new OcrEngine();

                // Set the Image property of OcrEngine by reading an image file
                ocr.Image = ImageStream.FromFile(fileFullPath);

                // Set the RemoveNonText to true
                ocr.Config.DetectTextRegions = true;

                // Perform OCR operation
                if (ocr.Process())
                {
                    if (ocr.Text.ToString().Contains(text))
                    {
                        return(true);
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(false);
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Create an initialize an instance of OcrEngine
            OcrEngine engine = new OcrEngine();

            // Set the OcrEngine.Image property by loading an image from disk, memory or URL
            engine.Image = ImageStream.FromFile(dataDir + "Sample.bmp");

            // Create text recognition block by supplying X,Y coordinates and Width,Height values
            IRecognitionBlock block = RecognitionBlock.CreateTextBlock(6, 9, 120, 129);

            // Set the Whitelist property by specifying a new block whitelist
            block.Whitelist = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

            // YOU CAN ADD MORE TEXT BLOCK AND SET WHITE LISTS.

            // Set different configurations and add recognition block(s)
            engine.Config.ClearRecognitionBlocks();
            engine.Config.AddRecognitionBlock(block);
            engine.Config.DetectTextRegions = false;

            // Call OcrEngine.Process method to perform OCR operation
            if (engine.Process())
            {
                // Display the recognized text from each Page
                Console.WriteLine(engine.Text);
            }
        }
Пример #4
0
        public static void Run()
        {
            // ExStart:ReadPartInformation
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Run recognition process
            if (ocrEngine.Process())
            {
                Console.WriteLine(ocrEngine.Text);
                // Retrieve an array of recognized text by parts
                IRecognizedPartInfo[] text = ocrEngine.Text.PartsInfo;
                // Iterate over the text parts
                foreach (IRecognizedTextPartInfo symbol in text)
                {
                    // Display part intomation
                    Console.WriteLine("Text : " + symbol.Text);
                    Console.WriteLine("isItalic : " + symbol.Italic);
                    Console.WriteLine("Language : " + symbol.Language);
                }
            }
            // ExStart:ReadPartInformation
        }
        public static void Run()
        {
            // ExStart:ExtractPreprocessedImage
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // set SavePreprocessedImages to true to save preprocessed images
            ocrEngine.Config.SavePreprocessedImages = true;

            // Set the Image property by loading the image from file path location or an instance of Stream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sample.jpg");

            if (ocrEngine.Process())
            {
                //Save binarized image on disc
                ocrEngine.PreprocessedImages.BinarizedImage.Save(dataDir + "Output\\BinarizedImage.png", System.Drawing.Imaging.ImageFormat.Png);

                //Save filtered image on disc
                ocrEngine.PreprocessedImages.FilteredImage.Save(dataDir + "Output\\FilteredImage.png", System.Drawing.Imaging.ImageFormat.Png);

                //Save image after removing non-textual fragments
                ocrEngine.PreprocessedImages.NonTextRemovedImage.Save(dataDir + "Output\\NonTextRemovedImage.png", System.Drawing.Imaging.ImageFormat.Png);

                //Save image after skew correction
                ocrEngine.PreprocessedImages.RotatedImage.Save(dataDir + "Output\\RotatedImage.png", System.Drawing.Imaging.ImageFormat.Png);

                //Save image after textual block detection
                ocrEngine.PreprocessedImages.TextBlocksImage.Save(dataDir + "Output\\TextBlocksImage.png", System.Drawing.Imaging.ImageFormat.Png);
            }
            Console.WriteLine(ocrEngine.Text);
            // ExEnd:ExtractPreprocessedImage
        }
        public static void Run()
        {
            // ExStart:ExtractPreprocessedImages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "sample1.jpg");
            ocrEngine.Config.SavePreprocessedImages = true;

            // Process the image
            if (ocrEngine.Process())
            {
                // Save binarized,filtered image on disc
                ocrEngine.PreprocessedImages.BinarizedImage.Save(dataDir + "BinarizedImage_out.png", System.Drawing.Imaging.ImageFormat.Png);
                ocrEngine.PreprocessedImages.FilteredImage.Save(dataDir + "FilteredImage_out.png", System.Drawing.Imaging.ImageFormat.Png);

                // Save image after removing non-textual fragments,  skew correction and textual block detection
                ocrEngine.PreprocessedImages.NonTextRemovedImage.Save(dataDir + "NonTextRemovedImage_out.png", System.Drawing.Imaging.ImageFormat.Png);
                ocrEngine.PreprocessedImages.RotatedImage.Save(dataDir + "RotatedImage_out.png", System.Drawing.Imaging.ImageFormat.Png);
                ocrEngine.PreprocessedImages.TextBlocksImage.Save(dataDir + "TextBlocksImage_out.png", System.Drawing.Imaging.ImageFormat.Png);
            }
            // ExEnd:ExtractPreprocessedImages
        }
Пример #7
0
        public static void Run()
        {
            // ExStart:DetectingTextBlocks
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Remove non-textual blocks
            ocrEngine.Config.RemoveNonText = true;

            // Run recognition process
            if (ocrEngine.Process())
            {
                // Display text block locations
                foreach (IRecognizedPartInfo part in ocrEngine.Text.PartsInfo)
                {
                    Console.WriteLine(part.Box);
                }
            }
            // ExEnd:DetectingTextBlocks
        }
Пример #8
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Clear notifier list
            ocrEngine.ClearNotifies();

            //Clear recognition blocks
            ocrEngine.Config.ClearRecognitionBlocks();

            //Add 2 rectangles to user defined recognition blocks
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(27, 63, 34, 38));   //Detecting A
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(209, 111, 28, 34)); //Detecting 6

            //Ignore everything else on the image other than the user defined recognition blocks
            ocrEngine.Config.DetectTextRegions = false;

            //Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "sampleocr.bmp");

            //Run recognition process
            if (ocrEngine.Process())
            {
                Console.WriteLine(ocrEngine.Text);
            }
        }
Пример #9
0
        public static void Run()
        {
            // ExStart:ApplyingCorrectionFilters
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();
            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Create CorrectionFilters collection
            CorrectionFilters filters = new CorrectionFilters();
            Filter            filter  = null;

            // Initialize Median filter
            filter = new MedianFilter(5);
            filters.Add(filter);

            // Create Gaussian Blur filter
            filter = new GaussBlurFilter();
            filters.Add(filter);

            // Assign collection to OcrEngine
            ocrEngine.Config.CorrectionFilters = filters;

            // Run recognition process
            if (ocrEngine.Process())
            {
                // Display results
                Console.WriteLine(ocrEngine.Text);
            }
            // ExEnd:ApplyingCorrectionFilters
        }
Пример #10
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Run recognition process
            if (ocrEngine.Process())
            {
                Console.WriteLine(ocrEngine.Text);
                // Retrieve an array of recognized text by parts
                IRecognizedPartInfo[] text = ocrEngine.Text.PartsInfo;
                // Iterate over the text parts
                foreach (IRecognizedTextPartInfo symbol in text)
                {
                    // Display part intomation
                    Console.WriteLine("Text : " + symbol.Text);
                    Console.WriteLine("isItalic : " + symbol.Italic);
                    Console.WriteLine("isUnderline : " + symbol.Underline);
                    Console.WriteLine("isBold : " + symbol.Bold);
                    Console.WriteLine("FontSize : " + symbol.FontSize);
                    Console.WriteLine("Language : " + symbol.Language);
                }
            }
        }
Пример #11
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Run recognition process
            if (ocrEngine.Process())
            {
                Console.WriteLine(ocrEngine.Text);
                //Retrieve an array of recognized text by parts
                IRecognizedPartInfo[] text = ocrEngine.Text.PartsInfo;
                //Iterate over the text parts
                foreach (IRecognizedTextPartInfo symbol in text)
                {
                    //Display the part information
                    Console.WriteLine("Symbol:" + symbol.Text);
                    //Get the rectangle sourronding the symbol
                    Rectangle box = symbol.Box;
                    //Display the rectangle location on the image canvas
                    Console.WriteLine("Box Location:" + box.Location);
                    //Display the rectangle dimensions
                    Console.WriteLine("Box Size:" + box.Size);
                }
            }
        }
        public static void Run()
        {
            // ExStart:OCROnMultipageTIFF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR() + "SampleTiff.tiff";

            // Create an initialize an instance of OcrEngine
            OcrEngine engine = new OcrEngine();

            // Set the OcrEngine.Image property by loading a multipage TIFF from disk, memory or URL
            engine.Image = ImageStream.FromFile(dataDir);

            // Set OcrEngine.ProcessAllPages to true in order to process all pages of TIFF in single run
            engine.ProcessAllPages = true;

            // Call OcrEngine.Process method to perform OCR operation
            if (engine.Process())
            {
                // Retrieve the list of Pages
                Page[] pages = engine.Pages;

                // Iterate over the list of Pages
                foreach (Page page in pages)
                {
                    // Display the recognized text from each Page
                    Console.WriteLine(page.PageText);
                }
            }
            // ExStart:OCROnMultipageTIFF
        }
        public static void Run()
        {
            // ExStart:GettingNotification
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();
            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Get an instance of INotifier
            INotifier processorWord = NotifierFactory.WordNotifier();

            //Write a delegate to handle the Elapsed event
            processorWord.Elapsed += delegate
            {
                // Display the recognized text on screen
                Console.WriteLine(processorWord.Text);
            };

            // Add the word processor to the OcrEngine
            ocrEngine.AddNotifier(processorWord);

            // Process the image
            ocrEngine.Process();
            // ExEnd:GettingNotification
        }
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Get an instance of INotifier
            INotifier processorWord = NotifierFactory.WordNotifier();

            //Write a delegate to handle the Elapsed event
            processorWord.Elapsed += delegate
            {
                //Display the recognized text on screen
                Console.WriteLine(processorWord.Text);
            };

            // Add the word processor to the OcrEngine
            ocrEngine.AddNotifier(processorWord);

            //Process the image
            ocrEngine.Process();
        }
Пример #15
0
 public void resetNodeAttributes(bool TypeofNode)
 {
     this.joinStatus                       = false;
     this.nodeDead                         = false;//the node is alive
     this.nodeType                         = TypeofNode;
     this.children                         = 0;
     this.nodeState                        = 0;// the node is in the receiving mode.
     this.old_p_mac_x                      = -100;
     this.old_p_mac_y                      = -100;
     this.p_mac_x                          = 40000;
     this.p_mac_y                          = 40000;
     this.MessageCycles                    = 0;
     this.totalBitsTransmitted             = 0;
     this.totalBitsReceived                = 0;
     this.childMacList                     = null;
     this.receivedApplicationMessages      = null;
     this.receivedApplicationMessagesCount = 0;
     if (TypeofNode == false)         //ordinary node
     {
         this.img = ImageStream.FromFile("unDecidedNode.bmp");
         this.battery.BATTERYPOWER = 0.5;
         this.nodeState            = 0;
         this.hops           = 10000;
         this.PowerOfThePath = 0;
     }
     else            //base station
     {
         this.img = ImageStream.FromFile("BaseStation.bmp");
         this.battery.BATTERYPOWER = 10000;
         this.nodeState            = 1;
         this.hops           = 0;
         this.PowerOfThePath = 1000;
     }
 }
        public static void Run()
        {
            // ExStart:WorkingWithDifferentLanguages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of Stream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "SpanishOCR.bmp");

            // Clear the default language (English)
            ocrEngine.LanguageContainer.Clear();

            // Load the resources of the language from file path location or an instance of Stream
            ocrEngine.LanguageContainer.AddLanguage(LanguageFactory.Load(dataDir + "Aspose.OCR.Spanish.Resources.zip"));

            // Process the image
            if (ocrEngine.Process())
            {
                // Display the recognized text
                Console.WriteLine(ocrEngine.Text);
            }
            // ExEnd:WorkingWithDifferentLanguages
        }
Пример #17
0
        public static void Run()
        {
            // ExStart:ExtractingText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Clear notifier list
            ocrEngine.ClearNotifies();

            // Clear recognition blocks
            ocrEngine.Config.ClearRecognitionBlocks();

            // Add 2 rectangles to user defined recognition blocks
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(27, 63, 34, 38));   // Detecting A
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(209, 111, 28, 34)); // Detecting 6

            // Ignore everything else on the image other than the user defined recognition blocks
            ocrEngine.Config.DetectTextRegions = false;

            // Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "sampleocr.bmp");

            // Run recognition process
            if (ocrEngine.Process())
            {
                Console.WriteLine(ocrEngine.Text);
            }
            // ExEnd:ExtractingText
        }
Пример #18
0
        public static void Run()
        {
            // ExStart:UserDefinedRecognitionBlocks
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Clear notifier list
            ocrEngine.ClearNotifies();

            // Clear recognition blocks
            ocrEngine.Config.ClearRecognitionBlocks();

            // Add 3 rectangle blocks to user defined recognition blocks
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(0, 10, 20, 40));
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(0, 4, 5, 6));
            ocrEngine.Config.AddRecognitionBlock(RecognitionBlock.CreateTextBlock(0, 5, 5, 6));

            // Ignore everything else on the image other than the user defined recognition blocks
            ocrEngine.Config.DetectTextRegions = false;

            // Set Image property by loading an image from file path
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Run recognition process
            if (ocrEngine.Process())
            {
                // Retrieve user defined blocks that determines the paye layout
                var blocks = ocrEngine.Config.RecognitionBlocks;
                // Loop over the list of blocks
                foreach (var block in blocks)
                {
                    // Display if block is set to be recognized
                    Console.WriteLine(block.ToRecognize);
                    // Check if block has recognition data
                    if (block.RecognitionData == null)
                    {
                        Console.WriteLine("Null{0}", Environment.NewLine);
                        continue;
                    }
                    // Display dimension & size of rectangle that defines the recognition block
                    Console.WriteLine("Block: {0}", block.Rectangle);
                    if (block.RecognitionData is IRecognizedTextPartInfo)
                    {
                        // Display the recognition results
                        IRecognizedTextPartInfo textPartInfo = (IRecognizedTextPartInfo)block.RecognitionData;
                        Console.WriteLine("Text: {0}{1}", textPartInfo.Text, Environment.NewLine);
                    }
                }
            }
            // ExEnd:UserDefinedRecognitionBlocks
        }
Пример #19
0
        static void Main(string[] args)
        {
            var engine = new Aspose.OCR.OcrEngine();

            //Image _image = Image.FromStream(/* ?? throw new InvalidOperationException()*/);

            engine.Image = ImageStream.FromFile(@"D:\cb035707ba69886349f3b0b6bc4e_1573200kn.png");


            engine.Process();
            var a = engine.Text;
        }
Пример #20
0
        public static void Run()
        {
            // ExStart:GetTextPartHierarchy
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Process the image
            if (ocrEngine.Process())
            {
                // Retrieve the first block of the recognized text part
                IRecognizedTextPartInfo firstBlock = (ocrEngine.Text.PartsInfo[0] as IRecognizedTextPartInfo);

                // Get the children of the first block that will be the lines in the block
                if (firstBlock != null)
                {
                    IRecognizedPartInfo[] linesOfFirstBlock = firstBlock.Children;

                    // Retrieve the fist line from the collection of lines
                    IRecognizedTextPartInfo firstLine = (linesOfFirstBlock[0] as IRecognizedTextPartInfo);

                    // Display the level of line
                    if (firstLine != null)
                    {
                        Console.WriteLine(firstLine.Level);

                        // Retrieve the fist word from the collection of words
                        IRecognizedTextPartInfo firstWord = (firstLine.Children[0] as IRecognizedTextPartInfo);

                        // Display the level of word
                        Console.WriteLine(firstWord.Level);

                        // Retrieve the fist character from the collection of characters
                        IRecognizedTextPartInfo firstCharacter = (firstWord.Children[0] as IRecognizedTextPartInfo);

                        // Display the level of character
                        Console.WriteLine(firstCharacter.Level);
                    }
                }
            }
            // ExEnd:GetTextPartHierarchy
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Process the image
            if (ocrEngine.Process())
            {
                //Display the recognized text
                Console.WriteLine(ocrEngine.Text);
            }
        }
Пример #22
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Process the image
            if (ocrEngine.Process())
            {
                //Display the recognized text
                Console.WriteLine(ocrEngine.Text);
            }
        }
Пример #23
0
 public SensorNode(bool TypeofNode, float range, int num, int speed)
 {
     //
     // TODO: Add constructor logic here
     //
     this.joinStatus      = false;
     this.nodeDead        = false;   //the node is alive
     this.nodeType        = TypeofNode;
     this.simulationSpeed = speed;
     this.children        = 0;
     this.iteration       = 0;
     // the node is in the receiving mode.
     this.nodeNum                          = num;
     this.xmissionRange                    = range;
     this.old_p_mac_x                      = -100;
     this.old_p_mac_y                      = -100;
     this.p_mac_x                          = 40000;
     this.p_mac_y                          = 40000;
     this.MessageCycles                    = 0;
     this.totalBitsTransmitted             = 0;
     this.totalBitsReceived                = 0;
     this.childMacList                     = null;
     this.neighborReceivedXmitted          = false;
     this.receivedApplicationMessages      = null;
     this.receivedApplicationMessagesCount = 0;
     if (TypeofNode == false)
     {
         this.img            = ImageStream.FromFile("unDecidedNode.bmp");
         this.battery        = new NodeBattery(0.5);
         this.hops           = 10000;
         this.nodeState      = 0;
         this.PowerOfThePath = 0;
         this.nodeState      = 0;
     }
     else
     {
         this.img            = ImageStream.FromFile("BaseStation.bmp");
         this.battery        = new NodeBattery(10000);
         this.nodeState      = 1;
         this.hops           = 0;
         this.PowerOfThePath = this.battery.BATTERYPOWER;
         this.nodeState      = 1;
     }
 }
        public static void Run()
        {
            // ExStart:PerformOCROnImage
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Process the image
            if (ocrEngine.Process())
            {
                // Display the recognized text
                Console.WriteLine(ocrEngine.Text);
            }
            // ExEnd:PerformOCROnImage
        }
Пример #25
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //Create an instance of OcrEngine class
            OcrEngine ocr = new OcrEngine();

            //Set the Image property of OcrEngine by reading an image file
            ocr.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Set the RemoveNonText to true
            ocr.Config.RemoveNonText = true;

            //Perform OCR operation
            if (ocr.Process())
            {
                //Display results
                Console.WriteLine(ocr.Text);
            }
        }
Пример #26
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //Create an instance of OcrEngine class
            OcrEngine ocr = new OcrEngine();

            //Set the Image property of OcrEngine by reading an image file
            ocr.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Set the RemoveNonText to true
            ocr.Config.RemoveNonText = true;

            //Perform OCR operation
            if (ocr.Process())
            {
                //Display results
                Console.WriteLine(ocr.Text);
            }
        }
Пример #27
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            //Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            //Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Call the Process method to retrieve the results
            ocrEngine.Process();
        }
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            //Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            //Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Call the Process method to retrieve the results
            ocrEngine.Process();
        }
Пример #29
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);



            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Set the Image property by loading the image from file path location or an instance of MemoryStream
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Process the image
            if (ocrEngine.Process())
            {
                //Retrieve the first block of the recognized text part
                IRecognizedTextPartInfo firstBlock = (ocrEngine.Text.PartsInfo[0] as IRecognizedTextPartInfo);

                //Get the children of the first block that will the the lines in the block
                IRecognizedPartInfo[] linesOfFirstBlock = firstBlock.Children;

                //Retrieve the fist line from the collection of lines
                IRecognizedTextPartInfo firstLine = (linesOfFirstBlock[0] as IRecognizedTextPartInfo);

                //Display the level of line
                Console.WriteLine(firstLine.Level);

                //Retrieve the fist word from the collection of words
                IRecognizedTextPartInfo firstWord = (firstLine.Children[0] as IRecognizedTextPartInfo);

                //Display the level of word
                Console.WriteLine(firstWord.Level);

                //Retrieve the fist character from the collection of characters
                IRecognizedTextPartInfo firstCharacter = (firstWord.Children[0] as IRecognizedTextPartInfo);

                //Display the level of character
                Console.WriteLine(firstCharacter.Level);
            }
        }
Пример #30
0
 public void bitmapUPDater()
 {
     if (this.battery.BATTERYPOWER <= 0)
     {
         this.nodeDead   = true;            //node dead
         this.joinStatus = false;           //node not joint to the network anymore
         this.nodeState  = 0;
     }
     if (this.joinStatus == true && this.nodeType == false)
     {
         this.img = ImageStream.FromFile("DecidedNode.bmp");
     }
     if (this.battery.BATTERYPOWER < 0.05)
     {
         this.img = ImageStream.FromFile("unDecidedNode.bmp");
     }
     if (this.joinStatus == false && this.nodeType == false && this.nodeDead == true)
     {
         this.img = ImageStream.FromFile("BaseStation.bmp");
     }
 }