ocr_pubfuncs.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "StdAfx.h"
  2. #include "ocr_pubfuncs.h"
  3. BOOL OcrFindMatchs(Ocr_Dict &Dict, OcrScreen &fullPic, RECT &area, OCRCOLOR color, ULONG sim, string OUT &str)
  4. {
  5. return Dict.OcrFindMatchs(fullPic,area,color,sim,str);
  6. }
  7. BOOL FindMatchPoint(Ocr_Dict &Dict, OcrScreen &fullPic, RECT &area, OCRCOLOR color, ULONG sim, string IN &str,ULONG &x,ULONG &y )
  8. {
  9. return Dict.FindMatchPoint(fullPic,area,color,sim,str,x,y);
  10. }
  11. BOOL for_Example()
  12. {
  13. RECT area;
  14. area.left = 1000;
  15. area.top = 240;
  16. area.right = 1140;//GetSystemMetrics(SM_CXSCREEN) - 1;
  17. area.bottom = 264;//GetSystemMetrics(SM_CYSCREEN) - 1;
  18. Ocr_Dict dict;
  19. Ocr_Dict dict_word;
  20. ULONG X,Y;
  21. dict_word.LoadOcrDictFromDirectory("c:\\dict\\word");
  22. dict.LoadOcrDictFromDirectory("c:\\dict\\test");
  23. DWORD time = GetTickCount();
  24. SIZE size;
  25. size.cx = GetSystemMetrics(SM_CXSCREEN);
  26. size.cy = GetSystemMetrics(SM_CYSCREEN);
  27. OcrScreen screen(size);
  28. //string outStr;
  29. //if(OcrFindMatchs(dict,screen,area,RGB(0,0,0),100,outStr) == TRUE)
  30. //{
  31. // _tprintf(_T("OK:%S\n"),outStr);
  32. //}
  33. //do capture to screen
  34. if (FindMatchPoint(dict, screen, area, RGB(0, 0, 0), 100, string("line"), X, Y) == TRUE)
  35. //if(FindMatchPoint(dict,screen,area,RGB(11,11,11),100,CString(L"line"),X,Y) == TRUE)
  36. {
  37. //_tprintf(_T("OK:%d,%d\n"),X,Y);
  38. //hited
  39. }
  40. return TRUE;
  41. }