我想從使用Aspire OCR的圖像中獲取文本。但我對使用asprise從圖像中提取文本ocr
OCR().recognizeCharacters((RenderedImage) image)
要解決需要com.asprise.util.ocr.OCR
jar文件這一問題得到一個錯誤,但到處都找不到這個罐子。所以請告訴我的網站或鏈接從我可以得到這個罐子或告訴我另一種方式從圖像中獲取文本。
import java.awt.Image;
import java.awt.image.RenderedImage;
import java.net.URL;
import javax.imageio.ImageIO;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import com.asprise.ocr.*;
public class ReadImage {
WebDriver driver;
@Test
public void test(){
Ocr.setUp();
Ocr ocr=new Ocr();
ocr.startEngine("eng", Ocr.SPEED_FASTEST);
String imagePath = "D:\\Img\\PLPServlet.jpg";
driver.get("file:///D:/Img/image.html");
String path = driver.findElement(By.id("img")).getAttribute("src");
URL url = new URL(path);
Image image = ImageIO.read(url);
System.out.println("image 'SRC' is = " +image);
String s = new OCR().recognizeCharacters((RenderedImage) image);
System.out.println("Text From Image : \n"+s);
}
}
谷歌 - > https://asprise.com/royalty-free-library/java-ocr-for-windows-mac-linux-download.html –