Skip to content

Commit

Permalink
Merge fcf3a4b into d8e3d1a
Browse files Browse the repository at this point in the history
  • Loading branch information
oskopek committed Sep 9, 2014
2 parents d8e3d1a + fcf3a4b commit fb3b7bd
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

Expand Down Expand Up @@ -73,7 +77,12 @@ public String detect(final List<? extends AbstractCarImage> images) {
public String detectPlateText(final List<? extends AbstractCarImage> images) {
ArrayList<String> 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);
}
Expand Down

0 comments on commit fb3b7bd

Please sign in to comment.