Skip to content
Snippets Groups Projects
Commit 406146cd authored by poulpe's avatar poulpe
Browse files

[Update] Push titlepage for rapport

parent b26f0d56
No related branches found
No related tags found
No related merge requests found
File added
...@@ -94,7 +94,7 @@ void Convolution_filtrage() ...@@ -94,7 +94,7 @@ void Convolution_filtrage()
// exit(0); // exit(0);
matrix kernel = matrix_creat(3,3); matrix kernel = matrix_creat(3,3);
int tab []= {0,0,0,0,1,0,0,0,0}; // int tab []= {0,0,0,0,1,0,0,0,0};
// int tab []= {1,1,1,1,1,1,1,1,1}; // int tab []= {1,1,1,1,1,1,1,1,1};
// int tab[] = {0,-1,0,-1,5,-1,0,-1,0}; // int tab[] = {0,-1,0,-1,5,-1,0,-1,0};
matrix_from_array(&kernel,3,3,tab); matrix_from_array(&kernel,3,3,tab);
......
...@@ -3,8 +3,13 @@ title: "Rapport Math" ...@@ -3,8 +3,13 @@ title: "Rapport Math"
author: [Troller Fabian, Rivier Nicolas] author: [Troller Fabian, Rivier Nicolas]
date: "2022-04-25" date: "2022-04-25"
keywords: [Math, Intégrales] keywords: [Math, Intégrales]
lang: "fr"
titlepage: true,
titlepage-rule-height: 0
titlepage-background: "background5.pdf"
... ...
# Introduction Génerale # Introduction Génerale
Pour ce TP, nous avons reçu comme objectif de calculer une convolution de signaux numériquement et à la main d'en calculer l'erreur entre les deux, Ainsi que réussir à enlever le bruit d'une image
# Introduction théorique # Introduction théorique
......
No preview for this file type
...@@ -23,104 +23,104 @@ int stringToInt(char *buf, char crt) ...@@ -23,104 +23,104 @@ int stringToInt(char *buf, char crt)
return result; return result;
} }
// error_code pgm_read_from_file(pgm *p, char *filename) error_code pgm_read_from_file(pgm *p, char *filename)
// { {
// FILE *fp = fopen(filename, "r"); FILE *fp = fopen(filename, "r");
// int buf_size = 32; int buf_size = 32;
// char buffer[buf_size]; char buffer[buf_size];
// int x, y, max; int x, y, max;
// // Test si le fichier filname existe
// if (NULL == fp)
// {
// fprintf(stderr, "Can't open output file %s!\n", filename); // affiche dans le canal d'erreur
// return uninitialized;
// }
// // Test si l'image est bien en format PGM "P5"
// fgets(buffer, buf_size, fp);
// //printf("%s", buffer);
// if (buffer[0] != 'P' && buffer[1] != '5')
// {
// fprintf(stderr, "File isn't in PGM format %s!\n", buffer); // affiche dans le canal d'erreur
// return out_of_bounds;
// }
// // Recupère la taille de l'image // Test si le fichier filname existe
// fgets(buffer, buf_size, fp); if (NULL == fp)
// x = stringToInt(buffer, ' '); {
// y = stringToInt(buffer, ' '); fprintf(stderr, "Can't open output file %s!\n", filename); // affiche dans le canal d'erreur
// // printf("String :%s X:%d Y:%d\n", buffer,x,y); return uninitialized;
}
// // Recupère l'intensité max des pixels de l'image // Test si l'image est bien en format PGM "P5"
// fgets(buffer, buf_size, fp); fgets(buffer, buf_size, fp);
// max = stringToInt(buffer, '\0'); //printf("%s", buffer);
// // printf("max :%d\n", max); if (buffer[0] != 'P' && buffer[1] != '5')
{
fprintf(stderr, "File isn't in PGM format %s!\n", buffer); // affiche dans le canal d'erreur
return out_of_bounds;
}
// // Initialise les descriptife de l'image pgm // Recupère la taille de l'image
// p->max = max; fgets(buffer, buf_size, fp);
// p->pixels.pM = NULL; x = stringToInt(buffer, ' ');
y = stringToInt(buffer, ' ');
// printf("String :%s X:%d Y:%d\n", buffer,x,y);
// // Créer une liste contenant le fichier pgm // Recupère l'intensité max des pixels de l'image
// // uint8_t *filechar = malloc(y * x * sizeof(int8_t)); fgets(buffer, buf_size, fp);
// int32_t *fileint = calloc(y * x , sizeof(int32_t)); max = stringToInt(buffer, '\0');
// uint16_t *fileint16 = calloc(y * x , sizeof(uint16_t)); // printf("max :%d\n", max);
// //fread(filechar, sizeof(__u_char), y * x, fp); // Initialise les descriptife de l'image pgm
p->max = max;
p->pixels.pM = NULL;
// fread(fileint16, sizeof(uint16_t), y * x, fp); // Créer une liste contenant le fichier pgm
// uint8_t *filechar = malloc(y * x * sizeof(int8_t));
int32_t *fileint = calloc(y * x , sizeof(int32_t));
uint16_t *fileint16 = calloc(y * x , sizeof(uint16_t));
// // Cast les valleurs char en int32 compris par la matrix //fread(filechar, sizeof(__u_char), y * x, fp);
// for (int i = 0; i < y * x; i++)
// {
// fileint[i] = fileint16[i];
// //printf("%d ",fileint[i]);
// }
// // Créer une matrix contenant les données du pgm fread(fileint16, sizeof(uint16_t), y * x, fp);
// if (matrix_init_from_array(&p->pixels, y, x, fileint) != ok)
// {
// fprintf(stderr, "The matrix isn't allocated %s!\n", buffer); // affiche dans le canal d'erreur
// return memory_error;
// }
// // Libébere l'espace non utils // Cast les valleurs char en int32 compris par la matrix
// free(fileint); for (int i = 0; i < y * x; i++)
// // free(filechar); {
// free(fileint16); fileint[i] = fileint16[i];
// fclose(fp); //printf("%d ",fileint[i]);
// return ok; }
// }
error_code pgm_read_from_file(pgm *p, char *filename) // Créer une matrix contenant les données du pgm
{ if (matrix_init_from_array(&p->pixels, y, x, fileint) != ok)
if (filename == NULL || p == NULL)
{ {
fprintf(stderr, "The matrix isn't allocated %s!\n", buffer); // affiche dans le canal d'erreur
return memory_error; return memory_error;
} }
char header[BUFSIZ]; // Libébere l'espace non utils
int32_t c = 0, r = 0, intensity = 0; free(fileint);
FILE *f = fopen(filename, "rb"); // free(filechar);
free(fileint16);
fclose(fp);
return ok;
}
fscanf(f, "%s", header); // error_code pgm_read_from_file(pgm *p, char *filename)
fscanf(f, "%d %d", &r, &c); // {
fscanf(f, "%d", &intensity); // if (filename == NULL || p == NULL)
// {
// return memory_error;
// }
matrix_init(&p->pixels, c, r); // char header[BUFSIZ];
p->max = intensity; // int32_t c = 0, r = 0, intensity = 0;
// FILE *f = fopen(filename, "rb");
for (int32_t i = 0; i < p->pixels.m; i += 1) // fscanf(f, "%s", header);
{ // fscanf(f, "%d %d", &r, &c);
for (int32_t j = 0; j < p->pixels.n; j += 1) // fscanf(f, "%d", &intensity);
{
fread(&p->pixels.data[j][i] , sizeof(uint16_t), 1, f);
}
}
fclose(f); // matrix_init(&p->pixels, c, r);
return ok; // p->max = intensity;
}
// for (int32_t i = 0; i < p->pixels.m; i += 1)
// {
// for (int32_t j = 0; j < p->pixels.n; j += 1)
// {
// fread(&p->pixels.data[j][i] , sizeof(uint16_t), 1, f);
// }
// }
// fclose(f);
// return ok;
// }
error_code pgm_write_to_file(pgm *p, char *filename) error_code pgm_write_to_file(pgm *p, char *filename)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment