floutage

Upload: wesley

Post on 19-Feb-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/23/2019 Floutage

    1/2

    #definition liste de blocs

    img_bloc = []#Construction liste de bloc (x,y)

    for y in range(0, height, floutage_y): for x in range (0, idth, floutage_x):

    # assignation ! un bloc "our les "ixels initiaux

    bloc = [] for bloc_y in range(floutage_y):

    "ix_y = y bloc_y #chec$ limites x

    if "ix_y %= height:

    brea$ for bloc_x in range (floutage_x):

    "ix_x = x bloc_x

    #chec$ limites y if "ix_x %= idth:

    brea$ bloc&a""end(("ix_x,"ix_y))

    # bloc incr'ment' ! liste de blocs img_bloc&a""end(bloc)

    #cr'ation de la boucle de traitement de limage

    for bloc in img_bloc: #moyenne couleur

    sum*+ = [0,0,0] for x,y in bloc:

    #ou-eau "ixel com"l't' "ar le total *+ "ixels "r'c'dents

    *+ = img&get"ixel((x,y)) sum*+ = [(sum*+[i] *+[i]) for i in range (.)]

    #o"'ration "ix*+ = [(sum*+[i]//(floutage_xfloutage_y)) for i in range (.)]

    #-aleur moyenne conduisant au traitement de limage

    for x,y in bloc: img&"ut"ixel((x,y),("ix*+[0],"ix*+[1],"ix*+[2]))

    img: 3b4et 5mage floutage_x: nombre de "ixel en x

    floutage_y: nombre de "ixel en y

    return img

  • 7/23/2019 Floutage

    2/2