int main(int argc, const char *argv[]) { test_t tests[] = { {"test_sample", test_sample}, }; return t_run(tests); }
void CSpotsMainDlg::OnBnClickedMainDingbiao() { if (DingBiaoFlag) { SetDlgItemText(IDC_MAIN_DINGBIAO, L"结束定标"); p_contrller->biaoDingExitFlag = true; std::thread t_run(std::mem_fn(&CSpotsMainDlg::biaodingDispThread), this); t_run.detach(); DingBiaoFlag = false; } else { SetDlgItemText(IDC_MAIN_DINGBIAO, L"开始定标"); p_contrller->biaoDingExitFlag = false; DingBiaoFlag = true; } }
void ControllerDirectRead::triggerWatcherThread() { double t = cv::getTickCount(); double tiggerTimeSpan = cv::getTickCount(); while (!ExitFlag) { if (PauseFlag)//暂停标志 { Sleep(50); continue; } if (pci1761.GetRisingEdgeIDI(7))//上升沿开始采图 //if (pci1761.GetTrailingEdgeIDI(7))//下降沿开始采图 { if (1 == 1) { t = cv::getTickCount(); tiggerTimeSpan = (cv::getTickCount() - tiggerTimeSpan) * 1000 / cv::getTickFrequency(); stringstream ss; ss << "\r\n\r\n与上次触发间隔Timespan:" << tiggerTimeSpan << "ms" << endl; tiggerTimeSpan = cv::getTickCount(); MFCConsole::Output(ss.str()); } //触发编号 Statistics::TodayTiggerIndex++; int SN = Statistics::TodayTiggerIndex; //启动面阵模块 if (P_mainHueScanner != NULL) { P_mainHueScanner->Run(SN); } //触发后线阵等待时间 if (Capture_WaitTimeMSIn > 0) { #ifdef Controller_DEBUG stringstream ss; double tSleep = (double)cv::getTickCount(); #endif //触发后,等待砖进入拍摄区。 //Sleep(globle_var::TiggerCaptureWaitTimeMS); std::this_thread::sleep_for(chrono::milliseconds(Capture_WaitTimeMSIn)); #ifdef Controller_DEBUG tSleep = ((double)cv::getTickCount() - tSleep) * 1000 / cv::getTickFrequency(); stringstream ss; ss << "Capture_WaitTimeMSIn Sleep real(ms):" << tSleep << endl; printf_globle(ss.str()); #endif } //开始采图 if (!captureIsRunning) { std::thread t_run(std::mem_fn(&ControllerDirectRead::captureAndProcessThread), this, SN); //auto tn = t_run.native_handle(); //SetThreadPriority(tn, THREAD_PRIORITY_ABOVE_NORMAL); t_run.detach(); } else { stringstream ss; ss << " 触发后不响应,采图正在进行中 captureIsRunning = 1 ,still running capture();" << endl; MFCConsole::Output(ss.str()); } //PauseFlag == 1; } if (pci1761.GetTrailingEdgeIDI(7)) { //暂停面阵模块运行 if (P_mainHueScanner != NULL) { P_mainHueScanner->Pause(); } } Sleep(10); } }