Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:infini:info-reseau:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
projets:infini:info-reseau:accueil [2015/10/07 00:08]
resonance
projets:infini:info-reseau:accueil [2016/05/24 12:36] (Version actuelle)
resonance [Principe de fonctionnement]
Ligne 6: Ligne 6:
  
  
-===== Esquisses =====+===== Principe de fonctionnement =====
  
 {{:projets:infini:info-reseau:8-techniques-legendes.png|}} {{:projets:infini:info-reseau:8-techniques-legendes.png|}}
 +
 +{{:projets:infini:info-reseau:infini-techniques-superviseur.svg.png?800|}}
 +
 +
 +===== Messages =====
 +
 +==== Ordinateur > ENG ====
 +<code cpp>
 +"id on speed pan tilt reserved" 
 +id : "A" ou "B" pour les robots
 +on : caractère 30 pour on, 31 pour off
 +speed : 
 +pan : 
 +tilt : 
 +reserved : on ajoute un caractère pour un besoin futur
 +</code>
 +
 +==== ENG > Ordinateur ====
 +<code cpp>
 +"id tension inclinaison vitesseDeRotation choc reserved" 
 +id : "A" ou "B" pour les robots
 +tension : 
 +inclinaison : 
 +vitesseDeRotation : 
 +choc : caractère 30 si un choc, 31 si aucun
 +reserved : on ajoute un caractère pour un besoin futur
 +</code>
 +
 +
 +
 +
 +===== Comportements =====
 +{{:projets:infini:info-reseau:eng-comportements.jpg?800|}}
 +===== Code Web =====
 +
 +====mars 2016 (stéphane)====
 +  * https://twitter.com/afpfr
 +  * https://twitter.com/BFMTV
 +  * https://twitter.com/franceinfo
 +  * https://twitter.com/le_Parisien
 +
 +++++ Code Processing |
 +<code java>
 +import java.util.regex.Matcher;
 +import java.util.regex.Pattern;
 +
 +StringList tweetsAff = new StringList();
 +int yAffDebut = 14;
 +
 +void setup() {
 +  size(800, 600);
 +  PFont f = createFont("ArialUnicodeMS", 24);
 +  textFont(f);
 +  textAlign (LEFT, LEFT);
 +  textSize(12);
 +  fill(0);
 +  nouveauxTweets();
 +  String[] aEnregistrer = new String[tweetsAff.size()];
 +  for (int i = 0; i<tweetsAff.size(); i++) {
 +    aEnregistrer[i] = tweetsAff.get(i);
 +  }
 +  saveStrings("tweets.txt",aEnregistrer);
 +}
 +
 +void draw() {
 +  background(255);
 +  for (int i = 0; i<tweetsAff.size(); i++) {
 +    text(tweetsAff.get(i), 10, yAffDebut+14*i);
 +  }
 +}
 +
 +void nouveauxTweets() {
 +  tweetsAff = new StringList();
 +  String []  sourceTweet = {"afpfr", "BFMTV", "franceinfo", "le_parisien"};
 +  for (int s = 0; s < sourceTweet.length; s++) {
 +    String lines[] = loadStrings("https://twitter.com/" + sourceTweet[s]);
 +    String html = join(lines, "\n");
 +    String[][] mLigne = matchAll(html, "<div class=\"js-tweet-text-container\">(.*?)</div>");
 +    for (int i = 0; i<mLigne.length; i++) {
 +      String texte = mLigne[i][1].replaceAll("\\<.*?>", "");
 +      texte = remplaceHtml(texte);
 +      texte = finTweet(texte);
 +      print(texte);
 +      tweetsAff.append(texte);
 +    }
 +  }
 +}
 +
 +String remplaceHtml(String texte) {
 +  String[] charHtml = {"&#39;", "&quot;", "#"};
 +  String[] remplace = {"'", "\"", ""};
 +  for (int i=0; i<charHtml.length; i++) {
 +    String REGEX = charHtml[i];
 +    String REPLACE = remplace[i];
 +    Pattern p = Pattern.compile(REGEX);
 +    Matcher m = p.matcher(texte); 
 +    texte = m.replaceAll(REPLACE);
 +  }
 +  return texte;
 +}
 +
 +String finTweet(String texte) {
 +  String[] baliseFin = {"http", "AFP"};
 +  for (int i = 0; i< baliseFin.length; i++) {
 +    int pFin = texte.indexOf(baliseFin[i]);
 +    if (pFin > 0) {
 +      texte = texte.substring(0, pFin);
 +    }
 +  }
 +  return texte;
 +}
 +
 +void keyPressed() {
 +  if (key == CODED) {
 +    if (keyCode == UP) {
 +      yAffDebut +=5;
 +    }
 +    if (keyCode == DOWN) {
 +      yAffDebut -=5;
 +    }
 +  }
 +}
 +</code>
 +++++
 +
 +===== Rendu Vidéo =====
 {{:projets:infini:8-ecran.jpg?400|}} {{:projets:infini:8-ecran.jpg?400|}}
 +
 +
 +==== Ip vidéo 08/04/16 ====
 +Récupérer la vidéo du téléphone (application IPWebcam) avec OpenFrameworks : {{:projets:infini:info-reseau:video-ip-ofxcv.zip|}}.
 +Télécharger [[https://github.com/kylemcdonald/ofxCv/archive/master.zip|ofxCv.zip]] et le placer dans le répertoire "./addons/".
 +
 +<WRAP group>
 +<WRAP half column>
 +<code cpp>
 +#pragma once
 +
 +#include "ofMain.h"
 +
 +#include "ofxCv.h"
 +#include <cv.h>
 +#include <highgui.h>
 +#include <opencv2/core/core.hpp>
 +
 +class ofApp : public ofBaseApp{
 +
 +public:
 +    void setup();
 +    void update();
 +    void draw();
 +
 +    void keyPressed(int key);
 +    void keyReleased(int key);
 +    void mouseMoved(int x, int y );
 +    void mouseDragged(int x, int y, int button);
 +    void mousePressed(int x, int y, int button);
 +    void mouseReleased(int x, int y, int button);
 +    void mouseEntered(int x, int y);
 +    void mouseExited(int x, int y);
 +    void windowResized(int w, int h);
 +    void dragEvent(ofDragInfo dragInfo);
 +    void gotMessage(ofMessage msg);
 +
 +    cv::VideoCapture vcap;
 +    cv::Mat mat;
 +    ofImage img;
 +};
 +</code>
 +</WRAP>
 +
 +<WRAP half column>
 +<code cpp>
 +#include "ofApp.h"
 +
 +void ofApp::setup(){
 +    // IP Address
 +    // You must add the "something.mjpeg" at the end of the IP address
 +    // because OpenCv returns errors as it does not find the format ...
 +    // See : http://code.opencv.org/issues/2474
 +    vcap.open("http://192.168.1.101:8080/video?something.mjpeg");
 +    img.allocate(640, 480, OF_IMAGE_COLOR);
 +}
 +
 +void ofApp::update(){
 +    vcap.read(mat);
 +    ofxCv::toOf(mat, img);
 +    img.update();
 +}
 +
 +void ofApp::draw(){
 +    img.draw(0,0);
 +}
 +....
 +....
 +....
 +</code>
 +</WRAP>
 +</WRAP>
 +
/home/resonancg/www/wiki/data/attic/projets/infini/info-reseau/accueil.1444169335.txt.gz · Dernière modification: 2015/10/07 00:08 de resonance