diff --git a/NGCC/src/csv/GenerateCSV.java b/NGCC/src/csv/GenerateCSV.java index b3632cd..aebe82c 100644 --- a/NGCC/src/csv/GenerateCSV.java +++ b/NGCC/src/csv/GenerateCSV.java @@ -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 { diff --git a/NGCC/src/ocr/ImagesCopie.java b/NGCC/src/ocr/ImagesCopie.java index 255b65d..112f147 100644 --- a/NGCC/src/ocr/ImagesCopie.java +++ b/NGCC/src/ocr/ImagesCopie.java @@ -19,7 +19,7 @@ public class ImagesCopie { for(Img s : hMapImgs.values()) { s.applyOcrImg(); - System.out.println("Desc : "+s.getClass().getCanonicalName()+" "+s.getDescription()); + } } diff --git a/NGCC/src/ocr/Img.java b/NGCC/src/ocr/Img.java index 3647c45..32ab6db 100644 --- a/NGCC/src/ocr/Img.java +++ b/NGCC/src/ocr/Img.java @@ -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", ""); + } } diff --git a/NGCC/src/ocr/ImgNote.java b/NGCC/src/ocr/ImgNote.java index 119a1ef..e58ae43 100644 --- a/NGCC/src/ocr/ImgNote.java +++ b/NGCC/src/ocr/ImgNote.java @@ -16,6 +16,7 @@ public class ImgNote extends Img{ public void applyOcrImg() { setDescription(OCR.applyOcrNumber(getImg())); + this.sanitizeDesc(); } diff --git a/NGCC/src/ocr/ImgNumEtu.java b/NGCC/src/ocr/ImgNumEtu.java index c32f08a..e53e74b 100644 --- a/NGCC/src/ocr/ImgNumEtu.java +++ b/NGCC/src/ocr/ImgNumEtu.java @@ -13,6 +13,8 @@ public class ImgNumEtu extends Img{ @Override public void applyOcrImg() { setDescription(OCR.applyOcrNumber(getImg())); + this.sanitizeDesc(); + } } \ No newline at end of file diff --git a/NGCC/src/ocr/Rogneur.java b/NGCC/src/ocr/Rogneur.java index 170d20e..a66b208 100644 --- a/NGCC/src/ocr/Rogneur.java +++ b/NGCC/src/ocr/Rogneur.java @@ -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); }