Ajout d'un ocr plus agile
This commit is contained in:
parent
228c16c7fe
commit
5b062f11d7
@ -10,6 +10,7 @@ public abstract class ImagesCopie {
|
||||
|
||||
public ImagesCopie(BufferedImage imgOriginale) {
|
||||
|
||||
|
||||
hMapImgs = Rogneur.createHMapImgs(imgOriginale);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package ocr;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import ocr_orm.OCR;
|
||||
|
||||
|
||||
public class ImgNote extends Img{
|
||||
|
||||
@ -13,7 +13,7 @@ public class ImgNote extends Img{
|
||||
|
||||
@Override
|
||||
public void applyOcrImg() {
|
||||
setDescription(OCR.applyOcrNumber(getImg()));;
|
||||
setDescription(OCR.applyOcrNumber(getImg()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package ocr;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import ocr_orm.OCR;
|
||||
|
||||
|
||||
public class ImgNumEtu extends Img{
|
||||
|
||||
@ -12,7 +12,7 @@ public class ImgNumEtu extends Img{
|
||||
|
||||
@Override
|
||||
public void applyOcrImg() {
|
||||
setDescription(OCR.applyOcrNumber(getImg()));;
|
||||
setDescription(OCR.applyOcrNumber(getImg()));
|
||||
}
|
||||
|
||||
}
|
28
NGCC/src/ocr/OCR.java
Normal file
28
NGCC/src/ocr/OCR.java
Normal file
@ -0,0 +1,28 @@
|
||||
package ocr;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
|
||||
import net.sourceforge.tess4j.Tesseract;
|
||||
import net.sourceforge.tess4j.TesseractException;
|
||||
|
||||
public class OCR {
|
||||
|
||||
|
||||
|
||||
public static String applyOcrNumber(BufferedImage img) {
|
||||
//FAIRE L'OCR
|
||||
Tesseract tesseract = new Tesseract();
|
||||
String str="";
|
||||
try {
|
||||
tesseract.setOcrEngineMode(2);
|
||||
tesseract.setTessVariable("tessedit_char_whitelist","0-9");
|
||||
str=tesseract.doOCR(img);
|
||||
} catch (TesseractException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
@ -10,34 +10,28 @@ public class Rogneur {
|
||||
public static Map<String, Img> createHMapImgs(BufferedImage imgOriginale) {
|
||||
|
||||
Map<String,Img> temp = new HashMap<>();
|
||||
temp.put("NumEtu", rogneurFormatNote(BufferedImage imgOriginale));
|
||||
temp.put("Note", rogneurFormatNote(BufferedImage imgOriginale));
|
||||
temp.put("FormatNote", rogneurFormatNote(BufferedImage imgOriginale));
|
||||
temp.put("NumEtu", rogneurFormatNote(imgOriginale));
|
||||
temp.put("Note", rogneurFormatNote(imgOriginale));
|
||||
temp.put("FormatNote", rogneurFormatNote(imgOriginale));
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
// rogne la partie du numEtu
|
||||
public Img rogneurNumEtu(BufferedImage imgOriginale)
|
||||
public static Img rogneurNumEtu(BufferedImage imgOriginale)
|
||||
{
|
||||
|
||||
// A FAIRE
|
||||
//return new ImgNum();
|
||||
return imgOriginale.getSubimage(x, y, w, h);
|
||||
}
|
||||
|
||||
// rogne la partie de la note
|
||||
public Img rogneurNote(BufferedImage imgOriginale)
|
||||
public static Img rogneurNote(BufferedImage imgOriginale)
|
||||
{
|
||||
|
||||
// A FAIRE
|
||||
//return new ImgNum();
|
||||
return imgOriginale.getSubimage(x, y, w, h);
|
||||
}
|
||||
|
||||
// rogne la partie du format de la note
|
||||
public Img rogneurFormatNote(BufferedImage imgOriginale)
|
||||
public static Img rogneurFormatNote(BufferedImage imgOriginale)
|
||||
{
|
||||
|
||||
// A FAIRE
|
||||
//return new ImgNum();
|
||||
return imgOriginale.getSubimage(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
10
NGCC/src/ocr/diag.ucls
Normal file
10
NGCC/src/ocr/diag.ucls
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<class-diagram version="1.2.3" icons="true" always-add-relationships="false" generalizations="true" realizations="true"
|
||||
associations="true" dependencies="false" nesting-relationships="true">
|
||||
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||
</classifier-display>
|
||||
<association-display labels="true" multiplicity="true"/>
|
||||
</class-diagram>
|
Loading…
x
Reference in New Issue
Block a user