• Il s'agit d'un programme codé en JAVA sous processing, qui permet de convertir une image couleur en noir et blanc.

    PImage binarise(PImage img){

      int largeur=img.width;
      int hauteur=img.height;
     
      PImage imgTransformee=createImage(largeur,hauteur,RGB);
     
      for(int x=0;x<largeur;x++){
        for(int y=0;y<hauteur;y++){
          int num=x+y*largeur;
          float niveauDeGris=red(img.pixels[num]);
          imgTransformee.pixels[num]=color(niveauDeGris);
        }
      }
     
      return(imgTransformee);
    }

    void setup(){
      PImage photo= loadImage("tournesol.jpg");
      size(photo.width,photo.height);
      PImage photoBinarisee=binarise(photo);
      image(photoBinarisee,0,0);
    }

    Télécharger « NetB.zip »


  • Commentaires

    Aucun commentaire pour le moment

    Suivre le flux RSS des commentaires


    Ajouter un commentaire

    Nom / Pseudo :

    E-mail (facultatif) :

    Site Web (facultatif) :

    Commentaire :