get text from Images

567 views
Skip to first unread message

kalaivani logan

unread,
Aug 5, 2014, 3:03:55 AM8/5/14
to seleniu...@googlegroups.com
Hi friends,

I need to get this below image text into xcel or note pad .how can i get it .I dont wanna to download this image.I need only the text to be copied into xcel or wor or notepad.
for example down like this imagesis there then how to get text.
Thanks and regards ,
L.Kalaivani
16667f732dc45ddc06d23420cd4e7a89-17.jpg

Saran R

unread,
Aug 5, 2014, 4:25:52 AM8/5/14
to seleniu...@googlegroups.com
You need to have Java OCR files for character recognition.
Please visit: http://javaocr.sourceforge.net/

Saran R

unread,
Aug 5, 2014, 4:47:55 AM8/5/14
to seleniu...@googlegroups.com
Asprise OCR - is a free Java OCR Recognition

please find the JAR file in http://www.mythoughts.co.in/2013/10/extract-and-verify-text-from-image.html#.U-CVNrEfeL8

After adding the JAR file, please use the below code for Image to Text recognition.

BufferedImage image = ImageIO.read(new File("Image location"));    
String imageText = new OCR().recognizeCharacters((RenderedImage) image);   
System.out.println("Text From Image : \n"+ imageText);   
System.out.println("Length of total text : \n"+ imageText.length());

kalaivani logan

unread,
Aug 5, 2014, 5:26:25 AM8/5/14
to seleniu...@googlegroups.com
hi  saran
I used osr jar file previously only i am getting error that ocr cannot be resolved.



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f76e829c-9d93-4c83-abff-a0e424c418d1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ripon Al Wasim

unread,
Aug 5, 2014, 5:30:04 AM8/5/14
to seleniu...@googlegroups.com

kalaivani logan

unread,
Aug 5, 2014, 6:43:22 AM8/5/14
to seleniu...@googlegroups.com
hi ,
i configured aspireocr jar file to my workspace .But i am getting error like this  and my code is below .

package com.kalai;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.asprise.util.ocr.OCR;



public class ImageRead {
   
    WebDriver driver; 
      
   
     @Test 
     public void start() throws IOException{ 
        
         BufferedImage image = ImageIO.read(new File("C:\\Users\\user\\Desktop\\kalai1.jpg"));   
         String imageText = new OCR().recognizeCharacters((RenderedImage) image);  
         System.out.println("Text From Image : \n"+ imageText);  
         System.out.println("Length of total text : \n"+ imageText.length());


    } 
   

}





Error:



[TestNG] Running:
  C:\Users\user\AppData\Local\Temp\testng-eclipse-1549828454\testng-customsuite.xml

FAILED: start
java.lang.UnsatisfiedLinkError: no AspriseOCR in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.asprise.util.ocr.OCR.loadLibrary(OCR.java:247)
    at com.asprise.util.ocr.OCR.<init>(OCR.java:56)
    at com.kalai.ImageRead.start(ImageRead.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.XMLReporter@103f852: 143 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@8b970c: 32 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@16b4233: 164 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@1f924f5: 469 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 56 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@22d9d: 25 ms










kalaivani logan

unread,
Aug 6, 2014, 1:44:12 AM8/6/14
to seleniu...@googlegroups.com
hi ,
Anyone there please reply me..:(

buyi wen

unread,
Nov 11, 2015, 1:04:26 AM11/11/15
to Selenium Users
I have no idea about how to extract text from image in code, there are many free ocr tools can do this. i use this online tool to extract text from image.
Reply all
Reply to author
Forward
0 new messages