diff --git a/Makefile b/Makefile index f566606323216bca673ec51a384032a9d1ecd1e8..fbc3a2458f75acc347ba0d4e16781a9ae025eed5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = gcc CFLAGS = -std=gnu11 -Wall -Wextra -Wpedantic -Wwrite-strings -Walloc-zero -Wparentheses CFLAGS += -Wlarger-than=100000 -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wformat-overflow=2 -Wunused-parameter CFLAGS += -g -pedantic -fsanitize=address -fsanitize=leak -fsanitize=undefined -Wdiscarded-qualifiers -LDFLAGS = -lm +LDFLAGS = -lm -lSDL2main -lSDL2_image -lSDL2 ############# COMMAND HELP ############# @@ -21,7 +21,7 @@ LDFLAGS = -lm PROG = Exe -$(PROG): Matrix.o math_lib.o traitementPGM.o main.c +$(PROG): Matrix.o math_lib.o traitementPGM.o gfx.o main.c $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) math_lib.o: math_lib.c @@ -33,6 +33,9 @@ Matrix.o: Matrix.c traitementPGM.o: traitementPGM.c $(CC) -c $^ $(CFLAGS) $(LDFLAGS) +gfx.o: gfx.c + $(CC) -c $^ $(CFLAGS) $(LDFLAGS) + rapport: rapport.md pandoc -s $< -o $@.pdf --template eisvogel.latex --listings --pdf-engine pdflatex diff --git a/main.c b/main.c index 4164534775e5c313cfbab303b3cf6e04b390638d..23bf91143cbaafc1d41f1cb0f96a4b052f6f2ee6 100644 --- a/main.c +++ b/main.c @@ -45,6 +45,8 @@ void Convolution_filtrage() char output_image[] = "out.pgm"; char output_convolve[] = "convolve.pgm"; + char sdl_name[] = "convolution"; + pgm img; if (pgm_read_from_file(&img, filname) == -1) { @@ -77,6 +79,8 @@ void Convolution_filtrage() normalise_matrix(&res.pixels, norm_min, norm_max, res.max); + PrintImagePGM(res,sdl_name); + pgm_write_to_file(&res, output_convolve); matrix_free(&img.pixels); diff --git a/traitementPGM.c b/traitementPGM.c index f51db13ce5aef42895182bb44132ac87e6d81bf4..1c967b9a458b6a3036f0a2804cdd78efdacadf7b 100755 --- a/traitementPGM.c +++ b/traitementPGM.c @@ -48,4 +48,14 @@ void pgm_write_to_file(pgm *p, char *filename) } fclose(f); +} + +void PrintImagePGM(pgm img, char * filname) +{ + printf("Image sélectionnée '%s' de taille %dx%d lumMax:%d\n", filname, img.pixels.col, img.pixels.row, img.max); + struct gfx_context_t *ImagePGM = initWindow(img.pixels.row, img.pixels.col, filname); + dessineTab2D(ImagePGM, img.pixels.data, img.pixels.col, img.pixels.row); + gfx_present(ImagePGM); + waitSpacePress(); + gfx_destroy(ImagePGM); } \ No newline at end of file diff --git a/traitementPGM.h b/traitementPGM.h index 3cacb34bd5b4e8f4f92d37fa08d929992b8ef51b..ff6c99cfe57619da9ec1f58e4bcbaf0578c90937 100755 --- a/traitementPGM.h +++ b/traitementPGM.h @@ -3,6 +3,7 @@ #include "Matrix.h" #include "math_lib.h" +#include "gfx.h" typedef struct _pgm { @@ -12,5 +13,6 @@ typedef struct _pgm int32_t pgm_read_from_file(pgm *p, char *filename); void pgm_write_to_file(pgm *p, char *filename); +void PrintImagePGM(pgm img, char *filname); #endif \ No newline at end of file