Fixed bugs ocr
This commit is contained in:
parent
540b9ca512
commit
6e60a6fea6
@ -20,6 +20,7 @@ public class GenerateCSV {
|
||||
this.etudiants = map;
|
||||
this.numLength = Integer.parseInt(length);
|
||||
this.path = path + "/" + pth;
|
||||
|
||||
}
|
||||
|
||||
// Teste validité du numero etudiant (selon param de la config passé :
|
||||
@ -33,7 +34,9 @@ public class GenerateCSV {
|
||||
|
||||
int nb = Character.getNumericValue(s.charAt(i));
|
||||
|
||||
|
||||
if (nb <= 0 || nb >= 9) {
|
||||
|
||||
logger.fatal("Student id's characters are not recognized");
|
||||
return false;
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ public class ImagesCopie {
|
||||
for(Img s : hMapImgs.values())
|
||||
{
|
||||
s.applyOcrImg();
|
||||
System.out.println("Desc : "+s.getClass().getCanonicalName()+" "+s.getDescription());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,11 @@ public abstract class Img {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public void sanitizeDesc()
|
||||
{
|
||||
this.description = this.description.replace(" ", "");
|
||||
this.description = this.description.replace("\n", "");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public class ImgNote extends Img{
|
||||
public void applyOcrImg() {
|
||||
|
||||
setDescription(OCR.applyOcrNumber(getImg()));
|
||||
this.sanitizeDesc();
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ public class ImgNumEtu extends Img{
|
||||
@Override
|
||||
public void applyOcrImg() {
|
||||
setDescription(OCR.applyOcrNumber(getImg()));
|
||||
this.sanitizeDesc();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -37,12 +37,12 @@ public abstract class Rogneur {
|
||||
int numEtuY2 = ratioY*146 + 310;
|
||||
|
||||
BufferedImage temp = imgOriginale.getSubimage(numEtuX1, numEtuY1, numEtuX2-numEtuX1, numEtuY2-numEtuY1);
|
||||
|
||||
/*
|
||||
JFrame frame = new JFrame();
|
||||
frame.getContentPane().add(new JLabel(new ImageIcon(temp)));
|
||||
//frame.getContentPane().add(new JLabel(new ImageIcon(images.get(0))));
|
||||
frame.setVisible(true);
|
||||
|
||||
*/
|
||||
return new ImgNumEtu(temp);
|
||||
|
||||
}
|
||||
@ -62,11 +62,12 @@ public abstract class Rogneur {
|
||||
|
||||
BufferedImage temp = imgOriginale.getSubimage(numNoteX1, numNoteY1, numNoteX2-numNoteX1, numNoteY2-numNoteY1);
|
||||
|
||||
/*
|
||||
JFrame frame = new JFrame();
|
||||
frame.getContentPane().add(new JLabel(new ImageIcon(temp)));
|
||||
//frame.getContentPane().add(new JLabel(new ImageIcon(images.get(0))));
|
||||
frame.setVisible(true);
|
||||
|
||||
*/
|
||||
return new ImgNote(temp);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user