Fixed bugs ocr

This commit is contained in:
GrossPaul 2019-10-09 08:22:52 +02:00
parent 540b9ca512
commit 6e60a6fea6
6 changed files with 16 additions and 5 deletions

View File

@ -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 {

View File

@ -19,7 +19,7 @@ public class ImagesCopie {
for(Img s : hMapImgs.values())
{
s.applyOcrImg();
System.out.println("Desc : "+s.getClass().getCanonicalName()+" "+s.getDescription());
}
}

View File

@ -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", "");
}
}

View File

@ -16,6 +16,7 @@ public class ImgNote extends Img{
public void applyOcrImg() {
setDescription(OCR.applyOcrNumber(getImg()));
this.sanitizeDesc();
}

View File

@ -13,6 +13,8 @@ public class ImgNumEtu extends Img{
@Override
public void applyOcrImg() {
setDescription(OCR.applyOcrNumber(getImg()));
this.sanitizeDesc();
}
}

View File

@ -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);
}