• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ratthapon/thai-license-plate-recognition: A Thai license plate localization and ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ratthapon/thai-license-plate-recognition

开源软件地址(OpenSource Url):

https://github.com/ratthapon/thai-license-plate-recognition

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Thai License Plate Recognition Project

Introduction

Thai License Plate Recognition คือโปรแกรมสำหรับรู้จำแผ่นป้ายทะเบียนภาษาไทยจากรูปภาพหรือภาพเคลื่อนไหว ในโครงการฝึกงาน True Academy Project

โปรแกรมนี้ใช้ library ในการทำ Image processing ด้วย OpenCV version 2.4.8

Runnable JAR

  • ThaiLPR.rar x64 (สำหรับ x86 ให้ copy file opencv/x86/opencv_java248.dll วางไว้ที่ root folder แทน)

Download

Sample Code

1.train ฐานข้อมูลตัวอักษรสำหรับรู้จำ

package samplecode;

import ocr.text.trainer.Trainer;

public class SampleTrainer {

	public static void main(String[] args) {
		Trainer.train("trainFileNameList.txt", "trainLabelList.txt", "outputModel.bin");

	}

}

2.การรู้จำตัวอักษร

package samplecode;

import java.util.ArrayList;
import java.util.List;

import ocr.text.recognition.OCR;

import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;

public class SampleOCR {

	public static void main(String[] args) {
		System.loadLibrary("opencv_java248");
		List<Mat> charImageMatList = new ArrayList<>();
		Mat charImageMat = Highgui.imread("testChar.bmp");
		charImageMatList.add(charImageMat);
		OCR.setModelPath("testmodel.bin");
		int[] asciiCodes ;
		asciiCodes = OCR.recognizeCharImage(charImageMatList);
		System.out.print("Result ascii code ");
		for (int i = 0; i < asciiCodes.length; i++) {
			System.out.print(asciiCodes[i]+",");
		}
		
	}

}

3.การอ่านป้ายทะเบียน

package samplecode;

import java.util.ArrayList;
import java.util.List;

import ocr.text.recognition.OCR;
import ocr.text.segmentation.TextSegment;

import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;

import plate.detection.Band;
import plate.detection.Car;
import plate.detection.Plate;

public class SampleDetectPlate {

	public static void main(String[] args) {
		System.loadLibrary("opencv_java248");
		Car car = new Car(Highgui.imread("testCarImage.jpg"));

		// method 1
		List<String> resultList = car.readPlate();
		for (String string : resultList) {
			System.out.println("Result " + string); // result is up to model
		}

		// method 2
		List<Band> bands = new ArrayList<Band>();
		bands = car.clipBands(1); // up to row you want to analyze
		List<Plate> plates = new ArrayList<Plate>();
		for (Band band : bands) {
			plates.addAll(band.clipPlates2(car.toMat()));
		}
		for (Plate plate : plates) {
			List<Mat> charImageMatList = TextSegment
					.getListMatOfCharImage(plate.toMat());
			int[] resultAsciiCode = OCR.recognizeCharImage(charImageMatList);
			System.out.println("\n\rResult ");
			for (int i = 0; i < resultAsciiCode.length; i++) {
				int c = resultAsciiCode[i];
				if (resultAsciiCode[i] >= 161) {
					c = 0x0e00 + (resultAsciiCode[i] - 160); // Thai char
				}
				System.out.print(String.format("%c", c));
			}
		}

		// method 3
		plates = car.clipPlates(1);
		for (Plate plate : plates) {
			List<Mat> charImageMatList = TextSegment
					.getListMatOfCharImage(plate.toMat());
			if (charImageMatList == null || charImageMatList.size() <= 0) {
				break;
			}
			int[] resultAsciiCode = OCR.recognizeCharImage(charImageMatList);
			System.out.println("\n\rResult ");
			for (int i = 0; i < resultAsciiCode.length; i++) {
				int c = resultAsciiCode[i];
				if (resultAsciiCode[i] >= 161) {
					c = 0x0e00 + (resultAsciiCode[i] - 160); // Thai char
				}
				System.out.print(String.format("%c", c));
			}
		}
	}

}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap