#ifndef MAIN_H #define MAIN_H #define PROG_NAME "Prototipo alinhamento" #define PROG_DESC "Prototipo de software para alinhamento de imagem 2d com modelos 3d" #define PROG_VERS "1.0" /* Last edited on 2017-06-22 18:32:15 by stolfilocal */ #define PROG_HELP \ " " PROG_NAME " \\\n" \ " -op {OP} \\\n" \ " " argparser_help_info_HELP " \\\n" \ " {IMAGEM_ENT_1} {IMAGEM_ENT_2} \\\n" \ " > {IMAGEM_SAI}" #define PROG_INFO \ "NOME\n" \ " " PROG_NAME " - " PROG_DESC "\n" \ "\n" \ "SINOPSE\n" \ PROG_HELP "\n" \ "\n" \ "DESCRICAO\n" \ " O programa l�duas imagens, {IMAGEM_ENT_1} e {IMAGEM_ENT_1}, e" \ " aplica a elas uma opera�o especificada pelo usu�io. A imagem" \ " resultante �gravada na sa�a padr� {stdout}.\n" \ "\n" \ "OP�ES\n" \ " -op {OP}\n" \ " Especifica a opera�o a executar. O pr�etro {OP} pode" \ " ser \"add\" ou \"mul\".\n" \ "\n" \ "OP�ES DE DOCUMENTA�O\n" \ argparser_help_info_HELP_INFO "\n" \ "\n" \ "VEJA TAMB�\n" \ " convert(1), gimp(1), display(1), ppm(1), pgm(1).\n" \ "\n" \ "AUTOR\n" \ " Criado em 2007-08-01 por J. Stolfi, IC-UNICAMP.\n" \ "\n" \ "GARANTIA\n" \ argparser_help_info_NO_WARRANTY "\n" \ "\n" \ "DIREITOS\n" \ " Copyright 2007 by the State University of Campinas (UNICAMP).\n" \ "\n" \ argparser_help_info_STANDARD_RIGHTS /* BIBLIOTECAS DO GNU/LINUX: */ #define _GNU_SOURCE /* O comando acima �necess�io para obter {asprintf} em {stdio.h}. */ #include #include #include #include #include #include #include #include /* BIBLIOTECAS DO PROFESSOR: */ #include /* Tipo {bool_t}, {TRUE}, {FALSE}. */ #include /* {open_read}, {open_write}. */ #include /* Imagens PBM/PGM/PPM. */ #include /* Imagens em formato float. */ #include /* Pega par�etros da linha de comando. */ #include typedef enum { op_ADD, op_MUL, op_BUG } operation_t; /* C�igo interno da opera�o a executar. */ typedef struct options_t { operation_t op; /* A opera�o a executar. */ char *A_name; /* Imagem 1. */ char *B_name; /* Imagem 2. */ } options_t; /* PROT�IPOS GEN�ICOS */ int main(int argc,char** argv); /* Fun�o principal do programa. */ float_image_t *ex_read_image(FILE *rd, char *name); /* L�uma imagem em formato PPM, PGM ou PBM, converte cada amostra para um valor em ponto fluante entre 0 e 1, e armazena o resultado todo na mem�ia, na forma de um {float_image_t}. Se {rd} �diferente de NULL, l�a imagem do arquivo {rd} e deixa {rd} aberto. Se {rd} �NULL, l�o arquivo com esse nome. */ void ex_write_image(FILE *wr, char *name, float_image_t *img); /* Escreve a imagem {img}, em formato PPM, PGM ou PBM. Se {wr} �diferente de NULL, grava no arquivo {wr} e deixa {wr} aberto. Se {wr} �NULL, grava o arquivo com esse nome. */ options_t *ex_parse_options(int argc, char **argv); /* Extrai os comandos da linha de comando e empacota-os em um registro de tipo {options_t}. */ typedef float_image_t image; #endif