Commit d7885991 authored by robinechuca's avatar robinechuca
Browse files

commit intermediaire

parent e2f228ae
......@@ -122,7 +122,7 @@ class Critere:
Calcul une distance globale, prenant tous les criters en compte.
:param other: L'autre critere.
:type other: Critere
:param coeff: Les coeficient de ponderation.
:param coeff: Les coefficient de ponderation.
:type coeff: dict
:return: La moyenne ponderee.
:rtype: float
......@@ -138,6 +138,13 @@ class Critere:
dist_sum += c*methode(other)
return dist_sum/coeff_sum
def is_natural(self):
"""
:return: True si c'est naturel, False sinon.
:rtype: bool
"""
return (self.get_mean_color()[0] - 120)**2 < 10
def show(self):
"""
Affiche l'image.
......@@ -155,6 +162,10 @@ def main():
for chemin in glob.iglob("../../labsessions/lab1/input/*.jpg")]
ref, others = criters[0], criters[1:]
for im in criters:
if im.is_natural():
im.show()
ref.show()
ti = time.time()
bests = sorted(others, key=lambda other: ref.dist_global(other, hog=1, mean=0, mean_color=0))[:5]
......
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