zxing识别二维码的C++版本,提供OpenCV接口


VS2010,整合官网上面zxing的C++版本和OpenCV,可直接使用OpenCV得Mat进行二维码识别,若遇到显示中文乱码,可尝试将字符编码方式在UTF-8和gb2312之间切换。
资源截图
代码片段和文件信息
/*
 * iconv implementation using Win32 API to convert.
 *
 * This file is placed in the public domain.
 */

/* for WC_NO_BEST_FIT_CHARS */
#ifndef WINVER
# define WINVER 0x0500
#endif

#define STRICT
#include 
#include 
#include 
#include 

/* WORKAROUND: */
#ifndef UNDER_CE
#define GetProcAddressA GetProcAddress
#endif

#if 0
# define MAKE_EXE
# define MAKE_DLL
# define USE_LIBICONV_DLL
#endif

#if !defined(DEFAULT_LIBICONV_DLL)
# define DEFAULT_LIBICONV_DLL ““
#endif

#define MB_CHAR_MAX 16

#define UNICODE_MODE_BOM_DONE   1
#define UNICODE_MODE_SWAPPED    2

#define FLAG_USE_BOM            1
#define FLAG_TRANSLIT           2 /* //TRANSLIT */
#define FLAG_IGNORE             4 /* //IGNORE */

typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;

typedef void* iconv_t;

iconv_t iconv_open(const char *tocode const char *fromcode);
int iconv_close(iconv_t cd);
size_t iconv(iconv_t cd char **inbuf size_t *inbytesleft char **outbuf size_t *outbytesleft);

/* libiconv interface for vim */
#if defined(MAKE_DLL)
int
iconvctl (iconv_t cd int request void* argument)
{
    /* not supported */
    return 0;
}
#endif

typedef struct compat_t compat_t;
typedef struct csconv_t csconv_t;
typedef struct rec_iconv_t rec_iconv_t;

typedef iconv_t (*f_iconv_open)(const char *tocode const char *fromcode);
typedef int (*f_iconv_close)(iconv_t cd);
typedef size_t (*f_iconv)(iconv_t cd char **inbuf size_t *inbytesleft char **outbuf size_t *outbytesleft);
typedef int* (*f_errno)(void);
typedef int (*f_mbtowc)(csconv_t *cv const uchar *buf int bufsize ushort *wbuf int *wbufsize);
typedef int (*f_wctomb)(csconv_t *cv ushort *wbuf int wbufsize uchar *buf int bufsize);
typedef int (*f_mblen)(csconv_t *cv const uchar *buf int bufsize);
typedef int (*f_flush)(csconv_t *cv uchar *buf int bufsize);

#define COMPAT_IN   1
#define COMPAT_OUT  2

/* unicode mapping for compatibility with other conversion table. */
struct compat_t {
    uint in;
    uint out;
    uint flag;
};

struct csconv_t {
    int codepage;
    int flags;
    f_mbtowc mbtowc;
    f_wctomb wctomb;
    f_mblen mblen;
    f_flush flush;
    DWORD mode;
    compat_t *compat;
};

struct rec_iconv_t {
    iconv_t cd;
    f_iconv_close iconv_close;
    f_iconv iconv;
    f_errno _errno;
    csconv_t from;
    csconv_t to;
#if defined(USE_LIBICONV_DLL)
    HMODULE hlibiconv;
#endif
};

static int win_iconv_open(rec_iconv_t *cd const char *tocode const char *fromcode);
static int win_iconv_close(iconv_t cd);
static size_t win_iconv(iconv_t cd char **inbuf size_t *inbytesleft char **outbuf size_t *outbytesleft);

static int load_mlang();
static int make_csconv(const char *name csconv_t *cv);
static int name_to_codepage(const char *name);
static uint utf16_to_ucs4(const ushort *wbuf);
static void ucs4_to_utf16(uint wc ushort *wbuf int *wbufsize);
static int mbtowc_flags(int codepage);
static int must_use_null_usedd

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件   22808440  2015-03-18 15:58  zxing hirdpartylibzxinglib.lib

     文件   23013488  2015-03-20 10:35  zxing hirdpartylibzxinglib_.lib

     文件         68  2015-01-20 04:16  zxing hirdpartyzxingigint.gitignore

     文件      11670  2015-01-20 04:16  zxing hirdpartyzxingigintBigInteger.cc

     文件       6904  2015-01-20 04:16  zxing hirdpartyzxingigintBigInteger.hh

     文件       1830  2015-01-20 04:16  zxing hirdpartyzxingigintBigIntegerAlgorithms.cc

     文件        826  2015-01-20 04:16  zxing hirdpartyzxingigintBigIntegerAlgorithms.hh

     文件        242  2015-01-20 04:16  zxing hirdpartyzxingigintBigIntegerLibrary.hh

     文件       1515  2015-01-20 04:16  zxing hirdpartyzxingigintBigIntegerUtils.cc

     文件       2571  2015-01-20 04:16  zxing hirdpartyzxingigintBigIntegerUtils.hh

     文件      22110  2015-01-20 04:16  zxing hirdpartyzxingigintBigUnsigned.cc

     文件      14754  2015-01-20 04:16  zxing hirdpartyzxingigintBigUnsigned.hh

     文件       4249  2015-01-20 04:16  zxing hirdpartyzxingigintBigUnsignedInAbase.cc

     文件       4120  2015-01-20 04:16  zxing hirdpartyzxingigintBigUnsignedInAbase.hh

     文件       9060  2015-01-20 04:16  zxing hirdpartyzxingigintChangeLog

     文件       2290  2015-01-20 04:16  zxing hirdpartyzxingigintMakefile

     文件       4708  2015-01-20 04:16  zxing hirdpartyzxingigintNumberlikeArray.hh

     文件       3367  2015-01-20 04:16  zxing hirdpartyzxingigintREADME

     文件        358  2015-01-20 04:16  zxing hirdpartyzxingwin32zxingiconv.h

     文件       7728  2015-01-20 04:16  zxing hirdpartyzxingwin32zxingstdint.h

     文件      60636  2015-01-20 04:16  zxing hirdpartyzxingwin32zxingwin_iconv.c

     文件       1619  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecAztecDetectorResult.cpp

     文件       1357  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecAztecDetectorResult.h

     文件       2077  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecAztecReader.cpp

     文件       1314  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecAztecReader.h

     文件      14070  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecdecoderDecoder.cpp

     文件       1834  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecdecoderDecoder.h

     文件      18759  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecdetectorDetector.cpp

     文件       2871  2015-01-20 04:16  zxing hirdpartyzxingzxingaztecdetectorDetector.h

     文件       1072  2015-01-20 04:16  zxing hirdpartyzxingzxingBarcodeFormat.cpp

............此处省略282个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)