Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_integrale_rivier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nicolas.rivier
tp_integrale_rivier
Commits
406146cd
Commit
406146cd
authored
2 years ago
by
poulpe
Browse files
Options
Downloads
Patches
Plain Diff
[Update] Push titlepage for rapport
parent
b26f0d56
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
background5.pdf
+70
-0
70 additions, 0 deletions
background5.pdf
main.c
+1
-1
1 addition, 1 deletion
main.c
rapport.md
+5
-0
5 additions, 0 deletions
rapport.md
rapport.pdf
+0
-0
0 additions, 0 deletions
rapport.pdf
traitementPGM.c
+80
-80
80 additions, 80 deletions
traitementPGM.c
with
156 additions
and
81 deletions
background5.pdf
0 → 100644
+
70
−
0
View file @
406146cd
File added
This diff is collapsed.
Click to expand it.
main.c
+
1
−
1
View file @
406146cd
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
rapport.md
+
5
−
0
View file @
406146cd
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
rapport.pdf
+
0
−
0
View file @
406146cd
No preview for this file type
This diff is collapsed.
Click to expand it.
traitementPGM.c
+
80
−
80
View file @
406146cd
...
@@ -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
,
s
izeof(int32_t)
);
ma
x
=
s
tringToInt
(
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
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment