int MosMain(void) { MIL_ID MilApplication, /* Application identifier. */ MilSystem, /* System identifier. */ MilDisplay, /* Display identifier. */ MilImage; /* Image buffer identifier. */ /* Allocate a default MIL application, system, display and image. */ MappAllocDefault(M_SETUP, &MilApplication, &MilSystem, &MilDisplay, M_NULL, &MilImage); /* If no allocation errors. */ if (!MappGetError(M_GLOBAL, M_NULL)) { /* Perform graphic operations in the display image. */ MgraColor(M_DEFAULT, 0xF0); MgraFont(M_DEFAULT, M_FONT_DEFAULT_LARGE); MgraText(M_DEFAULT, MilImage, 160L, 230L, MIL_TEXT(" Welcome to MIL !!! ")); MgraColor(M_DEFAULT, 0xC0); MgraRect(M_DEFAULT, MilImage, 100L, 150L, 530L, 340L); MgraRect(M_DEFAULT, MilImage, 120L, 170L, 510L, 320L); MgraRect(M_DEFAULT, MilImage, 140L, 190L, 490L, 300L); /* Print a message. */ MosPrintf(MIL_TEXT("\nSYSTEM ALLOCATION:\n")); MosPrintf(MIL_TEXT("------------------\n\n")); MosPrintf(MIL_TEXT("System allocation successful.\n\n")); MosPrintf(MIL_TEXT(" \"Welcome to MIL !!!\"\n\n")); } else MosPrintf(MIL_TEXT("System allocation error !\n\n")); /* Wait for a key press. */ MosPrintf(MIL_TEXT("Press <Enter> to end.\n")); MosGetch(); /* Free defaults. */ MappFreeDefault(MilApplication, MilSystem, MilDisplay, M_NULL, MilImage); return 0; }
// Muestra un rectangulo en el overlay teniendo en cuenta el factor de zoom void ControlImagenes::DibujaRect(CPoint& point_inicial, CPoint& point_final, double color) { // MdispOverlayKey(m_Mildisplay, M_KEY_ON_COLOR, M_EQUAL, 0xff, TRANSPARENTE); //MdispControl(m_Mildisplay, M_KEY_MODE, M_KEY_ON_COLOR); ///*pruebas MIL 8*/ MdispControl(m_Mildisplay, M_TRANSPARENT_COLOR, TRANSPARENTE); muestra_punto(point_inicial.x,point_inicial.y, 3, TRANSPARENTE,0); // borramos el punto inicial // MbufGet2d(M_overlay_normal,pos_x,pos_y,1,1, valor_pixel); // muestra_punto(point_final.x,point_final.y, 3, color,0); MgraColor(M_DEFAULT, color); // MgraControl(M_DEFAULT, M_COLOR, M_RGB888(255,0,0) & M_RED); // MgraControl(M_DEFAULT, M_COLOR, M_RGB888(0,255,0) & M_GREEN); // MgraControl(M_DEFAULT, M_COLOR, M_RGB888(0,0,255) & M_BLUE); //Por duplicado para que se vea cuando el factor de zoom sea negativo (display mas pequeño) MgraRect(M_DEFAULT, M_overlay_normal, point_inicial.x, point_inicial.y, point_final.x, point_final.y); MgraRect(M_DEFAULT, M_overlay_normal, point_inicial.x+1, point_inicial.y+1, point_final.x+1, point_final.y+1); /* MgraRect(M_DEFAULT, M_overlay_normal, point_inicial.x-1, point_inicial.y-1, point_final.x-1, point_final.y-1); MgraRect(M_DEFAULT, M_overlay_normal, point_inicial.x+2, point_inicial.y+2, point_final.x+2, point_final.y+2); MgraRect(M_DEFAULT, M_overlay_normal, point_inicial.x-2, point_inicial.y-2, point_final.x-2, point_final.y-2); */ }
/**************************************************************************** Escibe en consola el menu para la TomaUnica Espera una tecla y la devuelve. Tambien devuelve la posicion cuando la tecla fue pulsada AUXILIAR *****************************************************************************/ int menuTomaUnica(point& punto) { char mensaje[LONGITUD_TEXTO*2]; sprintf(mensaje,"\n+- TOMA UNICA ------------------------------------------+"); strcat(mensaje, "\n| Posiciónese en la zona donde quiera tomar las imagenes |"); strcat(mensaje, "\n| Presione [A] para realizar enfoque automatico |"); strcat(mensaje, "\n| Presione [ENTER] proceder a la toma sin autoenfoque |"); strcat(mensaje, "\n| [Esc] - Para salir de la aplicacion |"); strcat(mensaje, "\n+----------------------------------------------------------+\n"); CharToOem(mensaje,mensaje); printf(mensaje); int tecla; bool bDefiniendoArea = false; float x = 0; float y = 0; do{ tecla = pideP(&punto); if (tecla == ' ') { // Establecimiento de areas/areas de interes mediante raton POINT cursorPos; GetCursorPos(&cursorPos); if (bDefiniendoArea) { muestra_pixel(x,y,NULL,1); //borramos el punto inicial MgraColor(M_DEFAULT, M_COLOR_YELLOW); MgraRect(M_DEFAULT, M_overlay_normal, x, y, cursorPos.x, cursorPos.y); } else { x = cursorPos.x; y = cursorPos.y; /* // Control de posicionamiento fuera de ventana // Funciona pero no esta en uso long x_offset= -1,y_offset = -1, size_x = -1, size_y = -1; MdispInquire(M_display_resul, M_WINDOW_OFFSET_X, &x_offset); MdispInquire(M_display_resul, M_WINDOW_OFFSET_Y, &y_offset); MdispInquire(M_display_resul, M_SIZE_X, &size_x); MdispInquire(M_display_resul, M_SIZE_Y, &size_y); if (x<x_offset || x>x_offset+size_x || y<y_offset || y>y_offset+size_y ) { //mouse fuera de la ventana printf("Atencion: mouse fuera de la ventana\r"); } else { muestra_pixel(x-x_offset,y-y_offset,ROJO,0); }*/ muestra_pixel(x,y,ROJO,0); } bDefiniendoArea = !bDefiniendoArea; } else if (bDefiniendoArea == true) { muestra_pixel(x,y,NULL,1); //borramos el punto inicial } } while (tecla != K_ESC && tecla != 'a' && tecla != 'A' && tecla != K_CR); return tecla; }
void muestra_aoi(parametros& param) { MgraColor(M_DEFAULT, M_COLOR_YELLOW); MgraRect(M_DEFAULT, M_overlay_normal, param.Cam.anchoImagen/2 - m_nAnchoAOI/2, param.Cam.altoImagen/2 - m_nAnchoAOI/2, param.Cam.anchoImagen/2 + m_nAnchoAOI/2, param.Cam.altoImagen/2 + m_nAnchoAOI/2); }