Search in sources :

Example 11 with FinderPatternInfo

use of com.google.zxing.qrcode.detector.FinderPatternInfo in project android-zxing by PearceXu.

the class MultiDetector method detectMulti.

public DetectorResult[] detectMulti(Map<DecodeHintType, ?> hints) throws NotFoundException {
    BitMatrix image = getImage();
    ResultPointCallback resultPointCallback = hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
    MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
    FinderPatternInfo[] infos = finder.findMulti(hints);
    if (infos.length == 0) {
        throw NotFoundException.getNotFoundInstance();
    }
    List<DetectorResult> result = new ArrayList<>();
    for (FinderPatternInfo info : infos) {
        try {
            result.add(processFinderPatternInfo(info));
        } catch (ReaderException e) {
        // ignore
        }
    }
    if (result.isEmpty()) {
        return EMPTY_DETECTOR_RESULTS;
    } else {
        return result.toArray(new DetectorResult[result.size()]);
    }
}
Also used : ResultPointCallback(com.google.zxing.ResultPointCallback) ArrayList(java.util.ArrayList) DetectorResult(com.google.zxing.common.DetectorResult) BitMatrix(com.google.zxing.common.BitMatrix) FinderPatternInfo(com.google.zxing.qrcode.detector.FinderPatternInfo) ReaderException(com.google.zxing.ReaderException)

Example 12 with FinderPatternInfo

use of com.google.zxing.qrcode.detector.FinderPatternInfo in project incubator-weex by apache.

the class MultiDetector method detectMulti.

public DetectorResult[] detectMulti(Map<DecodeHintType, ?> hints) throws NotFoundException {
    BitMatrix image = getImage();
    ResultPointCallback resultPointCallback = hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
    MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
    FinderPatternInfo[] infos = finder.findMulti(hints);
    if (infos.length == 0) {
        throw NotFoundException.getNotFoundInstance();
    }
    List<DetectorResult> result = new ArrayList<>();
    for (FinderPatternInfo info : infos) {
        try {
            result.add(processFinderPatternInfo(info));
        } catch (ReaderException e) {
        // ignore
        }
    }
    if (result.isEmpty()) {
        return EMPTY_DETECTOR_RESULTS;
    } else {
        return result.toArray(new DetectorResult[result.size()]);
    }
}
Also used : ResultPointCallback(com.google.zxing.ResultPointCallback) ArrayList(java.util.ArrayList) DetectorResult(com.google.zxing.common.DetectorResult) BitMatrix(com.google.zxing.common.BitMatrix) FinderPatternInfo(com.google.zxing.qrcode.detector.FinderPatternInfo) ReaderException(com.google.zxing.ReaderException)

Aggregations

FinderPatternInfo (com.google.zxing.qrcode.detector.FinderPatternInfo)12 ArrayList (java.util.ArrayList)12 ResultPoint (com.google.zxing.ResultPoint)8 BitMatrix (com.google.zxing.common.BitMatrix)8 FinderPattern (com.google.zxing.qrcode.detector.FinderPattern)8 ReaderException (com.google.zxing.ReaderException)4 ResultPointCallback (com.google.zxing.ResultPointCallback)4 DetectorResult (com.google.zxing.common.DetectorResult)4