在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(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 ProjectIntroductionThai License Plate Recognition คือโปรแกรมสำหรับรู้จำแผ่นป้ายทะเบียนภาษาไทยจากรูปภาพหรือภาพเคลื่อนไหว ในโครงการฝึกงาน True Academy Project โปรแกรมนี้ใช้ library ในการทำ Image processing ด้วย OpenCV version 2.4.8 Runnable JAR
DownloadSample Code1.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));
}
}
}
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论