eyemBarCode.h 2.2 KB
#pragma once
//
//	eyemBarCode·标头
//
#ifndef __EYEM_BARCODE_H
#define __EYEM_BARCODE_H

#include "eyemLib.h"
#include "dmtx.h"
#include <zxing/common/Counted.h>
#include <zxing/Binarizer.h>
#include <zxing/MultiFormatReader.h>
#include <zxing/Result.h>
#include <zxing/ReaderException.h>
#include <zxing/common/GlobalHistogramBinarizer.h>
#include <zxing/common/HybridBinarizer.h>
#include <zxing/Exception.h>
#include <zxing/common/IllegalArgumentException.h>
#include <zxing/BinaryBitmap.h>
#include <zxing/DecodeHints.h>
#include <zxing/qrcode/QRCodeReader.h>
#include <zxing/MultiFormatReader.h>
#include <zxing/MatSource.h>
#include <zxing\oned\MultiFormatOneDReader.h>
#include <zxing\datamatrix\DataMatrixReader.h>
#include <zxing\aztec\AztecReader.h>
#include <mutex>
#include <numeric>
#include <omp.h>

using namespace zxing;
using namespace zxing::qrcode;

std::mutex mtx;

enum {
	NONE,
	AZTEC,
	CODABAR,
	CODE_39,
	CODE_93,
	CODE_128,
	DATA_MATRIX,
	EAN_8,
	EAN_13,
	ITF,
	MAXICODE,
	PDF_417,
	QR_CODE,
	RSS_14,
	RSS_EXPANDED,
	UPC_A,
	UPC_E,
	UPC_EAN_EXTENSION
};

#define enumtoCharArr(val) #val


//
struct tMap
{
	int Label;
	cv::Point Pt;
	tMap(int Label, cv::Point Pt) :Label(Label), Pt(Pt) {}
};

//预处理区域
struct WaitArea
{
	double C;
	double angle;
	bool oneD = false;
	std::vector<cv::Mat> oneDMats;
	cv::Mat waitArea;
	cv::Point Pt;
	WaitArea(cv::Mat waitArea, cv::Point Pt, double C, double angle, bool oneD, std::vector<cv::Mat> oneDMats) :waitArea(waitArea), Pt(Pt), C(C), angle(angle), oneD(oneD), oneDMats(oneDMats) {}
};

//解码结果
struct DecodeResult
{
	double dAngle;
	cv::Point ptResult;
	std::string strResultText;
	std::string strResultType;
	//构造函数
	DecodeResult() {};
	DecodeResult(double dAngle, cv::Point ptResult, std::string strResultText, std::string strResultType) :dAngle(dAngle), ptResult(ptResult), strResultText(strResultText), strResultType(strResultType) {}
	//重载>运算符
	bool operator >(const DecodeResult &te)const
	{
		return (*this).strResultText > te.strResultText;
	}
	//重载==运算符
	bool operator ==(const DecodeResult &te)const
	{
		return strcmp((*this).strResultText.c_str(), te.strResultText.c_str()) == 0;
	}
};


#endif/* __EYEM_BARCODE_H */