2013-07-31 242 views
4

我有一些麻烦使用Zxing项目的C++源。 我从https://code.google.com/p/zxing/downloads/list下载了整个项目,只是拿到了cpp文件(核心和cli)。如何解码数据使用Zxing C++

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

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

,但我真的不知道该怎么做(我真的很新的C++和斑马线项目)。

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

不幸的是,斑马线的核心已经改变,现在我有因为数组引用

一些问题有一种简单的方法来解码字节数组(RGB),并返回结果字符串?

帮助将是非常理解的,

回答

4

问题已通过修改根据斑马线库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)); 
... 
+0

嘿@hico我感兴趣的是** ** BufferBitmapSource.cpp文件。你能把它发给我吗?谢谢! – makeMonday