4

I'm having some troubles using the C++ sources from the Zxing project. I downloaded the whole project from https://code.google.com/p/zxing/downloads/list and just took the cpp files (core and cli).

I just want to have a method like that:

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

but I really don't know how to do it (I'm really new to c++ and Zxing project).

I've done research on the web and found http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample which was exactly what I needed.

Unfortunately, the Zxing core has changed and now I have some problems because of ArrayRef

Is there an easy way to decode a byte array (RGB) and return a result string ?

Help would be really appreciated,

4

1 回答 1

4

Problem has been solved by modifying the BufferBitmapSource class example (http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample) according to Zxing library 2.2.

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 Too long to post but can share for those who ask.

test.cpp (main)

...
// Convert the buffer to something that the library understands.
ArrayRef<char> data((char*)buffer, width*height);
Ref<LuminanceSource> source (new BufferBitmapSource(width, height, data));
...
于 2013-08-01T10:06:07.063 回答