Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
wiki:flossmanuals:boitier-interactif-01:accueil [2021/06/28 14:08] damien.muti [Plans et schémas de fonctionnement] |
wiki:flossmanuals:boitier-interactif-01:accueil [2021/10/31 15:23] (Version actuelle) lise [Boîtier Interactif : Apprendre la profondeur dans un tableau] |
||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
* **Date** : 03/2021 | * **Date** : 03/2021 | ||
* **Contexte** : projet " | * **Contexte** : projet " | ||
- | * **Fichiers** : | + | * **Fichiers** : {{ : |
* **Lien** : | * **Lien** : | ||
* **Capteurs/ | * **Capteurs/ | ||
Ligne 16: | Ligne 16: | ||
====== Intentions : explication du projet et objectifs ====== | ====== Intentions : explication du projet et objectifs ====== | ||
- | Dans le cadre d'un projet avec le musée | + | ==== Le Contexte ==== |
+ | Commande de malette pédagogique pour les enfants de 5-6 ans de la part du musée de Beaux Arts de Marseille. | ||
+ | Chaque élève propose des dispositifs qui pourraient s’insérer dans la malette, en se basant sur un ou plusieurs des tableaux proposés par le musée. | ||
+ | ==== Les Objectifs ==== | ||
+ | Permettre aux enfants | ||
+ | ==== Le Dispositif ==== | ||
+ | Une tablette / un ordinateur tactile affiche | ||
+ | |||
+ | Il peut le faire de deux différentes manières : | ||
+ | |||
+ | - de haut en bas : le personnage change de taille et de saturation | ||
+ | |||
+ | - de droite à gauche : le personnage ne change pas | ||
+ | |||
+ | Ainsi, le médiateur peut se servir du boitier pour démontrer | ||
+ | Ensuite, les enfants volontaires peuvent passer à tour de rôle pour s’en servir pendant que leurs camarades se servent du kit tampographique. | ||
====== Plans et schémas de fonctionnement ====== | ====== Plans et schémas de fonctionnement ====== | ||
- | A compléter | + | {{ : |
====== Programmes ====== | ====== Programmes ====== | ||
===== Arduino ===== | ===== Arduino ===== | ||
Ligne 172: | Ligne 187: | ||
Le rendu est le suivant : | Le rendu est le suivant : | ||
- | {{ : | + | {{ : |
Le programme est le suivant : {{ : | Le programme est le suivant : {{ : | ||
Ligne 185: | Ligne 200: | ||
int[] serialInArray = new int[NbData]; | int[] serialInArray = new int[NbData]; | ||
int serialCount = 0; // A count of how many bytes we receive | int serialCount = 0; // A count of how many bytes we receive | ||
- | int xPerso, yPerso, | + | int ChoixPerso, CouleurPerso, |
boolean firstContact = false; | boolean firstContact = false; | ||
- | PImage loubon; | + | float xPerso, yPerso, sPerso; |
- | PImage bouvier; | + | PImage |
+ | color c =color(# | ||
+ | int r = 25, g = 42, b=118; | ||
+ | PImage imgMask; | ||
void setup() { | void setup() { | ||
size(1000, | size(1000, | ||
noStroke(); | noStroke(); | ||
- | colorMode(HSB); | + | |
// Initialisation des variables | // Initialisation des variables | ||
ChoixPerso=0; | ChoixPerso=0; | ||
CouleurPerso = 0; // | CouleurPerso = 0; // | ||
- | xPerso = width/2; // Slider 1 | + | xPerso = 0.76*width; // Slider 1 |
- | yPerso = height/2; // Slider 2 - Distance | + | yPerso = 0.84*height; // Slider 2 - Distance |
- | sPerso = 250; //Taille du personnage | + | sPerso = 2000; //Taille du personnage |
- | bouvier = loadImage(" | + | SaturPerso = 255; |
+ | bouvier = loadImage(" | ||
loubon= loadImage(" | loubon= loadImage(" | ||
+ | img = createImage(bouvier.width, | ||
+ | image(loubon, | ||
+ | colorMode(HSB); | ||
// Print a list of the serial ports, for debugging purposes: | // Print a list of the serial ports, for debugging purposes: | ||
printArray(Serial.list()); | printArray(Serial.list()); | ||
+ | imgMask = loadImage(" | ||
+ | imgMask = createImage(bouvier.width, | ||
// I know that the first port in the serial list on my mac | // I know that the first port in the serial list on my mac | ||
// is always my FTDI adaptor, so I open Serial.list()[0]. | // is always my FTDI adaptor, so I open Serial.list()[0]. | ||
Ligne 217: | Ligne 238: | ||
void draw() { /////////////////////////////////////// | void draw() { /////////////////////////////////////// | ||
- | background(loubon); | ||
- | // | ||
- | // Draw the shape | ||
- | // | ||
- | if (ChoixPerso == 0) { | + | |
- | bouvier = loadImage(" | + | image(loubon, |
+ | | ||
+ | bouvier = loadImage(" | ||
+ | img.mask(imgMask); | ||
} | } | ||
if (ChoixPerso == 1){ | if (ChoixPerso == 1){ | ||
- | | + | |
+ | | ||
} | } | ||
if (ChoixPerso == 2){ | if (ChoixPerso == 2){ | ||
- | | + | |
+ | | ||
} | } | ||
- | image(bouvier, | + | |
+ | for (int i = 0; i < bouvier.pixels.length; | ||
+ | int r_i = (bouvier.pixels[i] >> 16) & 0xFF; // Faster way of getting red(argb) | ||
+ | int g_i = (bouvier.pixels[i] >> 8) & 0xFF; | ||
+ | int b_i= bouvier.pixels[i] & 0xFF; // Faster way of getting blue(argb) | ||
+ | if (r_i == r && g_i == g && b_i == b) { | ||
+ | float h = CouleurPerso; | ||
+ | //float h = 128; | ||
+ | float s = SaturPerso; | ||
+ | float b =brightness(bouvier.pixels[i]); | ||
+ | |||
+ | // | ||
+ | |||
+ | img.pixels[i] = color(h, s, b); | ||
+ | } | ||
+ | |||
+ | img.updatePixels(); | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | | ||
+ | |||
+ | image(img, xPerso, yPerso, sPerso, sPerso); | ||
} | } | ||
Ligne 259: | Ligne 304: | ||
ChoixPerso=serialInArray[0]; | ChoixPerso=serialInArray[0]; | ||
CouleurPerso = serialInArray[1]; | CouleurPerso = serialInArray[1]; | ||
- | xPerso = serialInArray[2]*3-50; | + | xPerso =0.2*width +2*serialInArray[2]; |
- | yPerso = serialInArray[3]+100; | + | yPerso = 0.53*height + serialInArray[3]; |
- | sPerso = serialInArray[3]*2+100; | + | sPerso |
+ | SaturPerso | ||
| | ||
// print the values (for debugging purposes only): | // print the values (for debugging purposes only): | ||
- | println(ChoixPerso + " | + | println(ChoixPerso + " |
| | ||
// Send a capital A to request new sensor readings: Envoie d'une letter " | // Send a capital A to request new sensor readings: Envoie d'une letter " | ||
Ligne 272: | Ligne 318: | ||
} | } | ||
} | } | ||
- | } | ||
- | </ | ||
- | |||
- | ==== Programme de test de couleur sur des images en PNG ==== | ||
- | De manière connexe, des tests sur la manière de modifier la couleur d'un contour SVG/PNG ont été effectués. L' | ||
- | |||
- | Le rendu est le suivant : | ||
- | |||
- | {{ : | ||
- | |||
- | |||
- | Le programme Processing est le suivant : {{ : | ||
- | < | ||
- | /** | ||
- | * Create Image. | ||
- | | ||
- | * The createImage() function provides a fresh buffer of pixels to play with. | ||
- | * This example creates an image gradient. | ||
- | */ | ||
- | |||
- | PImage img, imgIntiale; | ||
- | color c =color(# | ||
- | int r = 25, g = 42, b=118; | ||
- | // Arbre : 2480*2480 | ||
- | void setup() { | ||
- | size(1000, 570); | ||
- | background(255); | ||
- | imgIntiale = loadImage(" | ||
- | img = createImage(imgIntiale.width, | ||
- | |||
- | colorMode(HSB); | ||
- | |||
- | //float a = map(i, 0, img.pixels.length, | ||
- | // | ||
- | } | ||
- | |||
- | void draw() { | ||
- | background(255); | ||
- | image(imgIntiale, | ||
- | |||
- | for (int i = 0; i < imgIntiale.pixels.length; | ||
- | int r_i = (imgIntiale.pixels[i] >> 16) & 0xFF; // Faster way of getting red(argb) | ||
- | int g_i = (imgIntiale.pixels[i] >> 8) & 0xFF; // Faster way of getting green(argb) | ||
- | int b_i= imgIntiale.pixels[i] & 0xFF; // Faster way of getting blue(argb) | ||
- | if (r_i == r && g_i == g && b_i == b) { | ||
- | float h = map(mouseX, 0, width, 0, 255); | ||
- | //float h = 128; | ||
- | float s = saturation(imgIntiale.pixels[i]); | ||
- | float b = brightness(imgIntiale.pixels[i]); | ||
- | |||
- | // | ||
- | |||
- | img.pixels[i] = color(h, s, b); | ||
- | } | ||
- | img.updatePixels(); | ||
- | } | ||
- | |||
- | |||
- | image(img, 260, 260, 250, 250); | ||
} | } | ||
</ | </ |