| | |
| | | cv::Mat img= ImgUtil::grayImage(capture(tradeQueueFrames[i])); |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\trade_queue\\"; |
| | | path.append(to_string(i)).append(".jpg"); |
| | | cv::imwrite(path,img); |
| | | //cv::imwrite(path,img); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | HWND CaptureUtil::getHWND(int index) { |
| | | return level2Frames[index]; |
| | | HWND CaptureUtil::getHWND(int index, CaptureContentType type) { |
| | | if (type == CAPTURE_TYPE_L2) |
| | | return level2Frames[index]; |
| | | else |
| | | return tradeQueueFrames[index]; |
| | | } |
| | | |
| | | cv::Mat CaptureUtil::capture(int index) { |
| | | cv::Mat cap = capture(getHWND(index)); |
| | | cv::Mat CaptureUtil::capture(int index, CaptureContentType type) { |
| | | cv::Mat cap = capture(getHWND(index, type)); |
| | | return cap; |
| | | } |
| | | |
| | |
| | | #include <string> |
| | | #include "ImgUtil.h" |
| | | using namespace std; |
| | | enum CaptureContentType { |
| | | CAPTURE_TYPE_L2, |
| | | CAPTURE_TYPE_TRADE_QUEUE |
| | | }; |
| | | struct FrameInfo |
| | | { |
| | | HWND frame; |
| | |
| | | static HWND level2Frames[8]; |
| | | static HWND tradeQueueFrames[8]; |
| | | static BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam); |
| | | static HWND getHWND(int index); |
| | | |
| | | |
| | | public: |
| | | //初始化 |
| | | static void init(HWND l2win); |
| | | |
| | | static HWND getHWND(int index, CaptureContentType type); |
| | | |
| | | //截图 |
| | | static cv::Mat capture(int index); |
| | | static cv::Mat capture(int index, CaptureContentType type); |
| | | |
| | | |
| | | static cv::Mat capture(HWND frame); |
| | |
| | | </ItemDefinitionGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="CaptureUtil.cpp" /> |
| | | <ClCompile Include="IndustryCapture.cpp" /> |
| | | <ClCompile Include="LimitUpCapture.cpp" /> |
| | | <ClCompile Include="main.cpp" /> |
| | | <ClCompile Include="ImgDivider.cpp" /> |
| | |
| | | <ClInclude Include="error.h" /> |
| | | <ClInclude Include="ImgDivider.h" /> |
| | | <ClInclude Include="ImgUtil.h" /> |
| | | <ClInclude Include="IndustryCapture.h" /> |
| | | <ClInclude Include="LimitUpCapture.h" /> |
| | | <ClInclude Include="LogUtil.h" /> |
| | | <ClInclude Include="OpenCLExcuter.h" /> |
| | |
| | | <ClCompile Include="TradeQueueCapture.cpp"> |
| | | <Filter>源文件</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="IndustryCapture.cpp"> |
| | | <Filter>源文件</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="resource.h"> |
| | |
| | | <ClInclude Include="TradeQueueCapture.h"> |
| | | <Filter>头文件</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="IndustryCapture.h"> |
| | | <Filter>头文件</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="ConsoleApplication.rc"> |
New file |
| | |
| | | #include "IndustryCapture.h" |
| | | #include "THSActionUtil.h" |
| | | #include <set> |
| | | #include "Win32Util.h" |
| | | OpenCLExcuter* IndustryCapture::openCLExcuter; |
| | | bool IndustryCapture::inited; |
| | | |
| | | HWND IndustryCapture::win; |
| | | |
| | | |
| | | |
| | | |
| | | RecognitionManager* IndustryCapture::recognitionManager; |
| | | |
| | | |
| | | |
| | | cv::Mat IndustryCapture::grayImgs(cv::Mat oimg) { |
| | | cv::Mat grayImg = cv::Mat::zeros(oimg.rows, oimg.cols, CV_8UC1);//ImgUtil::grayImage(oimg); |
| | | |
| | | uchar* imgData = (uchar*)malloc(sizeof(uchar) * oimg.rows * oimg.cols); |
| | | if (oimg.channels() == 3) |
| | | { |
| | | openCLExcuter->rgb2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | else { |
| | | openCLExcuter->rgba2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | grayImg.data = imgData; |
| | | |
| | | return grayImg; |
| | | } |
| | | |
| | | |
| | | |
| | | void IndustryCapture::init() { |
| | | recognitionManager = new RecognitionManager(); |
| | | openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | refreshHWND(); |
| | | } |
| | | void IndustryCapture::refreshHWND() { |
| | | HWND hwnd = THSActionUtil::getIndustryWindow(); |
| | | if (hwnd <= 0) |
| | | throw string("同花顺行业页面未打开"); |
| | | |
| | | HWND content = FindWindowExA(hwnd, NULL, "AfxFrameOrView100s", NULL); |
| | | |
| | | |
| | | if (content <= 0) |
| | | throw string("未获取到内容窗口句柄"); |
| | | |
| | | win = content; |
| | | } |
| | | |
| | | list<int*> splitMenu(GPCodeArea menuArea, cv::Mat grayImg) { |
| | | //切分菜单 |
| | | return THSActionUtil::splitPlateRowArea(grayImg, menuArea.starty + 10, menuArea.startx, menuArea.endy, menuArea.endx - 20); |
| | | } |
| | | |
| | | |
| | | |
| | | list<list<IndustryData>> IndustryCapture::captureIndustryCodes(cv::Mat oimg) { |
| | | cv::Mat grayImg_ = cv::Mat::zeros(oimg.rows, oimg.cols, CV_8UC1);//ImgUtil::grayImage(oimg); |
| | | |
| | | uchar* imgData = (uchar*)malloc(sizeof(uchar) * oimg.rows * oimg.cols); |
| | | if (oimg.channels() == 3) |
| | | { |
| | | openCLExcuter->rgb2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | else { |
| | | openCLExcuter->rgba2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | grayImg_.data = imgData; |
| | | //cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\industry.jpg", grayImg); |
| | | |
| | | GPCodeArea menu = THSActionUtil::splitPlateMenuArea(grayImg_); |
| | | list<int*> menus = splitMenu(menu, grayImg_); |
| | | |
| | | list<list<IndustryData>> flist; |
| | | |
| | | for (list<int*>::iterator ele = menus.begin();ele != menus.end();ele++) { |
| | | |
| | | int x = ((*ele)[0] + (*ele)[2]) / 2; |
| | | int y = ((*ele)[1] + (*ele)[3]) / 2; |
| | | //点击 |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(x, y)); |
| | | list<IndustryData> dataList; |
| | | for (int i = 0;i < 3;i++) { |
| | | |
| | | Sleep(500); |
| | | //截图+灰度化 |
| | | |
| | | list<IndustryData> itemList; |
| | | |
| | | cv::Mat grayImg = grayImgs(CaptureUtil::capture(win)); |
| | | list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg); |
| | | |
| | | //每行的元素个数 |
| | | int ele_count_per_line = 2; |
| | | int* splitResult = (int*)malloc(sizeof(int) * 4 * ele_count_per_line * rowData.size()); |
| | | int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | int count = 0; |
| | | for (std::list<int*>::iterator ele = rowData.begin();ele != rowData.end();ele++) { |
| | | |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(count)).append(".jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg, cv::Rect((*ele)[0], (*ele)[1], (*ele)[2] - (*ele)[0] + 1, (*ele)[3] - (*ele)[1] + 1))); |
| | | rowIndex[4 * count + 0] = (*ele)[0]; |
| | | rowIndex[4 * count + 1] = (*ele)[1]; |
| | | rowIndex[4 * count + 2] = (*ele)[2]; |
| | | rowIndex[4 * count + 3] = (*ele)[3]; |
| | | free(*ele); |
| | | count++; |
| | | } |
| | | |
| | | int line_number_count = ele_count_per_line * 6; |
| | | |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line, 1, 2, splitResult); |
| | | |
| | | //分割数字 |
| | | unsigned char* zeroData = (unsigned char*)malloc(sizeof(unsigned char) * _NUMBER_GP_CODE_WIDTH * _NUMBER_GP_CODE_HEIGHT); |
| | | for (int r = 0;r < _NUMBER_GP_CODE_HEIGHT;r++) { |
| | | for (int c = 0;c < _NUMBER_GP_CODE_WIDTH;c++) |
| | | { |
| | | zeroData[r * _NUMBER_GP_CODE_WIDTH + c] = ImgUtil::NUMS_GP_CODE[0].data.ptr<uchar>(r)[c]; |
| | | } |
| | | } |
| | | unsigned char* totalNumberData = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | |
| | | UcharDataInfo typesData = UcharDataInfo(); |
| | | unsigned char types[] = { NUM_TYPE_CODE,NUM_TYPE_MONEY}; |
| | | typesData.length = 2; |
| | | typesData.data = types; |
| | | |
| | | openCLExcuter->splitPlateNum(grayImg, IntDataInfo({ splitResult,(int) (ele_count_per_line * rowData.size()) }), UcharDataInfo({ totalNumberData, -1 }), typesData, zeroData, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, ele_count_per_line, 6); |
| | | |
| | | |
| | | |
| | | |
| | | //识别数字 |
| | | uchar* templateNums = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | openCLExcuter->createNumberTemplates(rowData.size(), _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count, ImgUtil::numsOneLevel_gpcode, templateNums); |
| | | uchar** numberResult = openCLExcuter->recognition_numbers(totalNumberData, templateNums, rowData.size() * _NUMBER_GP_CODE_HEIGHT, _NUMBER_GP_CODE_WIDTH * 10 * line_number_count, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count); |
| | | |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | IndustryData industryData = IndustryData(); |
| | | string code = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][6*1+j])); |
| | | } |
| | | |
| | | string money = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | { |
| | | if (j == 4) { |
| | | money.append("."); |
| | | } |
| | | money.append(to_string(numberResult[i][ j])); |
| | | } |
| | | |
| | | industryData.index = i; |
| | | industryData.code = code; |
| | | industryData.zyltMoney = money; |
| | | itemList.push_back(industryData); |
| | | free(numberResult[i]); |
| | | } |
| | | free(numberResult); |
| | | int* unitData = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | |
| | | |
| | | |
| | | //识别金额单位 |
| | | int index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | unitData[index * 4 + 0] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 0]; |
| | | unitData[index * 4 + 1] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 1]; |
| | | unitData[index * 4 + 2] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 2]; |
| | | unitData[index * 4 + 3] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 3]; |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(index)).append("_1.jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg,cv::Rect(unitData[index * 4 + 0], unitData[index * 4 + 1], unitData[index * 4 + 2]- unitData[index * 4 + 0]+1, unitData[index * 4 + 3]- unitData[index * 4 + 1]+1))); |
| | | |
| | | index++; |
| | | } |
| | | int* unitResult = (int*)malloc(sizeof(int) * itemList.size()); |
| | | openCLExcuter->recognitionPlateMoneyUnit(grayImg.data, grayImg.cols, grayImg.rows, unitData, 1, itemList.size(), unitResult); |
| | | index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | switch (unitResult[index]) |
| | | { |
| | | case 0: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_Y; |
| | | break; |
| | | case 1: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_W; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | index++; |
| | | } |
| | | free(rowIndex); |
| | | free(splitResult); |
| | | free(zeroData); |
| | | free(templateNums); |
| | | free(unitData); |
| | | free(unitResult); |
| | | free(grayImg.data); |
| | | grayImg.release(); |
| | | |
| | | |
| | | for (list<IndustryData>::iterator el = itemList.begin();el != itemList.end();el++) { |
| | | dataList.push_back(*el); |
| | | } |
| | | |
| | | int x = oimg.cols - 50; |
| | | int y = 200; |
| | | |
| | | RECT rect; |
| | | GetWindowRect(win,&rect); |
| | | |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKELONG(x, y)); |
| | | } |
| | | |
| | | flist.push_back(dataList); |
| | | } |
| | | |
| | | return flist; |
| | | } |
| | | |
| | | |
| | | |
| | | list<list<IndustryData>> IndustryCapture::captureIndustryCodes() { |
| | | list<list<IndustryData>> flist; |
| | | set<string> codesSet; |
| | | for (int i = 0;i < 3;i++) { |
| | | Sleep(1000); |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | | list<list<IndustryData>> codes = captureIndustryCodes(oimg); |
| | | for (list<list<IndustryData>>::iterator el = codes.begin();el != codes.end();el++) { |
| | | flist.push_back(*el); |
| | | } |
| | | RECT rect; |
| | | GetWindowRect(win, &rect); |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(20, 100)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(20, 100)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(20, 100)); |
| | | } |
| | | return flist; |
| | | } |
| | | |
| | | bool IndustryCapture::isInited() { |
| | | return inited; |
| | | } |
New file |
| | |
| | | #pragma once |
| | | #include <string> |
| | | #include <iostream> |
| | | #include <list> |
| | | #include "ImgUtil.h" |
| | | #include "RecognitionManager.h" |
| | | #include "THSActionUtil.h" |
| | | |
| | | |
| | | |
| | | struct IndustryData |
| | | { |
| | | string code; |
| | | //自由流通市值 |
| | | string zyltMoney; |
| | | MoneyUnit zyltMoneyUnit; |
| | | //辅助功能 |
| | | int index; |
| | | }; |
| | | |
| | | |
| | | class IndustryCapture |
| | | { |
| | | private: |
| | | static OpenCLExcuter* openCLExcuter; |
| | | static RecognitionManager* recognitionManager; |
| | | static bool inited; |
| | | |
| | | static HWND win; |
| | | |
| | | static cv::Mat grayImgs(cv::Mat img); |
| | | |
| | | |
| | | public: |
| | | void init(); |
| | | void refreshHWND(); |
| | | |
| | | static list<list<IndustryData>> captureIndustryCodes(cv::Mat img); |
| | | |
| | | static list<list<IndustryData>> captureIndustryCodes(); |
| | | |
| | | bool isInited(); |
| | | }; |
| | | |
| | |
| | | #include <thread> |
| | | bool L2DataCapture::inited; |
| | | OpenCLExcuter* L2DataCapture::openCLExcuter[THS_FRAME_COUNT]; |
| | | TradeQueueCapture* L2DataCapture::tradeQueueCapture[THS_FRAME_COUNT]; |
| | | |
| | | |
| | | //是否正在执行 |
| | | bool L2DataCapture::running; |
| | | bool L2DataCapture::runnings[THS_FRAME_COUNT]; |
| | | clock_t L2DataCapture::latest_running_times[THS_FRAME_COUNT]; |
| | | |
| | | CallbackFun L2DataCapture::data_callback; |
| | | |
| | | CallbackFun_Trade_Queue L2DataCapture::trade_queue_data_callback; |
| | | |
| | | string L2DataCapture::gpCodes[THS_FRAME_COUNT]; |
| | | |
| | |
| | | //识别数据 |
| | | string code = gpCodes[index]; |
| | | try { |
| | | list<TradeData> resultList = captureLevel2TradeData(CaptureUtil::capture(index), index); |
| | | list<TradeData> resultList = captureLevel2TradeData(CaptureUtil::capture(index, CAPTURE_TYPE_L2), index); |
| | | data_callback(index, code, resultList, context); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | } |
| | | Sleep(2); |
| | | } |
| | | } |
| | | |
| | | |
| | | void L2DataCapture::_run_trade_queue(int index) |
| | | { |
| | | while (true) { |
| | | if (running && runnings[index] && gpCodes[index].length() > 0) { |
| | | //识别数据 |
| | | string code = gpCodes[index]; |
| | | try { |
| | | list<int> numList= tradeQueueCapture[index]->recognition(CaptureUtil::getHWND(index,CAPTURE_TYPE_TRADE_QUEUE)); |
| | | trade_queue_data_callback(index, code, numList, context); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | } |
| | | Sleep(2); |
| | |
| | | CaptureUtil::init(win); |
| | | } |
| | | |
| | | void L2DataCapture::init(CallbackFun callback, void* contex) { |
| | | void L2DataCapture::init(CallbackFun callback, CallbackFun_Trade_Queue trade_queue_callback, void* contex) { |
| | | inited = true; |
| | | data_callback = callback; |
| | | trade_queue_data_callback = trade_queue_callback; |
| | | context = contex; |
| | | |
| | | |
| | |
| | | { |
| | | openCLExcuter[i] = new OpenCLExcuter(); |
| | | openCLExcuter[i]->init(); |
| | | tradeQueueCapture[i] = new TradeQueueCapture(); |
| | | } |
| | | |
| | | |
| | | |
| | | //获取同花顺窗口句柄 |
| | | try { |
| | | refreshHWND(); |
| | |
| | | runnings[i] = false; |
| | | thread rt(&(L2DataCapture::_run),i); |
| | | rt.detach(); |
| | | |
| | | thread rt_trade_queue(&(L2DataCapture::_run_trade_queue), i); |
| | | rt_trade_queue.detach(); |
| | | } |
| | | |
| | | } |
| | |
| | | #include <map> |
| | | #include "OpenCLExcuter.h" |
| | | #include "CaptureUtil.h" |
| | | #include "TradeQueueCapture.h" |
| | | #define THS_FRAME_COUNT 8 |
| | | |
| | | typedef void (*CallbackFun)(int index, string code, list<TradeData> dataList, void* contex); |
| | | typedef void (*CallbackFun_Trade_Queue)(int index, string code, list<int> numList, void* contex); |
| | | |
| | | |
| | | class L2DataCapture |
| | | { |
| | | private: |
| | | static OpenCLExcuter* openCLExcuter[THS_FRAME_COUNT]; |
| | | static TradeQueueCapture* tradeQueueCapture[THS_FRAME_COUNT]; |
| | | |
| | | |
| | | static bool inited; |
| | | //是否正在执行 |
| | | static bool running; |
| | |
| | | |
| | | static CallbackFun data_callback; |
| | | |
| | | static CallbackFun_Trade_Queue trade_queue_data_callback; |
| | | |
| | | static void* context; |
| | | |
| | | static void _run(int index); |
| | | |
| | | static void _run_trade_queue(int index); |
| | | |
| | | |
| | | |
| | |
| | | L2DataCapture(); |
| | | |
| | | //初始化 |
| | | void init(CallbackFun callback, void* context); |
| | | void init(CallbackFun callback, CallbackFun_Trade_Queue trade_queue_callback, void* context); |
| | | |
| | | void refreshHWND(); |
| | | |
| | |
| | | #include "LimitUpCapture.h" |
| | | #include "THSActionUtil.h" |
| | | #include <set> |
| | | #include "Win32Util.h" |
| | | OpenCLExcuter* LimitUpCapture::openCLExcuter; |
| | | bool LimitUpCapture::inited; |
| | | //是否正在执行 |
| | |
| | | |
| | | CallbackFun_Limit_Up LimitUpCapture::data_callback; |
| | | |
| | | std::list<cv::Point> LimitUpCapture::pointList; |
| | | |
| | | void* LimitUpCapture::context; |
| | | |
| | | HWND LimitUpCapture::win; |
| | | |
| | | HWND LimitUpCapture::menuWin; |
| | | |
| | | |
| | | |
| | | RecognitionManager* LimitUpCapture::recognitionManager; |
| | | |
| | | HWND getWindow() { |
| | | return THSActionUtil::getThirdWindow(); |
| | | } |
| | | |
| | | void LimitUpCapture::_run() { |
| | | while (true) { |
| | |
| | | recognitionManager = new RecognitionManager(); |
| | | openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | |
| | | thread rt(&(LimitUpCapture::_run)); |
| | | rt.detach(); |
| | | inited = true; |
| | | refreshHWND(); |
| | | } |
| | | void LimitUpCapture::refreshHWND() { |
| | | HWND hwnd = THSActionUtil::getThirdWindow(); |
| | | HWND hwnd = getWindow(); |
| | | if (hwnd <= 0) |
| | | throw string("同花顺副屏2未打开"); |
| | | |
| | |
| | | throw string("未获取到内容窗口句柄"); |
| | | |
| | | win = content; |
| | | |
| | | HWND child = 0; |
| | | RECT tempRect; |
| | | int maxCount = 1; |
| | | do { |
| | | maxCount++; |
| | | child = FindWindowExA(content, child, "AfxWnd100s", NULL); |
| | | GetWindowRect(child, &tempRect); |
| | | } while ((!IsWindowVisible(child) || tempRect.right - tempRect.left > tempRect.bottom - tempRect.top) && maxCount < 10);//没显示或者宽大于高 |
| | | |
| | | HWND temp= FindWindowExA(child, NULL, NULL, NULL); |
| | | for (int i = 0;i < 10;i++) { |
| | | GetWindowRect(temp, &tempRect); |
| | | if (!IsWindowVisible(temp) || tempRect.bottom - tempRect.top < 100) { |
| | | temp= FindWindowExA(child, temp, NULL, NULL); |
| | | } |
| | | else { |
| | | break; |
| | | } |
| | | } |
| | | temp= FindWindowExA(temp, NULL, "block_list_page", NULL); |
| | | |
| | | |
| | | |
| | | menuWin = temp; |
| | | |
| | | if (menuWin <= 0) |
| | | throw string("未获取到内容窗口的菜单句柄"); |
| | | |
| | | //查找菜单的位置 |
| | | |
| | | cv::Mat grayImg = ImgUtil::grayImage(CaptureUtil::capture(menuWin)); |
| | | int full_start = -1; |
| | | int full_end = -1; |
| | | int start_row = -1; |
| | | int end_row = -1; |
| | | int count = 0; |
| | | pointList.clear(); |
| | | for (int r = grayImg.rows - 1;r>=0;r --) { |
| | | if (ImgDivider::isRowFull(grayImg,r,0, grayImg.cols-1,2,33,48)) { |
| | | if (full_start < 0) |
| | | { |
| | | full_start = r; |
| | | full_end = r; |
| | | } |
| | | else { |
| | | full_end = r; |
| | | } |
| | | |
| | | if (start_row > 0 && end_row > 0 && (start_row - end_row) > 5) { |
| | | count++; |
| | | printf("%d-%d\n", start_row, end_row); |
| | | |
| | | full_start = r; |
| | | full_end = r; |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\menu\\"; |
| | | path.append("menu_").append(to_string(count)).append(".jpg"); |
| | | |
| | | cv::imwrite(path, cv::Mat(grayImg,cv::Rect(0,end_row,grayImg.cols,start_row-end_row))); |
| | | |
| | | pointList.push_back(cv::Point( ( 0 + grayImg.cols)/2, (start_row + end_row)/2)); |
| | | if (pointList.size() >= 2) { |
| | | break; |
| | | } |
| | | start_row = -1; |
| | | end_row = -1; |
| | | } |
| | | } |
| | | else { |
| | | if (full_start >= 0) |
| | | { |
| | | if (start_row < 0) |
| | | { |
| | | start_row = r; |
| | | end_row = r; |
| | | } |
| | | else { |
| | | end_row = r; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\menu.jpg", ); |
| | | |
| | | } |
| | | |
| | | bool LimitUpCapture::isRunning() { |
| | |
| | | |
| | | int line_number_count = 4 * 6; |
| | | |
| | | openCLExcuter->splitLimitUpRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line, splitResult); |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line,1,4,splitResult); |
| | | |
| | | /* |
| | | *测试 |
| | |
| | | } |
| | | |
| | | list<LimitUpData> LimitUpCapture::captureLimitUpCodes() { |
| | | cout << "开始运行" << endl; |
| | | HWND hwnd = getWindow(); |
| | | cout << "同花顺句柄:"<< hwnd << endl; |
| | | |
| | | RECT wrect; |
| | | GetWindowRect(win, &wrect); |
| | | list<LimitUpData> flist; |
| | | set<string> codesSet; |
| | | string codestr=""; |
| | | for (int i = 0;i < 5;i++) |
| | | { |
| | | int x = wrect.right - 50; |
| | | int y = wrect.top + 50; |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(x, y)); |
| | | Sleep(200); |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | | list<LimitUpData> codes = captureLimitUpCodes(oimg); |
| | | for (list<LimitUpData>::iterator ele = codes.begin();ele != codes.end();ele++) { |
| | | string code = (*ele).code; |
| | | if(codesSet.count(code)==0){ |
| | | codesSet.insert(code); |
| | | flist.push_back(*ele); |
| | | string codestr = ""; |
| | | |
| | | RECT menuRect; |
| | | GetWindowRect(menuWin, &menuRect); |
| | | |
| | | list<cv::Point>::iterator ele; |
| | | for (ele = pointList.begin();ele != pointList.end();ele++) { |
| | | int x = (*ele).x;//+ menuRect.left; |
| | | int y = (*ele).y;//+ menuRect.top; |
| | | printf("x:%d y:%d\n", x, y); |
| | | SendMessage(menuWin, WM_LBUTTONDOWN, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(menuWin, WM_LBUTTONUP, 0, MAKELONG(x, y)); |
| | | //SendMessage(menuWin, WM_SETCURSOR,(int) menuWin, 0x02000001); |
| | | //Win32Util::focus(menuWin); |
| | | //Win32Util::click(x, y); |
| | | Sleep(100); |
| | | |
| | | for (int i = 0;i < 3;i++) |
| | | { |
| | | int x = wrect.right - 50; |
| | | int y = wrect.top + 50; |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(x, y)); |
| | | Sleep(100); |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | | list<LimitUpData> codes = captureLimitUpCodes(oimg); |
| | | for (list<LimitUpData>::iterator ele = codes.begin();ele != codes.end();ele++) { |
| | | string code = (*ele).code; |
| | | if (codesSet.count(code) == 0) { |
| | | codesSet.insert(code); |
| | | flist.push_back(*ele); |
| | | } |
| | | } |
| | | codes.clear(); |
| | | Sleep(50); |
| | | } |
| | | codes.clear(); |
| | | Sleep(50); |
| | | } |
| | | |
| | | |
| | | |
| | | return flist; |
| | | |
| | | } |
| | |
| | | #include <list> |
| | | #include "ImgUtil.h" |
| | | #include "RecognitionManager.h" |
| | | |
| | | |
| | | enum MoneyUnit { |
| | | MONEY_UNIT_Y, |
| | | MONEY_UNIT_W, |
| | | }; |
| | | #include "THSActionUtil.h" |
| | | |
| | | struct LimitUpData |
| | | { |
| | |
| | | |
| | | static HWND win; |
| | | |
| | | static HWND menuWin; |
| | | |
| | | static std::list<cv::Point> pointList; |
| | | |
| | | |
| | | public: |
| | | void init(CallbackFun_Limit_Up callback, void* context); |
| | |
| | | |
| | | |
| | | |
| | | void OpenCLExcuter::splitLimitUpRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, int lineEleCount, |
| | | void OpenCLExcuter::splitPlateContentRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, int lineEleCount, int fromIndex, int toIndex, |
| | | int* result) { |
| | | |
| | | kernel = clCreateKernel(program, "splitCommonRowData", &error); |
| | |
| | | |
| | | int inputSize = imgWidth * imgHeight; |
| | | int resultSize = lines * lineEleCount * 4; |
| | | |
| | | int fromIndex = 1; |
| | | int toIndex = 4; |
| | | |
| | | |
| | | //创建缓存对象 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | void OpenCLExcuter::rgb2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result) { |
| | | |
| | | kernel = clCreateKernel(program, "rgb2GrayImgInvert", &error); |
| | | if (kernel == NULL) { |
| | | throw("Couldn't create kernel!\n"); |
| | | } |
| | | |
| | | |
| | | int inputSize = imgWidth * imgHeight * 3; |
| | | int resultSize = imgWidth * imgHeight; |
| | | |
| | | |
| | | //创建缓存对象 |
| | | |
| | | cl_mem memObject1 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(uchar) * inputSize, imgs, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject1 failed!\n"); |
| | | } |
| | | |
| | | cl_mem memObject2 = clCreateBuffer(context, CL_MEM_WRITE_ONLY, |
| | | sizeof(uchar) * resultSize, NULL, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject2 failed!\n"); |
| | | } |
| | | |
| | | |
| | | //设置内核参数 |
| | | error = clSetKernelArg(kernel, 0, sizeof(cl_mem), &memObject1); |
| | | error |= clSetKernelArg(kernel, 1, sizeof(int), &imgWidth); |
| | | error = clSetKernelArg(kernel, 2, sizeof(cl_mem), &memObject2); |
| | | |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error setting kernel arguments!\n"); |
| | | } |
| | | //执行内核 |
| | | size_t globalWorkSize[1] = { imgHeight }; |
| | | size_t localWorkSize[1] = { 1 }; |
| | | |
| | | const int work_dim = 1; |
| | | |
| | | error = clEnqueueNDRangeKernel(queue, kernel, work_dim, NULL, globalWorkSize, |
| | | localWorkSize, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error queuing kernel for execution!\n"); |
| | | } |
| | | |
| | | //读取执行结果 |
| | | error = clEnqueueReadBuffer(queue, memObject2, CL_TRUE, 0, resultSize * sizeof(uchar), |
| | | result, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error reading result buffer!\n"); |
| | | } |
| | | |
| | | clReleaseKernel(kernel); |
| | | clReleaseMemObject(memObject1); |
| | | clReleaseMemObject(memObject2); |
| | | |
| | | } |
| | | |
| | | |
| | | void OpenCLExcuter::rgba2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result) { |
| | | |
| | | kernel = clCreateKernel(program, "rgba2GrayImgInvert", &error); |
| | | if (kernel == NULL) { |
| | | throw("Couldn't create kernel!\n"); |
| | | } |
| | | |
| | | |
| | | int inputSize = imgWidth * imgHeight * 4; |
| | | int resultSize = imgWidth * imgHeight; |
| | | |
| | | |
| | | //创建缓存对象 |
| | | |
| | | cl_mem memObject1 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(uchar) * inputSize, imgs, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject1 failed!\n"); |
| | | } |
| | | |
| | | cl_mem memObject2 = clCreateBuffer(context, CL_MEM_WRITE_ONLY, |
| | | sizeof(uchar) * resultSize, NULL, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject2 failed!\n"); |
| | | } |
| | | |
| | | |
| | | //设置内核参数 |
| | | error = clSetKernelArg(kernel, 0, sizeof(cl_mem), &memObject1); |
| | | error |= clSetKernelArg(kernel, 1, sizeof(int), &imgWidth); |
| | | error = clSetKernelArg(kernel, 2, sizeof(cl_mem), &memObject2); |
| | | |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error setting kernel arguments!\n"); |
| | | } |
| | | //执行内核 |
| | | size_t globalWorkSize[1] = { imgHeight }; |
| | | size_t localWorkSize[1] = { 1 }; |
| | | |
| | | const int work_dim = 1; |
| | | |
| | | error = clEnqueueNDRangeKernel(queue, kernel, work_dim, NULL, globalWorkSize, |
| | | localWorkSize, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error queuing kernel for execution!\n"); |
| | | } |
| | | |
| | | //读取执行结果 |
| | | error = clEnqueueReadBuffer(queue, memObject2, CL_TRUE, 0, resultSize * sizeof(uchar), |
| | | result, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error reading result buffer!\n"); |
| | | } |
| | | |
| | | clReleaseKernel(kernel); |
| | | clReleaseMemObject(memObject1); |
| | | clReleaseMemObject(memObject2); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | void OpenCLExcuter::destory() { |
| | | //释放资源 |
| | | clReleaseDevice(devices); |
| | |
| | | void rgba2Gray(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result); |
| | | |
| | | |
| | | void rgb2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result); |
| | | |
| | | void rgba2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result); |
| | | |
| | | |
| | | //创建识别的数字模板 |
| | | void createNumberTemplates(int lines, int num_width, int num_height, int num_count, uchar* numsOneLevelData, unsigned char* result); |
| | | |
| | |
| | | void splitL2RowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, |
| | | int* result); |
| | | |
| | | void splitLimitUpRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, int lineEleCount, |
| | | void splitPlateContentRowData(unsigned char* imgs, int imgWidth, int imgHeight, int* rowIndexs, int lines, int lineEleCount,int fromIndex,int toIndex, |
| | | int* result); |
| | | |
| | | //识别非数字 |
| | |
| | | } |
| | | |
| | | |
| | | HWND THSActionUtil::getIndustryWindow() { |
| | | list<HWND> wlist = Win32Util::searchWindow("同花顺("); |
| | | list<HWND>::iterator ele; |
| | | for (ele = wlist.begin();ele != wlist.end();ele++) { |
| | | HWND hwnd = *ele; |
| | | string str = Win32Util::getWindowName(hwnd); |
| | | if (str.find("行业") != string::npos) |
| | | { |
| | | return hwnd; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | HWND THSActionUtil::getTradeWindow() { |
| | | list<HWND> wlist = Win32Util::searchWindow("网上股票交易系统"); |
| | | list<HWND>::iterator ele; |
| | | for (ele = wlist.begin();ele != wlist.end();ele++) { |
| | | HWND hwnd = *ele; |
| | | return hwnd; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //获取副屏1 |
| | | HWND getSecondWindow() { |
| | | list<HWND> wlist = Win32Util::searchWindow("同花顺("); |
| | |
| | | std::list<int*> dataItemList; |
| | | |
| | | for (int i = start_row;i < end_row;i++) { |
| | | bool empty = ImgDivider::isRowEmpty(img, i, start_col, start_col + 50, 1, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + (end_col - start_col) / 2 - 40, start_col + (end_col - start_col) / 2 + 40, 1, _IMG_BINARY_THRESHOLD); |
| | | bool empty = ImgDivider::isRowEmpty(img, i, start_col, start_col + 50, 1, _IMG_BINARY_THRESHOLD)&& ImgDivider::isRowEmpty(img, i, start_col+50, start_col + 150, 2, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + (end_col - start_col) / 2 - 40, start_col + (end_col - start_col) / 2 + 40, 1, _IMG_BINARY_THRESHOLD); |
| | | if (empty) { |
| | | if (emptyStartRow < 0) { |
| | | emptyStartRow = i; |
| | |
| | | break; |
| | | } |
| | | |
| | | if (startf > -1 && endf > -1 && (dataItemList.size()>0 && emptyEndRow - emptyStartRow > 3|| emptyEndRow - emptyStartRow>0)) { |
| | | if (startf > -1 && endf > -1 && (dataItemList.size() > 0 && emptyEndRow - emptyStartRow > 3 || emptyEndRow - emptyStartRow > 0)) { |
| | | //内容坐标 |
| | | //LogUtil::debug("内容的高度为:%d \n", endf - startf); |
| | | |
| | |
| | | return dataItemList; |
| | | } |
| | | |
| | | |
| | | GPCodeArea THSActionUtil::splitPlateMenuArea(cv::Mat img) { |
| | | int rows = img.rows; |
| | | int cols = img.cols; |
| | | int r; |
| | | int contentStartRow = -1; |
| | | int contentEndRow = -1; |
| | | for (r = 5;r < img.rows;r++) { |
| | | if (ImgDivider::isRowFull(img, r, 0, cols - 5, 3, 12, 30)) { |
| | | |
| | | if (contentStartRow < 0) |
| | | contentStartRow = r; |
| | | else if (r - contentStartRow > 100) { |
| | | contentEndRow = r; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | if (contentStartRow > -1 && contentEndRow > -1) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (contentEndRow < 0) { |
| | | contentEndRow = img.rows - 1; |
| | | } |
| | | |
| | | if (contentStartRow < 0|| contentEndRow<0) { |
| | | throw string("起始行分隔出错"); |
| | | } |
| | | |
| | | //分隔列 |
| | | int c = 0; |
| | | int startC = -1; |
| | | for (c = 0;c < cols;c++) { |
| | | if (ImgDivider::isColFull(img, c, contentStartRow + 5, contentStartRow + 100, 2)) { |
| | | if (startC < 0 && c>50) { |
| | | startC = c; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (startC < 0) { |
| | | throw string("内容框分隔出错"); |
| | | } |
| | | GPCodeArea area = GPCodeArea(); |
| | | area.startx = 0; |
| | | area.starty = contentStartRow; |
| | | area.endx = startC; |
| | | area.endy = contentEndRow; |
| | | return area; |
| | | } |
| | | |
| | | //分隔板块行数据 |
| | | std::list<int*> THSActionUtil::splitPlateRowArea(cv::Mat img) { |
| | |
| | | //再次分隔内容框,排除干扰 |
| | | int cut_index = -1; |
| | | for (int r = contentStartRow + 5;r < contentStartRow + 5 + 100;r++) { |
| | | |
| | | if (ImgDivider::isRowFull(img, r, startC, endC, 2,25,30)) { |
| | | |
| | | if (ImgDivider::isRowFull(img, r, startC, endC, 2, 25, 30)) { |
| | | cut_index = r; |
| | | } |
| | | else { |
| | | if (cut_index>0&& r - cut_index > 30) { |
| | | if (cut_index > 0 && r - cut_index > 30) { |
| | | contentStartRow = cut_index; |
| | | break; |
| | | } |
| | |
| | | //分隔行内容 |
| | | std::list<int*> dataItemList = THSActionUtil::splitPlateRowArea(img, start_row, start_col, end_row, end_col); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //分隔列 |
| | |
| | | } |
| | | } |
| | | //contentStartRow < 0 || contentEndRow < 0 |
| | | if (contentStartRow < 0 ) { |
| | | if (contentStartRow < 0) { |
| | | throw string("起始行或结束行分隔出错"); |
| | | } |
| | | |
| | |
| | | int endRow = 0; |
| | | //判断结束行 |
| | | for (int r = contentStartRow + 10;r < img.rows;r++) { |
| | | bool full = ImgDivider::isRowFull(img, r, startx, endx,2 , 10, 30); |
| | | bool full = ImgDivider::isRowFull(img, r, startx, endx, 2, 10, 30); |
| | | if (full) { |
| | | endRow = r; |
| | | break; |
| | |
| | | int contentStartRow = -1; |
| | | int contentEndRow = -1; |
| | | for (int r = 5;r < img.rows;r++) { |
| | | if (ImgDivider::isRowFull(img, r, 0, img.cols/3, 2, 10, 30)&& ImgDivider::isRowFull(img, r, img.cols*2 / 3, img.cols, 2, 10, 30)) { |
| | | if (ImgDivider::isRowFull(img, r, 0, img.cols / 3, 2, 10, 30) && ImgDivider::isRowFull(img, r, img.cols * 2 / 3, img.cols, 2, 10, 30)) { |
| | | if (contentStartRow < 0) |
| | | { |
| | | contentStartRow = r; |
| | |
| | | IMG_TYPE_GP, |
| | | IMG_TYPE_ADD |
| | | }; |
| | | |
| | | enum MoneyUnit { |
| | | MONEY_UNIT_Y, |
| | | MONEY_UNIT_W, |
| | | }; |
| | | struct GPCodeArea |
| | | { |
| | | ImgType type; |
| | |
| | | |
| | | static HWND getThirdWindow(); |
| | | |
| | | //行业 |
| | | static HWND getIndustryWindow(); |
| | | |
| | | //交易句柄 |
| | | static HWND getTradeWindow(); |
| | | |
| | | |
| | | //检测环境 |
| | | static bool checkEnv(); |
| | | |
| | | // |
| | | static GPCodeArea splitPlateMenuArea(cv::Mat img); |
| | | |
| | | //板块内容分割 |
| | | static std::list<int*> splitPlateRowArea(cv::Mat img); |
| | | |
| | |
| | | #include "TradeQueueCapture.h" |
| | | #include "CaptureUtil.h" |
| | | |
| | | |
| | | |
| | | TradeQueueCapture::TradeQueueCapture() { |
| | | openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | } |
| | | |
| | | |
| | | |
| | | list<int*> TradeQueueCapture::split(cv::Mat img) { |
| | | |
| | |
| | | } |
| | | numberList.push_back(stoi(st)); |
| | | free(numberResult[i]); |
| | | printf("结果:%d\n", stoi(st)); |
| | | //printf("结果:%d\n", stoi(st)); |
| | | } |
| | | |
| | | free(numberResult); |
| | |
| | | #pragma once |
| | | #include "ImgUtil.h" |
| | | #include "OpenCLExcuter.h" |
| | | |
| | | class TradeQueueCapture |
| | | { |
| | | private: |
| | | OpenCLExcuter *openCLExcuter; |
| | | public: |
| | | TradeQueueCapture(); |
| | | |
| | | public: |
| | | bool isRunning(); |
| | | TradeQueueCapture(); |
| | | list<int*> split(cv::Mat grayImg); |
| | | list<int> recognition(cv::Mat grayImg,list<int*> pos); |
| | | list<int> recognition(HWND hwnd); |
| | |
| | | } |
| | | } |
| | | |
| | | __kernel void rgb2GrayImgInvert(__global unsigned char* imgs, int width, |
| | | __global unsigned char* result) { |
| | | |
| | | int rowIndex = get_global_id(0); |
| | | |
| | | for (int c = 0;c < width;c++) { |
| | | int index = rowIndex * width + c; |
| | | int start = index * 3; |
| | | unsigned char R = imgs[start]; |
| | | unsigned char G = imgs[start + 1]; |
| | | unsigned char B = imgs[start + 2]; |
| | | result[index] = 255 - (76 * R + 150 * G + 30 * B) >> 8; |
| | | } |
| | | } |
| | | |
| | | __kernel void rgba2GrayImg(__global unsigned char* imgs, int width, |
| | | __global unsigned char* result) { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | __kernel void rgba2GrayImgInvert(__global unsigned char* imgs, int width, |
| | | __global unsigned char* result) { |
| | | |
| | | int rowIndex = get_global_id(0); |
| | | |
| | | for (int c = 0;c < width;c++) { |
| | | int index = rowIndex * width + c; |
| | | int start = index * 4; |
| | | unsigned char R = imgs[start]; |
| | | unsigned char G = imgs[start + 1]; |
| | | unsigned char B = imgs[start + 2]; |
| | | result[index] =255 - (76 * R + 150 * G + 30 * B) >> 8; |
| | | } |
| | | } |
| | | |
| | | |
| | | //L2非数字识别 |
| | | __kernel void recognition_not_num(__global unsigned char* imgs, __global int* rowIndexs, int width, |
| | | __global int* result) { |
| | |
| | | #include "THSActionUtil.h" |
| | | #include "Win32Util.h" |
| | | #include "LimitUpCapture.h" |
| | | #include "IndustryCapture.h" |
| | | void gray(); |
| | | void ths(); |
| | | /* |
| | |
| | | |
| | | |
| | | int main() { |
| | | cout << "开始程序" << endl; |
| | | |
| | | //SetDlgItemText(HWND(0x0002269E), 0x0000040A, TEXT("100")); |
| | | //SetWindowText(GetDlgItem(HWND(0x0002269E), 0x0000040A),TEXT("100")); |
| | | //Win32Util::focus(GetDlgItem(HWND(0x0002269E), 0x00000408)); |
| | | //Win32Util::keyboardNum("000333", 10); |
| | | |
| | | cv::Mat img = CaptureUtil::capture(HWND(0x00020E12)); |
| | | cv::Mat grayImg = ImgUtil::grayImage(img); |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\"; |
| | | path.append("order.jpg"); |
| | | cv::imwrite(path, grayImg); |
| | | return 0; |
| | | |
| | | ImgUtil::init(); |
| | | |
| | | splitTradeQueue(); |
| | | cout << "ImgUtil初始化完成" << endl; |
| | | |
| | | IndustryCapture* industryCapture = new IndustryCapture(); |
| | | cout << "LimitUpCapture实例化" << endl; |
| | | industryCapture->init(); |
| | | cout << "LimitUpCapture初始化完成" << endl; |
| | | |
| | | industryCapture->captureIndustryCodes(); |
| | | |
| | | |
| | | delete industryCapture; |
| | | //splitTradeQueue(); |
| | | |
| | | //SendMessage(HWND(0x000B1A86), WM_LBUTTONDOWN, 0, MAKEWORD(1, 1)); |
| | | //SendMessage(HWND(0x000B1A86), WM_LBUTTONUP, 0, MAKEWORD(1, 1)); |
| | | |
| | | |
| | | /* |
| | |
| | | |
| | | system("PAUSE"); |
| | | */ |
| | | system("PAUSE"); |
| | | cv::waitKey(0); |
| | | cv::destroyAllWindows(); |
| | | //system("PAUSE"); |
| | | //cv::waitKey(0); |
| | | //cv::destroyAllWindows(); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | |
| | | for (int i = 5;i < 6;i++) |
| | | { |
| | | cv::Mat img = CaptureUtil::capture(1); |
| | | cv::Mat img = CaptureUtil::capture(1,CAPTURE_TYPE_L2); |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\demo\\"; |
| | | path.append(to_string(i)); |
| | | path.append(".jpg"); |
| | |
| | | { |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_70406436BEFE4ABC91B3ABD8FCAE4557" |
| | | "MsmKey" = "8:_0D533BDCE4DC4542BDE29E4086CED9DF" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_0FF53709FC014135A59A30887CE138EA" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_10D906F07AB4E6C9AD91FA43E1CE3341" |
| | | "OwnerKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_2218F7C9B926477DA2430B963075D913" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_342F0F439B6940B39272E02998935F73" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_3AD9003AED164569B847ADC000C2F933" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_546AD9A63A774BEF961A5C1C1A86A9AF" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_5B9019C61E8BF62BE8F821754805C91A" |
| | | "OwnerKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_5F858163903B4EAFB20D4D7DA1EBCA58" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_5FCD9D09CB3246B5BAC235732F7EF23C" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_698FBE0A760145A79D43A539B32FA846" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_8648FE9C5E0E484DB9E19F96642A2767" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_88E7511A43901EA2B6A0F12EFF6661FE" |
| | | "OwnerKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_9C2903892F75438A93E871FCBEE63F64" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_A97D149608C6FC6837656B6A20636018" |
| | | "OwnerKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_AE34DBC834BB4449BBC2B271E254C7A6" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_B2FE9BF17B184AC3AA5DE56E90E5B4D4" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_BA75A8E7417B4D2EA41274186453503B" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_C17AB50E1DB64DD886A92258E22666AB" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_C66FAF78BCF6A56F539A77AFF5C1932B" |
| | | "OwnerKey" = "8:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_CF6C4192145E4E3D89AE201DD90C0344" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_D16635DC601141C6B54AD8B57638A5C3" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_D8865CD9923A459A9A6208F38F20CDCD" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_E88AC1DD7E4A494ABA9A6DDD5FF55D85" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | | "Entry" |
| | | { |
| | | "MsmKey" = "8:_F822A8A90E9545F281B4F27E204428FD" |
| | | "OwnerKey" = "8:_UNDEFINED" |
| | | "MsmSig" = "8:_UNDEFINED" |
| | | } |
| | |
| | | "PrivateKeyFile" = "8:" |
| | | "TimeStampServer" = "8:" |
| | | "InstallerBootstrapper" = "3:2" |
| | | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" |
| | | { |
| | | "Enabled" = "11:TRUE" |
| | | "PromptEnabled" = "11:TRUE" |
| | | "PrerequisitesLocation" = "2:1" |
| | | "Url" = "8:" |
| | | "ComponentsUrl" = "8:" |
| | | "Items" |
| | | { |
| | | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" |
| | | { |
| | | "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)" |
| | | "ProductCode" = "8:.NETFramework,Version=v4.7.2" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | "Release" |
| | | { |
| | |
| | | "PrivateKeyFile" = "8:" |
| | | "TimeStampServer" = "8:" |
| | | "InstallerBootstrapper" = "3:2" |
| | | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" |
| | | { |
| | | "Enabled" = "11:TRUE" |
| | | "PromptEnabled" = "11:TRUE" |
| | | "PrerequisitesLocation" = "2:1" |
| | | "Url" = "8:" |
| | | "ComponentsUrl" = "8:" |
| | | "Items" |
| | | { |
| | | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" |
| | | { |
| | | "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)" |
| | | "ProductCode" = "8:.NETFramework,Version=v4.7.2" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | "Deployable" |
| | |
| | | } |
| | | "File" |
| | | { |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0D533BDCE4DC4542BDE29E4086CED9DF" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\4.jpg" |
| | | "TargetName" = "8:4.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0FF53709FC014135A59A30887CE138EA" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\9.jpg" |
| | | "TargetName" = "8:9.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_10D906F07AB4E6C9AD91FA43E1CE3341" |
| | | { |
| | | "SourcePath" = "8:VCRUNTIME140D.dll" |
| | | "TargetName" = "8:VCRUNTIME140D.dll" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:TRUE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2218F7C9B926477DA2430B963075D913" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\8.jpg" |
| | | "TargetName" = "8:8.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_342F0F439B6940B39272E02998935F73" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\1.jpg" |
| | | "TargetName" = "8:1.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3AD9003AED164569B847ADC000C2F933" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\8.jpg" |
| | | "TargetName" = "8:8.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_546AD9A63A774BEF961A5C1C1A86A9AF" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\6.jpg" |
| | | "TargetName" = "8:6.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5B9019C61E8BF62BE8F821754805C91A" |
| | | { |
| | | "SourcePath" = "8:OpenCL.dll" |
| | | "TargetName" = "8:OpenCL.dll" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:TRUE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5F858163903B4EAFB20D4D7DA1EBCA58" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\1.jpg" |
| | | "TargetName" = "8:1.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5FCD9D09CB3246B5BAC235732F7EF23C" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\9.jpg" |
| | | "TargetName" = "8:9.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_698FBE0A760145A79D43A539B32FA846" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\3.jpg" |
| | | "TargetName" = "8:3.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8648FE9C5E0E484DB9E19F96642A2767" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\4.jpg" |
| | | "TargetName" = "8:4.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_88E7511A43901EA2B6A0F12EFF6661FE" |
| | | { |
| | | "SourcePath" = "8:opencv_world455d.dll" |
| | | "TargetName" = "8:opencv_world455d.dll" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:TRUE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9C2903892F75438A93E871FCBEE63F64" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\0.jpg" |
| | | "TargetName" = "8:0.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A97D149608C6FC6837656B6A20636018" |
| | | { |
| | | "SourcePath" = "8:ucrtbased.dll" |
| | | "TargetName" = "8:ucrtbased.dll" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:TRUE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_AE34DBC834BB4449BBC2B271E254C7A6" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\3.jpg" |
| | | "TargetName" = "8:3.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B2FE9BF17B184AC3AA5DE56E90E5B4D4" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\7.jpg" |
| | | "TargetName" = "8:7.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BA75A8E7417B4D2EA41274186453503B" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\2.jpg" |
| | | "TargetName" = "8:2.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C17AB50E1DB64DD886A92258E22666AB" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\5.jpg" |
| | | "TargetName" = "8:5.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C66FAF78BCF6A56F539A77AFF5C1932B" |
| | | { |
| | | "SourcePath" = "8:MSVCP140D.dll" |
| | | "TargetName" = "8:MSVCP140D.dll" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:TRUE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CF6C4192145E4E3D89AE201DD90C0344" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\6.jpg" |
| | | "TargetName" = "8:6.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D16635DC601141C6B54AD8B57638A5C3" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\7.jpg" |
| | | "TargetName" = "8:7.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D8865CD9923A459A9A6208F38F20CDCD" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number\\5.jpg" |
| | | "TargetName" = "8:5.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_E88AC1DD7E4A494ABA9A6DDD5FF55D85" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\2.jpg" |
| | | "TargetName" = "8:2.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F822A8A90E9545F281B4F27E204428FD" |
| | | { |
| | | "SourcePath" = "8:C:\\Users\\Administrator\\Desktop\\ocr\\number_2\\0.jpg" |
| | | "TargetName" = "8:0.jpg" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_BB92469622F74DDAB8178CC7573846B4" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Vital" = "11:TRUE" |
| | | "ReadOnly" = "11:FALSE" |
| | | "Hidden" = "11:FALSE" |
| | | "System" = "11:FALSE" |
| | | "Permanent" = "11:FALSE" |
| | | "SharedLegacy" = "11:FALSE" |
| | | "PackageAs" = "3:1" |
| | | "Register" = "3:1" |
| | | "Exclude" = "11:FALSE" |
| | | "IsDependency" = "11:FALSE" |
| | | "IsolateTo" = "8:" |
| | | } |
| | | } |
| | | "FileType" |
| | | { |
| | |
| | | "Property" = "8:TARGETDIR" |
| | | "Folders" |
| | | { |
| | | "{9EF0B969-E518-4E46-987F-47570745A589}:_4AFE9549B8C04770B2CCD757B41674EC" |
| | | { |
| | | "Name" = "8:sample" |
| | | "AlwaysCreate" = "11:FALSE" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Property" = "8:_B86AC76C18DB432F887197F02225EB49" |
| | | "Folders" |
| | | { |
| | | "{9EF0B969-E518-4E46-987F-47570745A589}:_6BAF7DBFA9254068870E2F9A5C1B6FA6" |
| | | { |
| | | "Name" = "8:number" |
| | | "AlwaysCreate" = "11:FALSE" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Property" = "8:_8503FA8F2867484F935C43C6236EAC67" |
| | | "Folders" |
| | | { |
| | | } |
| | | } |
| | | "{9EF0B969-E518-4E46-987F-47570745A589}:_BB92469622F74DDAB8178CC7573846B4" |
| | | { |
| | | "Name" = "8:number_2" |
| | | "AlwaysCreate" = "11:FALSE" |
| | | "Condition" = "8:" |
| | | "Transitive" = "11:FALSE" |
| | | "Property" = "8:_66ED54EA786A4ECEA20A64F2FC6AE4D3" |
| | | "Folders" |
| | | { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | "Name" = "8:Microsoft Visual Studio" |
| | | "ProductName" = "8:Setup1" |
| | | "ProductCode" = "8:{AD2DB9B9-91FB-4E17-ABA5-8C2DB663ACE2}" |
| | | "PackageCode" = "8:{C8A9BE85-64EF-4848-BAE4-2A32526610BB}" |
| | | "PackageCode" = "8:{3E19DE8D-D11F-4C90-8773-3DFBCC841BEE}" |
| | | "UpgradeCode" = "8:{746B406D-2250-4EC9-AC73-44489EBE2279}" |
| | | "AspNetVersion" = "8:2.0.50727.0" |
| | | "RestartWWWService" = "11:FALSE" |
| | |
| | | } |
| | | "ProjectOutput" |
| | | { |
| | | "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_70406436BEFE4ABC91B3ABD8FCAE4557" |
| | | "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_33C1D8724B6F4CAB8E73371F11AE6CEF" |
| | | { |
| | | "SourcePath" = "8:..\\x64\\Debug\\ConsoleApplication.exe" |
| | | "SourcePath" = "8:..\\x64\\Debug\\CaptureRec.exe" |
| | | "TargetName" = "8:" |
| | | "Tag" = "8:" |
| | | "Folder" = "8:_ED2E18F7F28640CFB945EC6F442FEA76" |
| | |
| | | return toJsonStr(root); |
| | | } |
| | | |
| | | |
| | | static std::string loadTradeQueueData(int clientID, int channel, string code, std::list<int> numList) { |
| | | Json::Value data; |
| | | data["channel"] = channel; |
| | | data["code"] = code; |
| | | |
| | | Json::Value _data; |
| | | |
| | | std::list<int>::iterator ele; |
| | | int index = 0; |
| | | for (ele = numList.begin();ele != numList.end();ele++) { |
| | | _data[index++] = *ele; |
| | | } |
| | | data["data"] = _data; |
| | | Json::Value root; |
| | | root["type"] = 3; |
| | | root["client"] = clientID; |
| | | root["data"] = data; |
| | | return toJsonStr(root); |
| | | } |
| | | |
| | | static std::string loadLimitUpData(list<LimitUpData> dataList) { |
| | | Json::Value root; |
| | | root["type"] = 2; |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | } |
| | |
| | | app->socketManager->Connect(index); |
| | | } |
| | | cout<<"*****数据处理时间:"<<(clock()- time_start)<<endl; |
| | | } |
| | | } |
| | | |
| | | void CappDlg::OnTradeQueueDataCallback(int index, string code, list<int> numList, void* context) { |
| | | //转为json |
| | | CappDlg* app = (CappDlg*)context; |
| | | //cout << "回调:" << std::this_thread::get_id() << ":" << index << endl; |
| | | CButton* btn = (CButton*)app->GetDlgItem(IDC_CHECK1); |
| | | bool check = btn->GetCheck(); |
| | | if (check) { |
| | | string data = JsonUtil::loadTradeQueueData(0, index, code, numList); |
| | | clock_t time_start = clock(); |
| | | try { |
| | | app->socketManager->sendMsg(index, data.c_str()); |
| | | } |
| | | catch (string st) { |
| | | //重新连接服务器 |
| | | app->socketManager->resetClient(index); |
| | | app->socketManager->Connect(index); |
| | | } |
| | | cout << "*****数据处理时间:" << (clock() - time_start) << endl; |
| | | } |
| | | } |
| | | |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback,OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | |
| | | void OnDataCallback(int index, list<TradeData> dataList); |
| | | static void OnL2DataCallback(int index,string code, list<TradeData> dataList, void* context); |
| | | static void OnTradeQueueDataCallback(int index, string code, list<int> numList, void* context); |
| | | static void OnLimitUpDataCallback(list<LimitUpData> dataList, void* context); |
| | | static bool OnActionCallback(string data, void* context); |
| | | |