======Processing vs Arduino vs Minitel====== ===== Dispositif pour afficher des photos sur minitel ===== * **** {{media_09:minitel-10.jpg|fig:Minitel-10.JPG}}{{media_09:minitel-2.jpg|fig:Minitel-2.JPG}} légère adaptation du [[http://tetalab.org/blog/update-webcam-pour-minitel-%C3%A7a-manquait|code perpétré par Renaud, Fabrice & Phil du tetalab]] pour le faire fonctionner sous Linux en utilisant [[http://gsvideo.sourceforge.net/#download|la librairie GSVideo]] Voir http://openatelier.labomedia.org/#25 pour d'autres images ==== Installation ==== * Installer [[http://processing.org/download/|Processing]] * Ajouter la librairie [[http://gsvideo.sourceforge.net/#download|la librairie GSVideo]] Pour la faire fonctionner, il faut installer des logiciels complémentaires (LMDE 32 bit 12.2013) http://forum.processing.org/one/topic/how-is-video-on-linux-handled.html#25080000001764427 sudo apt-get install libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libglib2.0-dev * * Code Processing : {{Video2minitelteletPerso goodV4 3LinuxGSVideo.pde| Video2minitelteletPerso goodV4 3LinuxGSVideo.pde}} * Installer [[http://arduino.cc/en/Main/Software|Arduino]] * Installer la librairie [[http://arduiniana.org/libraries/newsoftserial/|SoftSerial]] * Code Arduino (pas de modif / tetalab) : {{media_09:minitel_software_serial_cam_final.pde|Minitel_software_serial_cam_final.pde}} Note : Le programme Arduino ci-dessus ne fonctionne qu'avec Arduino < 1.0 (0023 par exemple). En effet, SoftwareSerial remplace NewSoftSerial dans les dernières versions, mais l'adaptation du code n'est pas directe. * Une nouvelle version avec diaporama développée par Joseph Jaouen https://gitorious.org/minitel/minitel/source/27548fe4ca3d250c6ca24214ec22b767bd29ad0e: ==== Code Processing pour Linux ==== //Video2Minitel //by Renaud, Fabrice & Phil //Inspired from Video2ledwallHarpSerial V1.0 by Fabrice Fourc // http://www.tetalab.org // import processing.video.*; import processing.net.*; import codeanticode.gsvideo.*; //GSCapture video; boolean cheatScreen; int plage=44;//256; int MINITEL_CHAR_WIDTH = 40;//*2; int MINITEL_CHAR_HEIGHT = 24;//*4; // en fait ce n'est pas vraiment un pixel par pixel char... int PIXEL_CHAR_WIDTH = 2; int PIXEL_CHAR_HEIGHT = 3; // Size of each cell in the grid, ratio of window size to video size int videoScale = 10; int videoScalex = 8; int videoScaley = 6; int count = 0; // Number of columns and rows in our system int cols, rows; // Variable to hold onto Capture object public int s = 50; import processing.serial.*; // The serial port: Serial myPort; //luminosite globale de la colone pour le son int colValue; String ledCol; String ledWallMsg; //Client myClient; GSCapture video; void setup() { size(MINITEL_CHAR_WIDTH*PIXEL_CHAR_WIDTH*videoScalex, MINITEL_CHAR_HEIGHT*PIXEL_CHAR_HEIGHT*videoScaley); frameRate(25); // List all the available serial ports: println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Keyspan adaptor, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 1200); //myClient = new Client(this, "127.0.0.1", 5204); // Initialize columns and rows cols = width/videoScalex; rows = height/videoScaley; video = new GSCapture(this, 160, 120); // Pour utiliser la 2ème webcam // video = new GSCapture(this,320,240,"v4l2src","/dev/video1",30/1); video.start(); } //---------------------------------------------------------- void displayPixelChar2(int x, int y) { x= x *2; y = y * 3; byte carac=0; // caractère pixel carac+=(Math.pow(2, 0))*getG2(x+0, y+0); carac+=(Math.pow(2, 1))*getG2(x+1, y+0); carac+=(Math.pow(2, 2))*getG2(x+0, y+1); carac+=(Math.pow(2, 3))*getG2(x+1, y+1); carac+=(Math.pow(2, 4))*getG2(x+0, y+2); carac+=(Math.pow(2, 5))*1; carac+=(Math.pow(2, 6))*getG2(x+1, y+2); myPort.write(carac); println("carac= "+carac); } int getG2(int x, int y) { println("x + y*video.width" + (x + y*video.width)); color c = video.pixels[x + y*video.width]; int value = (int)brightness(c); // get the brightness if (value {{tag>bj processing arduino minitel}}