如何使用Zxing C++解码数据
How to decode data using Zxing C++
我在使用Zxing项目中的C++源代码时遇到了一些问题。我从下载了整个项目https://code.google.com/p/zxing/downloads/list并且只获取了cpp文件(core和cli)。
我只想有一个这样的方法:
decode(byte[] dataToDecode, int widthFrame, int heightFrame)
但我真的不知道该怎么做(我对c++和Zxing项目还很陌生)。
我在网上做了研究,发现http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cpp示例,这正是我所需要的。
不幸的是,Zxing核心已经改变,现在我遇到了一些问题,因为ArrayRef
有没有一种简单的方法来解码字节数组(RGB)并返回结果字符串?
非常感谢您的帮助,
通过修改BufferBitmapSource类示例解决了问题(http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample)根据Zxing库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太长了,无法发布,但可以分享给有要求的人。
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));
...
相关文章:
- 无法解码base64+deflate数据
- 使用已使用 java 编码的 openssl 解码数据
- 在CRC-16 CCITT中将数据从二进制解码为文本,我应该输入一个码字,使用CRC生成器进行编码
- 如何将 MJPEG 解码为原始 RGB(或 YUV)数据
- 将数据包从C++服务器发送到NodeJs服务器时出现MessagePack解码错误
- 解码 c++ 中以 base64 编码的大量数据
- 获取GIF帧数,而无需解码所有数据
- 从串行端口(带整数的字符串)解码数据
- 使用 UDP 协议从 Windows 套接字发送到 Qt 套接字的网络数据包上的结构编码和解码
- 如何预先分配LibavCodec的内存来编写解码的帧数据
- 寻求使用 FFmpeg 在 mp4 容器中 h264 编解码器的视频帧.数据包 pts 始终为 0
- 如何解码非密钥ASN1数据
- 跨平台UTF-8字符文件数据编码/解码
- 当JPEG数据不正确时,libjpeg解码崩溃
- B64在数据不是3的倍数的情况下的编码/解码处理
- 解码像 FAST 这样的数据协议的快速方法是什么,其中数据以字节为单位编码,并将位作为存在标志
- FFMPEG:编码后直接解码数据包
- 如何使用Zxing C++解码数据
- Windows Media Foundation:获取 AAC 解码数据
- 使用C40技术解码数据矩阵