// Calculate the similarity between two images; float ReidDescriptor::onebyone(cv::Mat img1, cv::Mat img2) { int H = 80; int W = 64; // 128 & 128 /!\ cv::resize(img1, img1, cv::Size(W, H), CV_BILATERAL); cv::resize(img2, img2, cv::Size(W, H), CV_BILATERAL); cv::Mat MAP_KRNL_1, MAP_KRNL_2; int HDanti_1, TLanti_1, HDanti_2, TLanti_2; MAP_KRNL_1 = map_kernel(img1, H / 4, W / 4, 0.5, W / 5, H, W, TLanti_1, HDanti_1); MAP_KRNL_2 = map_kernel(img2, H / 4, W / 4, 0.5, W / 5, H, W, TLanti_2, HDanti_2); vector<int> NBINs; NBINs.push_back(16); NBINs.push_back(16); NBINs.push_back(4); cv::Mat Whsv1 = Whsv_estimation(img1, NBINs, MAP_KRNL_1, HDanti_1, TLanti_1); cv::Mat Whsv2 = Whsv_estimation(img2, NBINs, MAP_KRNL_2, HDanti_2, TLanti_2); //ReidDescriptor::drawHist(Whsv1); //ReidDescriptor::drawHist(Whsv2); //vector<float> www1 = Whsv1; //vector<float> www2 = Whsv2; float d = bhattacharyya(Whsv1, Whsv2); return d; }
/** * Create a new task * @author Ivan Gualandri * @version 1.0 * @param task_name The name of the task * @param start_function the entry point of the task. */ pid_t new_task(char *task_name, void (*start_function)()){ asm("cli"); task_t *new_task; table_address_t local_table; unsigned int new_pid = request_pid(); new_task = (task_t*)kmalloc(sizeof(task_t)); strcpy(new_task->name, task_name); new_task->next = NULL; new_task->start_function = start_function; new_task->cur_quants=0; new_task->pid = new_pid; new_task->eip = (unsigned int)start_function; new_task->esp = (unsigned int)kmalloc(STACK_SIZE) + STACK_SIZE-100; new_task->tty = tty_get_current(); dbg_bochs_print(new_task->esp); new_task->status = NEW; new_task->registers = (task_register_t*)new_task->esp; new_tss(new_task->registers, start_function); local_table = map_kernel(); new_task->pdir = local_table.page_dir; new_task->ptable = local_table.page_table; //new_task->pdir = 0; //new_task->ptable = 0; enqueue_task(new_task->pid, new_task); //(task_list.current)->cur_quants = MAX_TICKS; asm("sti"); return new_pid; }
/** * Create a new task * @author Ivan Gualandri * @version 1.0 * @param task_name The name of the task * @param start_function the entry point of the task. */ pid_t new_task(char *task_name, void (*start_function)()){ asm("cli"); task_t new_task; table_address_t local_table; unsigned int new_pid = request_pid(); strcpy(new_task.name, task_name); new_task.start_function = start_function; new_task.pid = new_pid; new_task.eip = (unsigned int)start_function; new_task.esp = (unsigned int) kmalloc(STACK_SIZE) + STACK_SIZE - 100; new_task.state = READY; new_task.registers = (task_register_t*)new_task.esp; new_tss(new_task.registers, start_function); local_table = map_kernel(); new_task.pdir = local_table.page_dir; new_task.ptable = local_table.page_table; add_task(new_task.pid, &new_task); asm("sti"); return new_pid; }