【问题标题】:where to find the variable that contains captured image data by the camera using zxing android library?在哪里可以找到包含相机使用 zxing android 库捕获的图像数据的变量?
【发布时间】:2015-08-24 10:55:03
【问题描述】:

我想在解码之前获取包含相机在 zxing android 库中捕获的图像数据的变量。 我认为在 DecodeHandler 类中的“解码”函数中传递的 Byte[] 数据变量(YUV 预览帧)是得到我想要的但显然我错了,我的数据之间存在差异正在寻找这个 YUV Preview Frame 数据,我无法理解。 任何人都可以帮助我吗? 谢谢

【问题讨论】:

    标签: android zxing


    【解决方案1】:

    预览数据格式为NV21。用于存储相机数据的变量位于PlanarYUVLuminanceSource.java

    public PlanarYUVLuminanceSource(byte[] yuvData,
                                      int dataWidth,
                                      int dataHeight,
                                      int left,
                                      int top,
                                      int width,
                                      int height,
                                      boolean reverseHorizontal) {
        super(width, height);
    
        if (left + width > dataWidth || top + height > dataHeight) {
          throw new IllegalArgumentException("Crop rectangle does not fit within image data.");
        }
    
        this.yuvData = yuvData;
        this.dataWidth = dataWidth;
        this.dataHeight = dataHeight;
        this.left = left;
        this.top = top;
        if (reverseHorizontal) {
          reverseHorizontal(width, height);
        }
      }
    

    是 yuvData!

    【讨论】:

    • 但是这个 yuvData,与“解码处理程序”类中的“解码”方法中作为参数传递的“数据”不一样:private void decode(byte [] data, int width,整数高度)?
    • 我在ZXing中没有看到DecodeHandler。您可以使用 MultiFormatReader 来解码条形码图像。这里有一个帖子-How to Write and Read QR Code with ZXing in Java,介绍了如何用ZXing读写条码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多