123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "stdafx.h"
- #include "OnlineCardIdentifier.h"
- #include <tuple>
- #include <fstream>
- #include <atomic>
- extern std::atomic<int> g_examid_by_qr_code;
- namespace OnLineCard{
- void COnlineCardIdentifier::resetflag()
- {
- g_examid_by_qr_code.store(0);
- }
- COnlineCardIdentifier::COnlineCardIdentifier()
- {
- pageIdentifier = new COnLineCardPageIdentifier;
- }
- COnlineCardIdentifier::~COnlineCardIdentifier()
- {
- delete pageIdentifier; pageIdentifier = nullptr;
- }
- void COnlineCardIdentifier::SetTemplate(PaperTemplate*pT)
- {
- pageIdentifier->SetTemplate(pT);
- }
- void COnlineCardIdentifier::SetQr(bool bUseQr, const std::string&strQr)
- {
- if (pageIdentifier){
- pageIdentifier->SetUseQr(strQr, bUseQr);
- }
- }
- void COnlineCardIdentifier::SetOnlineScanType(int nOnlineScanType)
- {
- if (pageIdentifier)
- pageIdentifier->SetOnlineScanType(nOnlineScanType);
- }
- int COnlineCardIdentifier::Identify(const IplImage* img, void* out_result, int out_size)
- {
- int ret = 0;
- if (pageIdentifier){
- HMODULE module = GetModuleHandle(0);
- char pFileName[MAX_PATH + 2] = { 0 };
- GetModuleFileNameA(module, pFileName, MAX_PATH);
- std::string strPath = pFileName;
- int pos = strPath.find_last_of('\\', strPath.length());
- strPath = strPath.substr(0, pos) + "\\..\\config.ini";
- int nType = GetPrivateProfileIntA("USER", "algorithmflag", 0, strPath.c_str());
- pageIdentifier->m_nXianXiaDaFenType = nType;
- ret = pageIdentifier->Identify(img, out_result, out_size);
- }
- return ret;
- }
- }
|