From a7223aa99b70c0b629c7fb84f93faea59f257612 Mon Sep 17 00:00:00 2001 From: Louis Calas Date: Thu, 10 Oct 2019 11:52:53 +0200 Subject: [PATCH] Update recadrage --- NGCC/src/lecturePdf/Recadrage.java | 20 +++++++++++++------- NGCC/src/ocr/PdfToImage.java | 8 +++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/NGCC/src/lecturePdf/Recadrage.java b/NGCC/src/lecturePdf/Recadrage.java index dd0c538..5647497 100644 --- a/NGCC/src/lecturePdf/Recadrage.java +++ b/NGCC/src/lecturePdf/Recadrage.java @@ -83,14 +83,20 @@ public class Recadrage { - public BufferedImage[] listAutomation(BufferedImage[] list){ - BufferedImage[] retour=new BufferedImage[list.length]; - int i=0; - for (BufferedImage imag:list) + public ArrayList listAutomation(ArrayListlist){ + ArrayList retour =new ArrayList(); + + for (BufferedImage imag:list) { this.img=imag; - this.automation(); - retour[i]=this.img; - i++; + try { + this.automation(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + retour.add(this.img); + } + return retour; } diff --git a/NGCC/src/ocr/PdfToImage.java b/NGCC/src/ocr/PdfToImage.java index 7681fa0..f95acea 100644 --- a/NGCC/src/ocr/PdfToImage.java +++ b/NGCC/src/ocr/PdfToImage.java @@ -17,6 +17,8 @@ import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.rendering.ImageType; import org.apache.pdfbox.rendering.PDFRenderer; +import lecturePdf.Recadrage; + public class PdfToImage { public List listAllFiles(String directory, String extension) { @@ -31,6 +33,7 @@ public class PdfToImage { return files; } + public BufferedImage blackWhiteConvert(BufferedImage image) { // Convertit une image en image en noir et blanc // TODO : voir recursivite @@ -86,7 +89,10 @@ public class PdfToImage { } catch (IOException ioe) { ioe.printStackTrace(); } - return images; + Recadrage recadrage=new Recadrage(); + return recadrage.listAutomation(images); + //return images; + } public void saveOnDisk(List images, String originalFileDir) {