| | |
| | | #include <log4cpp/PatternLayout.hh> |
| | | #include "TradeQueueCaptureManager.h" |
| | | #include "LogUtil.h" |
| | | #include "L2TradeQueueUtil.h" |
| | | using namespace log4cpp; |
| | | |
| | | void gray(); |
| | |
| | | ImgUtil::init(); |
| | | OpenCLExcuter* openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | L2DataCapture* l2DataCapture = new L2DataCapture(); |
| | | try { |
| | | ; |
| | | // l2DataCapture->init(NULL, NULL, NULL); |
| | | cv::Mat img = cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\order_origin.jpg"); |
| | | uchar* datas = (uchar*)malloc(sizeof(uchar) * img.rows * img.cols); |
| | | if (img.channels() == 4) |
| | | { |
| | | openCLExcuter->rgba2Gray(img, datas); |
| | | } |
| | | catch (...) { |
| | | else { |
| | | openCLExcuter->rgb2Gray(img,datas); |
| | | } |
| | | |
| | | } |
| | | |
| | | void grayImg() { |
| | | ImgUtil::init(); |
| | | OpenCLExcuter* openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | cv::Mat img = cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\l2_trade_queue_2.png"); |
| | | uchar* datas = (uchar*)malloc(sizeof(uchar) * img.rows * img.cols); |
| | | if (img.channels() == 4) |
| | | { |
| | | openCLExcuter->rgba2Gray(img, datas); |
| | | } |
| | | else { |
| | | openCLExcuter->rgb2Gray(img, datas); |
| | | } |
| | | cv::Mat img1 = cv::Mat::zeros(img.rows, img.cols, CV_8UC1); |
| | | img1.data = datas; |
| | | |
| | | cv::Mat binary; |
| | | threshold(img1, binary, 96, 255, cv::THRESH_BINARY); |
| | | |
| | | cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\l2_trade_queue_gray.png", img1); |
| | | |
| | | } |
| | | |
| | | void testSplit() { |
| | | |
| | | ImgUtil::init(); |
| | | L2TradeQueueUtil::splitElements(cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\l2_trade_queue_2.png", cv::IMREAD_GRAYSCALE)); |
| | | } |
| | | |
| | | void testCaptureL2Trade() { |
| | | ImgUtil::init(); |
| | | OpenCLExcuter* openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | L2DataCapture *capture = new L2DataCapture(); |
| | | HWND win = THSActionUtil::getL2Win(); |
| | | CaptureUtil::init(win); |
| | | |
| | | while (TRUE) |
| | | { |
| | | //cv::Mat img = cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\l2_trade_queue_2_2.png"); |
| | | cv::Mat img = CaptureUtil::capture(0, CAPTURE_TYPE_TRADE_QUEUE); |
| | | L2TradeQueue tradeQueue = capture->captureLevel2TradeQueueData(openCLExcuter, img, 0); |
| | | printf("\n"); |
| | | Sleep(10); |
| | | } |
| | | } |
| | | |
| | | cv::Mat mat; |
| | | void testCaptureL2TradeQueue() { |
| | | ImgUtil::init(); |
| | | L2DataCapture* capture = new L2DataCapture(); |
| | | capture->init(NULL,NULL,NULL); |
| | | capture->setGPCode(0,"000610"); |
| | | capture->startAll(); |
| | | while (TRUE) { |
| | | Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | void testDelegate() { |
| | | ImgUtil::init(); |
| | | TradeListCapture* capture = new TradeListCapture(); |
| | | capture->init(NULL,NULL,NULL); |
| | | cv::Mat oimg = cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\trade\\Snipaste_2022-12-23_09-42-19.png"); |
| | | capture->captureSimpleTradeDelegateInfo(oimg); |
| | | } |
| | | |
| | | void testTradeSuccess() { |
| | | ImgUtil::init(); |
| | | TradeListCapture* capture = new TradeListCapture(); |
| | | capture->init(NULL, NULL, NULL); |
| | | capture->captureTradeSuccessInfo(cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\trade\\Snipaste_2022-12-23_09-39-02.png")); |
| | | } |
| | | |
| | | |
| | | int main() { |
| | | //grayImg(); |
| | | testTradeSuccess(); |
| | | return 1; |
| | | //testL2(); |
| | | //if (TRUE) { |
| | | // return 0; |
| | | //} |
| | | |
| | | if (TRUE) { |
| | | return 0; |
| | | } |
| | | |
| | | //Win32Util::moveWin(HWND(0x000508D8), 0, 0, 1920, 1080); |
| | | //return 0; |
| | | cout << "开始程序" << endl; |
| | | ImgUtil::init(); |
| | | THSActionUtil::updateMainSite(); |
| | | TradeQueueCaptureManager *manager = new TradeQueueCaptureManager(); |
| | | manager->init(NULL, NULL); |
| | | manager->start(); |
| | | TradeListCapture *manager = new TradeListCapture(); |
| | | manager->init(NULL, NULL,NULL); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | manager->captureTradeSuccessInfo(); |
| | | Sleep(2000); |
| | | } |
| | | //TradeQueueCapture* manager = new TradeQueueCapture(); |
| | | //manager->recognition_buy_1_volumn(HWND(0x00020F28)); |
| | | |