diff --git a/carcv-core/src/main/java/org/carcv/impl/core/detect/NumberPlateDetectorImpl.java b/carcv-core/src/main/java/org/carcv/impl/core/detect/NumberPlateDetectorImpl.java index 2baba18..d91fadf 100644 --- a/carcv-core/src/main/java/org/carcv/impl/core/detect/NumberPlateDetectorImpl.java +++ b/carcv-core/src/main/java/org/carcv/impl/core/detect/NumberPlateDetectorImpl.java @@ -28,6 +28,8 @@ import org.carcv.core.detect.NumberPlateDetector; import org.carcv.core.model.AbstractCarImage; import org.carcv.impl.core.util.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; /** @@ -39,6 +41,8 @@ */ public class NumberPlateDetectorImpl extends NumberPlateDetector { + final private static Logger LOGGER = LoggerFactory.getLogger(NumberPlateDetectorImpl.class); + private static NumberPlateDetectorImpl detector; private Intelligence intel; @@ -73,7 +77,12 @@ public String detect(final List images) { public String detectPlateText(final List images) { ArrayList numberPlates = new ArrayList<>(); for (AbstractCarImage image : images) { - numberPlates.add(intel.recognize(new CarSnapshot(image.getImage()))); + String plate = intel.recognize(new CarSnapshot(image.getImage())); + if (plate == null) { + plate = "null"; + LOGGER.warn("Plate on image ID {} wasn't detected, writing null.", image.getId()); + } + numberPlates.add(plate); } return CollectionUtils.highestCountElement(numberPlates); }