Commit 079e99e2 authored by Claire Lemoine's avatar Claire Lemoine
Browse files

bl

parent 31711510
......@@ -31,7 +31,7 @@ class Critere:
assert isinstance(image, np.ndarray), \
"'image' doit etre une array numpy, pas un %." % type(image).__name__
assert image.ndim == 3, "L'image doit etre une image en couleur."
self.image = image
def get_mean(self):
......@@ -69,7 +69,7 @@ class Critere:
cv2.Sobel(lum_image, cv2.CV_32F, 1, 0, ksize=1), # grad sur x
cv2.Sobel(lum_image, cv2.CV_32F, 0, 1, ksize=1), # grad sur y
angleInDegrees=True) # amplitude, angle
hist = np.zeros(360)
for grad, angle in zip(grads.ravel(), angles.ravel()):
a, ca, b, cb = interpol(angle)
......@@ -143,7 +143,7 @@ class Critere:
:return: True si c'est naturel, False sinon.
:rtype: bool
"""
return (self.get_mean_color()[0] - 120)**2 < 10
return (self.get_mean_color()[0] - 120*255/360)**2 < 10
def show(self):
"""
......
......@@ -39,16 +39,17 @@ def main():
"""
Code principal.
"""
support = choisir("Image support")
#support = choisir("Image support")
cacher = choisir("Image a cacher")
trouver = choisir("Image a trouver")
#trouver = choisir("Image a trouver")
mixe = cache.cache_img(support, cacher)
devoile = trouve.trouve_img(trouver)
#mixe = cache.cache_img(support, cacher)
#devoile = trouve.trouve_img(trouver)
repertoire = tkinter.filedialog.askdirectory(title="Repertoire d'enregistrement")
cv2.imwrite(os.path.join(repertoire, "lemoine_richard_mixee.png"), mixe)
cv2.imwrite(os.path.join(repertoire, "lemoine_richard_trouvee.png"), devoile)
#cv2.imwrite(os.path.join(repertoire, "lemoine_richard_mixee.png"), mixe)
#cv2.imwrite(os.path.join(repertoire, "lemoine_richard_trouvee.png"), devoile)
cv2.imwrite(os.path.join(repertoire, "B.png"), (cacher&0b11110000)[:,:,0])
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment