【问题标题】:How to decode data using Zxing C++如何使用 Zxing C++ 解码数据
【发布时间】:2013-07-31 14:47:45
【问题描述】:

我在使用 Zxing 项目的 C++ 源代码时遇到了一些问题。 我从https://code.google.com/p/zxing/downloads/list 下载了整个项目,然后只获取了 cpp 文件(核心和 cli)。

我只是想要一个这样的方法:

decode(byte[] dataToDecode, int widthFrame, int heightFrame)

但我真的不知道该怎么做(我真的是 c++ 和 Zxing 项目的新手)。

我在网络上进行了研究,发现 http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample 正是我所需要的。

不幸的是,Zxing 内核发生了变化,现在由于 ArrayRef

我遇到了一些问题

有没有简单的方法来解码字节数组 (RGB) 并返回结果字符串?

非常感谢您的帮助,

【问题讨论】:

    标签: android c++ qr-code zxing


    【解决方案1】:

    问题已根据Zxing library 2.2修改BufferBitmapSource类示例(http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample)解决。

    BufferBitmapSource.hpp:

    #include <zxing/LuminanceSource.h>
    #include <stdio.h>
    #include <stdlib.h>
    using namespace zxing; 
    namespace qrviddec {
    
    class BufferBitmapSource : public LuminanceSource {
    private:
      ArrayRef<char>* buffer;
    
    public:
      BufferBitmapSource(int inWidth, int inHeight, ArrayRef<char> buffer);
      ~BufferBitmapSource(); 
    
      ArrayRef<char> getRow(int y, ArrayRef<char> row) const;
      ArrayRef<char> getMatrix() const;
    }; 
    }
    

    BufferBitmapSource.cpp 发帖时间过长,但可以分享给有需要的人。

    test.cpp(主)

    ...
    // Convert the buffer to something that the library understands.
    ArrayRef<char> data((char*)buffer, width*height);
    Ref<LuminanceSource> source (new BufferBitmapSource(width, height, data));
    ...
    

    【讨论】:

    • 嘿@hico 我对那个 BufferBitmapSource.cpp 文件很感兴趣。你能发给我吗?谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 2012-06-19
    • 2011-01-30
    相关资源
    最近更新 更多