123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #pragma once
- #include "scan_common.h"
- #include "..\Schema\schema_struct.h"
- #include <opencv2\opencv.hpp>
- #include "..\Identifier\schema_struct.h"
- #include "TestWorker.h"
- #include "..\Identifier\PageMatcher.h"
- #include <boost\smart_ptr.hpp>
- class CTestMatchTask:public CBaseTask{
- public:
- CTestMatchTask(){
- }
- CTestMatchTask(const cv::Mat& img, identify::CPageMatcher * matcher,int schama_index,int rotation){
- img_t =img;
- this->img =&img_t;
- this->matcher =matcher;
- this->schama_index =schama_index;
- this->rotation =rotation;
- }
- ~CTestMatchTask(){}
- virtual void run(){
- matcher->Identifi(img,schama_index,rotation,result);
- }
- public:
- identify::CPageMatcher * matcher ;
- const IplImage * img;
- IplImage img_t;
- int schama_index ;
- int rotation ;
- MATCH_REUSLT result;
- };
- class CLocateTester:private IService
- {
- private:
- enum{
- WORKER_COUNT=1,
- };
- public:
- CLocateTester(void);
- ~CLocateTester(void);
- public:
- bool isReady();
- bool isSameLocateSchema(const schema::SCHEMA& schema);
- bool test(const schema::SCHEMA& schema,const std::vector<std::string>& img_paths);
- bool isResultOk(){return m_isResultOk;}
- bool getTestResult(std::string& error_msg){error_msg = m_error_msg;return m_isOk;}
- protected:
- virtual ServiceState OnRunning( void );
- virtual ServiceState OnStarting( void );
- private:
- void loadSchema(const schema::SCHEMA& schema,const std::vector<std::string>& img_paths,std::vector<ISCH_SCHEMA_PAGE>& _schema);
- void SetPageDefault(ISCH_SCHEMA_PAGE& page);
- virtual ServiceState OnStoping( void );
- //std::vector<SchemaPage> _schema;
- boost::shared_ptr<ISCH_Schema> _schema;
- CTestWorker m_worker[WORKER_COUNT];
- identify::CPageMatcher matcher[WORKER_COUNT];
- std::vector<CTestMatchTask> m_matchtask;
- //std::vector<IplImage * > imgs;
- std::vector<cv::Mat> imgs;
- //测试器是否准备就绪
- bool m_isReady;
- //上一层测试模板
- schema::SCHEMA last_test_schema;
- //测试结果
- bool m_isOk;
- //测试结果字符串
- std::string m_error_msg;
- //标记结果是否已经检测出来了,是否有效
- bool m_isResultOk;
- };
|