Viết ứng dụng đơn giản Tesseract OCR bằng Java

Post Reply
khanhlv
Posts: 4
Joined: Tue Apr 16, 2019 4:25 pm

Viết ứng dụng đơn giản Tesseract OCR bằng Java

Post by khanhlv »

Tuy cái này cũ lắm rồi, công nghệ cũng chẳng có gì mời, nhưng đôi khi vẫn có thể sử dụng cho những bài toán đơn giản ví dụ tác thông tin chứng mình thư, số công tơ điện, công tơ ước ….

Hãy cùng xem một ví dụ rất đơn giản về OCR được triển khai trong Java.

Bước 1: Download tessdata[eng.traineddata]

Bước 2: Lấy hình ảnh muốn bóc tách lấy chữ
Image

Bước 3: Thêm dependency vào tệp pom.xml

Code: Select all

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
	<artifactId>tess4j</artifactId>
	<version>3.2.1</version>
</dependency>
Bước 4: Viết đoạn mã thực hiện OCR

Code: Select all

package tess.test.TestTesseract;

import java.io.File;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

public class Test {
 public static void main(String []args) {
	 Tesseract tesseract = new Tesseract();
	 try {
		tesseract.setDatapath("D:/DataScienceCollection/Jars/tessdata");
		String text = tesseract.doOCR(new File("D:/DataScienceCollection/Images/digit.jpg"));		
		System.out.print(text);
	 } catch (TesseractException e) {		
		e.printStackTrace();
	}
 }
}
Bước 5: Chạy thôi nào

P/S: Bạn có thể dùng Google Vision API để bóc tách, dữ liệu sẽ trả về dạng REST JSON.

Tham khảo:
https://codethoi.com/posts/ung-dung-don ... bang-java/

Hamptonol
Posts: 3
Joined: Tue Sep 03, 2019 4:11 am

finance graduate schemes

Post by Hamptonol »

movie rental
ремонт квартир цены по видам работ https://pinterest.com/1realestate6
Ways to improve credit score – Video
<p>#How #to #Improve #your #Credit #Score #by #100 #points #in #30 #days Ways to improve credit score How to improve your credit score by 100 points in 30 days BY Randall Yates If you search for ways to improve your credit score online you’ll see the same suggestions over and over. If you have bad credit, you can increase your FICO score significantly in just 30 days. Because I’ve not only done it myself for my credit. I have personally helped hundreds of homebuyers raise their scores so they could get approved for a mortgage. And I did it in ...</p>
<p>The post Ways to improve credit score – Video appeared first on Invest.</p> http://nef6.com/ https://twitter.com/kakvsegdagogol http://forum.remmont.com
fashion nova coupon - cronos stock
https://facebook.com/groups/120991959141865/ New Mexico News
Details: Hotel News Fresh News.

IZRAELol
Posts: 18
Joined: Sat Jul 27, 2019 7:42 pm

second hand cars in kochi

Post by IZRAELol »

cottage rentals
косметический ремонт комнаты https://pinterest.com/1realestate6
Internet marketing for insurance agents ) Video
<p>#Insurance #Agency #SEO #Services #Company #- #View #Proven #Results Internet marketing for insurance agents Insurance Agency SEO – Internet Marketing with Proven Results. Insurance SEO Company – Services with Proven Results. No Risk SEO is likely your best fit if you are looking for insurance agency SEO company. Pretty bold claim, huh? Our President, Jason […]</p>
<p>The post Internet marketing for insurance agents ) Video appeared first on South Africa Finance.</p> http://nef6.com/ https://twitter.com/kakvsegdagogol http://forum.nef6.com
dennys coupon - dow jones stock
https://facebook.com/groups/829862874128624/ Kansas News
Analytics: Connecticut Business Fresh News.

htbgshild
Posts: 17
Joined: Fri Feb 14, 2020 11:51 am

sglojoltreglsjdsBydayvu

Post by htbgshild »

help me write a thesis thesis writing services help with a thesis statement <a href="http://thesissgj.com/#">thesis topic</a> writing a phd thesis
good thesis statements thesis services help thesis <a href="http://thesissgj.com/#">thesis consultant</a> phd thesis database

Nebraskaol
Posts: 10
Joined: Mon Aug 12, 2019 2:30 am

silver proof coins

Post by Nebraskaol »

lamborghini rental
ремонт ванных комнат https://pinterest.com/aa3ghdd
Affordable healthcare insurance & Video
<p>#Affordable #healthcare #insurance Affordable healthcare insurance Shopping for Health Insurance? We can help you with that! How’s a great plan that’s affordable sound to you? Our Mission Is to Help Americans Find Affordable Health Insurance Finding a great health insurance policy you can afford shouldn’t be so complicated! You could easily spend hours hunting for […]</p>
<p>The post Affordable healthcare insurance & Video appeared first on Finance News.</p> http://nef6.com/ https://twitter.com/thetarakan http://forum.remmont.com
overstock furniture - dow jones live
https://facebook.com/groups/2749499575133077/ California News
Facts: Wyoming Business Advanced News.

Lincolnol
Posts: 5
Joined: Fri Sep 13, 2019 7:53 am
Location: USA
Contact:

credit one financial

Post by Lincolnol »

tent rental
ремонт домов и квартир https://pinterest.com/aas33de
What is a good credit score \ Video
<p>#What #is #a #Good #Credit #Score: #2018 #Range #- #Chart What is a good credit score What is a Good Credit Score: 2018 Range & Chart What is a Good Credit Score: 2018 Range & Chart So you’re in the market for a major purchase in your life, you need to rent an apartment, or […]</p>
<p>The post What is a good credit score \ Video appeared first on Arlington Finance.</p> http://nef2.com/ https://twitter.com/DeminCSKA http://forum.remmont.com
hobby lobby coupon - cvs stock
https://facebook.com/groups/176764856904430/ Maine News
Details: Ghana Finance Daily News.

Post Reply