當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiFormatReader.reset方法代碼示例

本文整理匯總了Java中com.google.zxing.MultiFormatReader.reset方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiFormatReader.reset方法的具體用法?Java MultiFormatReader.reset怎麽用?Java MultiFormatReader.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.zxing.MultiFormatReader的用法示例。


在下文中一共展示了MultiFormatReader.reset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decodeWithZxing

import com.google.zxing.MultiFormatReader; //導入方法依賴的package包/類
public String decodeWithZxing(byte[] data, int width, int height, Rect crop) {
    MultiFormatReader multiFormatReader = new MultiFormatReader();
    multiFormatReader.setHints(changeZXingDecodeDataMode());

    Result rawResult = null;
    PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(data, width, height,
            crop.left, crop.top, crop.width(), crop.height(), false);

    if (source != null) {
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
        try {
            rawResult = multiFormatReader.decodeWithState(bitmap);
        } catch (ReaderException re) {
            // continue
        } finally {
            multiFormatReader.reset();
        }
    }

    return rawResult != null ? rawResult.getText() : null;
}
 
開發者ID:snice,項目名稱:androidscan,代碼行數:22,代碼來源:DecodeUtils.java

示例2: decodeWithZxing

import com.google.zxing.MultiFormatReader; //導入方法依賴的package包/類
public Result decodeWithZxing(Bitmap bitmap) {
    MultiFormatReader multiFormatReader = new MultiFormatReader();
    multiFormatReader.setHints(changeZXingDecodeDataMode());

    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    int[] pixels = new int[width * height];
    bitmap.getPixels(pixels, 0, width, 0, 0, width, height);

    Result rawResult = null;
    RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);

    BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
    try {
        rawResult = multiFormatReader.decodeWithState(binaryBitmap);
    } catch (ReaderException re) {
        // continue
    } finally {
        multiFormatReader.reset();
    }

    return rawResult;
}
 
開發者ID:absentm,項目名稱:myapplication,代碼行數:24,代碼來源:DecodeUtils.java

示例3: doInBackground

import com.google.zxing.MultiFormatReader; //導入方法依賴的package包/類
@Override
protected Result doInBackground(Void... params) {
	BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));
	Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(3);
	hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
	hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, listener);
	MultiFormatReader multiFormatReader = new MultiFormatReader();
	multiFormatReader.setHints(hints);
	long start = System.currentTimeMillis();
	Result rawResult = null;
	try {
		rawResult = multiFormatReader.decodeWithState(bitmap);
		mBitmap = luminanceSource.renderCroppedGreyScaleBitmap();
		long end = System.currentTimeMillis();
		Log.d("DecodeThread", "Decode use " + (end - start) + "ms");
	} catch (ReaderException re) {
	} finally {
		multiFormatReader.reset();
	}
	return rawResult;
}
 
開發者ID:Revival-liangjialiang,項目名稱:ShoppingApp,代碼行數:22,代碼來源:DecodeThread.java

示例4: scanningImage

import com.google.zxing.MultiFormatReader; //導入方法依賴的package包/類
public Result scanningImage(String path) {
    if (TextUtils.isEmpty(path)) {
        return null;
    }
    multiFormatReader = new MultiFormatReader();

    //BufferedImage image =null;
    Hashtable<DecodeHintType, String> hints = new Hashtable<DecodeHintType, String>();
    hints.put(DecodeHintType.CHARACTER_SET, "UTF8");

    multiFormatReader.setHints(hints);

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    Bitmap scanBitmap = BitmapFactory.decodeFile(path, options);
    options.inJustDecodeBounds = false;
    int sampleSize = (int) (options.outHeight / (float) 200);
    if (sampleSize <= 0)
        sampleSize = 1;
    scanBitmap = BitmapFactory.decodeFile(path, options);

    RGBLuminanceSource source = new RGBLuminanceSource(scanBitmap);
    BinaryBitmap bitmap1 = new BinaryBitmap(new HybridBinarizer(source));
    try {
        return multiFormatReader.decodeWithState(bitmap1);
    } catch (ReaderException re) {
        // continue
    } finally {
        multiFormatReader.reset();
    }
    return null;
}
 
開發者ID:g977284333,項目名稱:KwPresent,代碼行數:33,代碼來源:CaptureActivity.java


注:本文中的com.google.zxing.MultiFormatReader.reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。