Search code examples
c#.netimage-processingocr

OCR : C#/.net for Extract URL from Image


Can any one help me to extract only URL from image when doing images processing OCR.

I checked, all OCR dll are in paid version. Is there any free libraries.


Solution

  • I used IronOCR and problem solve. I created GetText Function which fetch URL from text when image converted to text.

     IronTesseract IronOcr = new IronTesseract();
                var Result = IronOcr.Read(Path.GetTempPath() +  "image.png");
                string _url = GetText(Result.Text);
    
    
     private string GetText(string myString)
        {
           Match url = Regex.Match(myString, @"[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@%_\+.~#?&//=]*)");
            return url.ToString();
        }