2013-07-31 188 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