当前位置: 首页>>代码示例>>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;未经允许,请勿转载。