Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP-KINADINOVA-Dariya
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
Dariya Kinadinova
AP-KINADINOVA-Dariya
Commits
806ae18a
Commit
806ae18a
authored
1 year ago
by
Kinadinova Dariya
Browse files
Options
Downloads
Patches
Plain Diff
is_col_close
parent
281fca98
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projet/Decouper_Image.py
+17
-5
17 additions, 5 deletions
projet/Decouper_Image.py
with
17 additions
and
5 deletions
projet/Decouper_Image.py
+
17
−
5
View file @
806ae18a
...
...
@@ -25,8 +25,8 @@ def decouper(file: str) -> list[Image]:
l
=
[
block_1
,
block_2
,
block_3
,
block_4
]
return
l
def
avg_col
(
l
:
list
[
int
]
)
->
list
[
int
]:
"""
déterminer
la couleur moyenne d
'
une liste de couleurs
def
avg_col
(
l
:
tuple
)
->
list
[
int
]:
"""
renvoie
la couleur moyenne d
'
une liste de couleurs
Précondition :
Exemple(s) :
...
...
@@ -49,12 +49,14 @@ def avg_col(l:list[int]) -> list[int]:
avg3
=
c3
/
n_col
return
(
avg1
,
avg2
,
avg3
)
def
liste_col
(
im
:
Image
,
left_top
:
tuple
(),
right_bottom
:
tuple
())
->
list
[
int
]:
def
list_col
(
im
:
Image
,
left_top
:
tuple
(),
right_bottom
:
tuple
())
->
list
[
int
]:
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$ list
e
_col(
im
, (0,0), (1, 1))
$$$ list_col(
Image.open(
'
calbuth.png
'
)
, (0,0), (1, 1))
[(236, 210, 111), (236, 210, 111), (236, 210, 111), (236, 210, 111)]
"""
...
...
@@ -62,7 +64,17 @@ def liste_col(im: Image, left_top: tuple(), right_bottom: tuple()) -> list[int]:
x_max
,
y_max
=
right_bottom
return
[
im
.
getpixel
((
x
,
y
))
for
x
in
range
(
x_max
+
1
)
for
y
in
range
(
y_max
+
1
)]
im
=
Image
.
open
(
'
calbuth.png
'
)
def
is_col_close
(
color1
:
tuple
(),
color2
:
tuple
())
->
bool
:
"""
returns True if the distance between two colors is not more than 50,
returns False if the distance is more than 50
Précondition :
Exemple(s) :
$$$
"""
...
...
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