|
|
|
|
|
|
|
|
currentState = &State::Idle::getInstance(); |
|
|
currentState = &State::Idle::getInstance(); |
|
|
currentState->enter(this); |
|
|
currentState->enter(this); |
|
|
|
|
|
|
|
|
//Start the permanent loop |
|
|
|
|
|
char input; |
|
|
|
|
|
std::cout << "press q to quit" << std::endl; |
|
|
|
|
|
std::cin >> input; |
|
|
|
|
|
std::cout << "binned" << std::endl; |
|
|
|
|
|
while (input != 'q') |
|
|
|
|
|
|
|
|
cv::VideoWriter writer = cv::VideoWriter("video_200.avi", cv::VideoWriter::fourcc('M','J','P','G'), 4.0, cv::Size(videoWidth, videoHeight), true); |
|
|
|
|
|
|
|
|
|
|
|
auto t_start = std::chrono::high_resolution_clock::now(); |
|
|
|
|
|
auto t_end = std::chrono::high_resolution_clock::now(); |
|
|
|
|
|
double dur = std::chrono::duration<double, std::milli>(t_end-t_start).count(); |
|
|
|
|
|
|
|
|
|
|
|
while(dur < 60000) |
|
|
{ |
|
|
{ |
|
|
std::cin >> input; |
|
|
|
|
|
std::cout << "binned" << std::endl; |
|
|
|
|
|
|
|
|
t_end = std::chrono::high_resolution_clock::now(); |
|
|
|
|
|
dur = std::chrono::duration<double, std::milli>(t_end-t_start).count(); |
|
|
|
|
|
{ |
|
|
|
|
|
this_thread::sleep_for(std::chrono::milliseconds(50)); |
|
|
|
|
|
std::unique_lock<std::mutex> lock(imgMutex); |
|
|
|
|
|
if(!this->image.empty()) |
|
|
|
|
|
{ |
|
|
|
|
|
writer.write(this->image); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
writer.release(); |
|
|
std::cout << "Exiting central" << std::endl; |
|
|
std::cout << "Exiting central" << std::endl; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double delta = static_cast<double>(deltaMs) / 1000.0; |
|
|
double delta = static_cast<double>(deltaMs) / 1000.0; |
|
|
double frameRate = 1.0 / static_cast<double>(delta);*/ |
|
|
double frameRate = 1.0 / static_cast<double>(delta);*/ |
|
|
double frameRate = -1.0; |
|
|
double frameRate = -1.0; |
|
|
|
|
|
{ |
|
|
|
|
|
std::unique_lock<std::mutex> lock(imgMutex); |
|
|
|
|
|
image = result.rawImage; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (result.validLane) |
|
|
if (result.validLane) |
|
|
{ |
|
|
{ |