Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Claire Lemoine
TP3-image
Commits
9cd494d1
Commit
9cd494d1
authored
Dec 16, 2020
by
robinechuca
Browse files
commit intermediaire
parent
4ade95b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
cache.py
cache.py
+8
-2
main.py
main.py
+3
-3
No files found.
cache.py
View file @
9cd494d1
...
...
@@ -6,12 +6,19 @@
|=================================================|
"""
import
cv2
def
cache_img
(
support
,
img_a_cacher
):
"""
entree
------
:param support: L'image que l'on voit a la fin.
:param img_a_cacher: L'image que l'on veut cacher.
:type support: np.ndarray
:type img_a_cacher: np.ndarray
sortie
------
:return: L'image contenant le support et l'image a cacher.
:rtype: np.ndarray
"""
...
...
@@ -20,5 +27,4 @@ def cache_img(support, img_a_cacher):
# Retirer les bits de poids faible de l'image à cacher et les mettre au format 4 bits, ie rendre les poids forts en faible
# Remplacer les 4 bits de poids faible du support par les 4 bits de poids fort de l'image à cacher
# Retourner l'image ainsi obtenue
return
(
support
&
0b11110000
)
+
(
img_a_cacher
>>
4
)
return
(
support
&
0b11110000
)
+
(
cv2
.
resize
(
img_a_cacher
,
suport
.
shape
[:
2
],
interpolation
=
cv2
.
INTER_AREA
)
>>
4
)
main.py
View file @
9cd494d1
...
...
@@ -27,7 +27,7 @@ def choisir(titre):
if
not
impath
:
sys
.
stderr
.
write
(
"Il faut selectionner un fichier!
\n
"
)
return
image
=
cv2
.
imread
(
impath
)
image
=
cv2
.
imread
(
impath
,
cv2
.
IMREAD_COLOR
)
if
isinstance
(
image
,
type
(
None
)):
sys
.
stderr
.
write
(
"L'image est corrompue!
\n
"
)
return
...
...
@@ -41,8 +41,8 @@ def main():
devoile
=
trouve
.
trouve_img
(
mixe
)
repertoire
=
tkinter
.
filedialog
.
askdirectory
(
title
=
"Repertoire d'enregistrement"
)
cv2
.
imwrite
(
os
.
path
.
join
(
repertoire
,
"
imag
e_mixe.png"
),
mixe
)
cv2
.
imwrite
(
os
.
path
.
join
(
repertoire
,
"
imag
e_disimulee.png"
),
devoile
)
cv2
.
imwrite
(
os
.
path
.
join
(
repertoire
,
"
lemoin
e_mixe.png"
),
mixe
)
cv2
.
imwrite
(
os
.
path
.
join
(
repertoire
,
"
lemoin
e_dis
s
imulee.png"
),
devoile
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment