vector<Placa> RegionPlaca::run(Mat input){ //Segment image by white vector<Placa> tmp = segmento(input); //return detected and posibles regions return tmp; }
t_msg_id destruirSegmento(uint32_t pid, uint32_t baseSegmento) { char *stringPID = string_uitoa(pid); t_segmento* tabla = tablaDelProceso(stringPID); uint16_t numeroSegmento = segmento(baseSegmento); if(tabla && segmentoValido(tabla, numeroSegmento)) { char *shellInstruction; int pag,cantPagEnMemoria; uint16_t cantPaginas = cantidadPaginasTotalDelSegmento(tabla, numeroSegmento); for (cantPagEnMemoria = 0, pag = 0; pag < cantPaginas; ++pag) if (paginaEnMemoria(tabla, numeroSegmento, pag)) { ++cantPagEnMemoria; ++CantPaginasEnMemoriaDisponibles; liberarMarco(tabla, numeroSegmento, pag); QuitarDeEstructuraDeSeleccion(pid, numeroSegmento, pag); pthread_mutex_lock(&LogMutex); log_trace(Logger, "Marco %u desasignado al proceso %u.", marcoDePagina(tabla, numeroSegmento, pag), pid); pthread_mutex_unlock(&LogMutex); } /* Borra todas las páginas swappeadas del segmento */ if (cantPagEnMemoria < cantPaginas) { shellInstruction = string_from_format("cd %s\nrm -f %s-%u-*", SWAP_PATH, stringPID, numeroSegmento); system(shellInstruction); free(shellInstruction); } CantPaginasDisponibles += cantPaginas; CantPaginasEnSwapDisponibles += cantPaginas - cantPagEnMemoria; free(tabla[numeroSegmento].tablaPaginas); tabla[numeroSegmento].limite = 0; //if(baseSegmento == 0) /* Si es el segmento de código, se elimina el proceso de la tabla */ //dictionary_remove(TablaSegmentosGlobal,stringPID); free(stringPID); } else return INVALID_DIR; return OK_DESTROY; }
string OCR::run(Placa *input){ //Segment chars of plate vector<SegmentoLetra> segmentos = segmento(*input); cout << "Numero de letras: "<<segmentos.size() << endl; for (int i = 0; i<segmentos.size(); i++){ //Preprocess each char for all images have same sizes Mat ch = preprocesamientoCaracter(segmentos[i].imagen); if (saveSegments){ stringstream ss(stringstream::in | stringstream::out); ss << "tmpChars/" << nombreArchivo << "_" << i << ".jpg"; imwrite(ss.str(), ch); } //For each segment Extract Features Mat f = caracteristicas(ch, 15); //For each segment feature Classify int character = clasificacion(f); input->letras.push_back(Caracteres[character]); input->posLetras.push_back(segmentos[i].posicion); } return "-";//input->str(); }