Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Traitement_Images
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
Model registry
Operate
Environments
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
jorge.leitemac
Traitement_Images
Commits
a5d1f0c2
Commit
a5d1f0c2
authored
4 years ago
by
jorge.leitemac
Browse files
Options
Downloads
Patches
Plain Diff
fonction read ok
parent
d3708647
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pgm.c
+9
-13
9 additions, 13 deletions
pgm.c
with
9 additions
and
13 deletions
pgm.c
+
9
−
13
View file @
a5d1f0c2
...
...
@@ -10,13 +10,11 @@ pgm_error pmg_read_from_file(pgm *p, char *filename)
exit
(
0
);
}
//type
char
type
[
3
];
//Taille de l'image
int
hauteur
=
0
;
int
largeur
=
0
;
//Niveau de gris maximal
int
niveauGris
=
0
;
char
type
[
3
];
//type
int
hauteur
=
0
;
//Taille de l'image
int
largeur
=
0
;
int
niveauGris
=
0
;
//Niveau de gris maximal
fscanf
(
f
,
"%s %d %d %d"
,
type
,
&
hauteur
,
&
largeur
,
&
niveauGris
);
...
...
@@ -25,7 +23,6 @@ pgm_error pmg_read_from_file(pgm *p, char *filename)
if
(
taille
<=
0
){
return
failure
;
}
p
->
max
=
niveauGris
;
//tableau pour init depuis matrix
...
...
@@ -36,19 +33,18 @@ pgm_error pmg_read_from_file(pgm *p, char *filename)
fread
(
&
pixels
[
i
],
sizeof
(
uint8_t
),
1
,
f
);
}
//
ok pa
s
d
et
ecté, a regler
if
(
matrix_init_from_array
(
&
p
->
pixels
,
hauteur
,
largeur
,
pixels
)
!=
ok
)
{
//
Convertit le tableau pixel
s et
l'affecte au pgm
if
(
matrix_init_from_array
(
&
p
->
pixels
,
hauteur
,
largeur
,
pixels
)
!=
OK
)
{
return
failure
;
}
printf
(
"Type : %s
\n
"
,
type
);
printf
(
"Hauteur : %d
\n
"
,
hauteur
);
printf
(
"Hauteur : %d
\n
"
,
largeur
);
printf
(
"nvGris : %d
\n
"
,
niveauGris
);
fclose
(
f
);
return
success
;
}
\ No newline at end of file
}
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