int main(int argc, char** argv) { if (argc != 2) { std::cerr << "Usage: " << argv[0] << " path/to/lena" << std::endl; exit(1); } cv::Mat image, orig, lena, noize, diag, tool; image = cv::imread(argv[1], 1); diag = cv::imread(DIAG, CV_LOAD_IMAGE_GRAYSCALE); orig = cv::imread(ORIG, CV_LOAD_IMAGE_GRAYSCALE); lena = cv::imread(LENA, 1); noize = cv::imread(NOIZE, 1); tool = cv::imread(TOOL, CV_LOAD_IMAGE_GRAYSCALE); std::cout << "Task 1 Status: " << (task1(image) ? "OK" : "Error") << std::endl; std::cout << "Task 2 Status: " << (task2(image) ? "OK" : "Error") << std::endl; std::cout << "Task 3 Status: " << (task3(image) ? "OK" : "Error") << std::endl; std::cout << "Task 4 Status: " << (task4(image) ? "OK" : "Error") << std::endl; std::cout << "Task 5 Status: " << (task5((PATH + "noize/").c_str()) ? "OK" : "Error") << std::endl; std::cout << "Task 6 Status: " << (task6(image) ? "OK" : "Error") << std::endl; std::cout << "Task 3.1 Status: " << (task3_1(orig) ? "OK" : "Error") << std::endl; std::cout << "Task 3.2 Status: " << (task3_2(orig) ? "OK" : "Error") << std::endl; std::cout << "Task 3.3 Status: " << (task3_3(tool) ? "OK" : "Error") << std::endl; std::cout << "Task 3.5 Status: " << (task3_5(diag, orig) ? "OK" : "Error") << std::endl; std::cout << "Task 3.6 Status: " << (task3_6(lena, noize) ? "OK" : "Error") << std::endl; // cv::namedWindow("Lesson 2", CV_WINDOW_NORMAL); // cv::imshow("Lesson 2", image); // cv::waitKey(0); return 0; }
// // a task gets dispatched on every tick_flag tick (10ms) // void task_dispatch(void) { /* scan the task bits for an active task and execute it */ char task; /* take care of the task timers. if the value ==0 skip it else decrement it. If it decrements to zero, activate the task associated with it */ task=0; while (task < NUM_TASKS ) { if (task_timers[task]) { task_timers[task]--; /* dec the timer */ if (task_timers[task] == 0 ) { set_task(task); /* if ==0 activate the task bit */ } } task++; } task = 0; /* start at the most significant task */ while (task <= NUM_TASKS ) { if ((task_bits & pgm_read_byte(&bit_mask[task]))) { break; /* if activate task found..*/ } task++; /* else try the next one */ } switch(task) /* if task bit is active..execute the task */ { case 0: task0(); break; case 1: task1(); break; case 2: task2(); break; case 3: task3(); break; case 4: task4(); break; case 5: task5(); break; case 6: task6(); break; case 7: task7(); break; default: break; /* no task was active!! */ } }