| | |
| | | if (kill) |
| | | break; |
| | | if (tradeTimeCapture) { |
| | | if (!GPUtil::isPreTradeTime()) { |
| | | if (!GPUtil::isTradeTime()) { |
| | | Sleep(100); |
| | | continue; |
| | | } |
| | |
| | | thread rt(&(CurrentPriceCapture::_run)); |
| | | rt.detach(); |
| | | inited = true; |
| | | try { |
| | | refreshHWND(); |
| | | } |
| | | catch (string st) { |
| | | |
| | | } |
| | | } |
| | | void CurrentPriceCapture::reCreateRunning() |
| | | { |
| | |
| | | list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg); |
| | | |
| | | //每行的元素个数 |
| | | int ele_count_per_line = 2; |
| | | int ele_count_per_line = 3; |
| | | int length_per_num = 6; |
| | | int* splitResult = (int*)malloc(sizeof(int) * 4 * 4 * rowData.size()); |
| | | int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | int count = 0; |
| | |
| | | count++; |
| | | } |
| | | |
| | | int line_number_count = ele_count_per_line * 6; |
| | | int line_number_count = ele_count_per_line * length_per_num; |
| | | |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line,1,2,splitResult); |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line,1,3,splitResult); |
| | | |
| | | /* |
| | | *测试 |
| | |
| | | |
| | | |
| | | UcharDataInfo typesData = UcharDataInfo(); |
| | | unsigned char types[] = { NUM_TYPE_CODE, NUM_TYPE_PRICE }; |
| | | typesData.length = 2; |
| | | unsigned char types[] = { NUM_TYPE_MONEY, NUM_TYPE_CODE, NUM_TYPE_PRICE }; |
| | | typesData.length = 3; |
| | | typesData.data = types; |
| | | int length_per_num = 6; |
| | | 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, length_per_num); |
| | | |
| | | |
| | |
| | | list<CurrentPriceData> dataList; |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | CurrentPriceData currentData = CurrentPriceData(); |
| | | string code = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | |
| | | string volumn = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][j])); |
| | | if (j == 4) { |
| | | volumn.append("."); |
| | | } |
| | | volumn.append(to_string(numberResult[i][length_per_num * 0 + j])); |
| | | } |
| | | |
| | | string code = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][length_per_num * 1 + j])); |
| | | } |
| | | |
| | | string price = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | if (j == 4) { |
| | | price.append("."); |
| | | } |
| | | price.append(to_string(numberResult[i][6 * 1 + j])); |
| | | price.append(to_string(numberResult[i][length_per_num * 2 + j])); |
| | | } |
| | | |
| | | currentData.index = i; |
| | | currentData.code = code; |
| | | |
| | | currentData.volumn = volumn; |
| | | currentData.price = price; |
| | | if ( currentData.price != "0000.00") { |
| | | dataList.push_back(currentData); |
| | |
| | | } |
| | | free(numberResult); |
| | | int* unitData = (int*)malloc(sizeof(int) * 4 * dataList.size()); |
| | | //获取量的单位 |
| | | int index = 0; |
| | | for (list<CurrentPriceData>::iterator ele = dataList.begin();ele != dataList.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]; |
| | | index++; |
| | | } |
| | | int* unitResult = (int*)malloc(sizeof(int) * dataList.size()); |
| | | openCLExcuter->recognitionPlateMoneyUnit(grayImg.data, grayImg.cols, grayImg.rows, unitData, 1, dataList.size(), unitResult); |
| | | index = 0; |
| | | for (list<CurrentPriceData>::iterator ele = dataList.begin();ele != dataList.end();ele++) { |
| | | switch (unitResult[index]) |
| | | { |
| | | case 0: |
| | | (*ele).volumnUnit = MONEY_UNIT_Y; |
| | | break; |
| | | case 1: |
| | | (*ele).volumnUnit = MONEY_UNIT_W; |
| | | break; |
| | | case 2: |
| | | (*ele).volumnUnit = MONEY_UNIT_NO; |
| | | (*ele).volumn = to_string((int)round( stof((*ele).volumn) * 100)); |
| | | default: |
| | | break; |
| | | } |
| | | //cout<< (*ele).code<<" "<< (*ele).price <<" "<< (*ele).volumn; |
| | | //if ((*ele).volumnUnit == MONEY_UNIT_Y) { |
| | | // cout <<"亿"<<endl; |
| | | //}else if ((*ele).volumnUnit == MONEY_UNIT_W) { |
| | | // cout << "万" << endl; |
| | | //} |
| | | //else { |
| | | // cout << "" << endl; |
| | | //} |
| | | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | free(rowIndex); |
| | | free(splitResult); |
| | | free(zeroData); |
| | | free(templateNums); |
| | | free(unitData); |
| | | free(unitResult); |
| | | free(imgData); |
| | | |
| | | grayImg.release(); |