kramann.info
© Guido Kramann

Login: Passwort:










3.3 You are wasting your time

3.3 You are wasting your time (EN google-translate)

3.3 Tracisz swój czas (PL google-translate)

Das ist ein erstes Programmbeispiel mit einem gewissen künstlerischen Anspruch im Sinne der Konzeptkunst.

This is a first program example with a certain artistic claim in the sense of conceptual art.

Jest to pierwszy przykład programu z pewne roszczenia artystyczne w sensie sztuki konceptualnej.

Es ist dennoch ein ziemlich einfaches Beispiel. Unter Verwendung der Bibliothek mico kann der scetch unverändert sowohl auf einem PC, als auch auf einem Android-Gerät laufen.

It's still a pretty simple example. Using the mico library, the scetch unchanged both on one PC, as well as running on an Android device.

To wciąż całkiem prosty przykład. Korzystanie z biblioteki mico scetch niezmieniony zarówno na jednym PC, a także działa na urządzeniu z systemem Android.

Hier ist der Quelltext:

Here is the source code:

Oto kod źródłowy:

import info.kramann.extensions.mico;
import processing.video.*;
import ketai.camera.*;
import java.util.Properties;

int[] last_image=null;
int COUNTER = 0;
long TIME=0;

public void setup()
{
     fullScreen();
     orientation(LANDSCAPE);
     frameRate(30);
     mico.cameraStart(this);
}

boolean SWITCHED = false;

public void draw()
{
     if(SWITCHED==false)
     {
          SWITCHED = mico.switchCamera();
     }
  
     double difference = -1.0;
  
     background(255);
     int[] new_image = mico.cameraGetImage().pixels;
 
     if(new_image!=null && last_image!=null && last_image.length==new_image.length)
     {
           difference = 0.0;
           for(int i=0;i<new_image.length;i++)
           {
                 difference += (double)abs(new_image[i] - last_image[i]);
           }
           difference/=Math.pow(10,10);
     }
     
     if(new_image!=null && (last_image==null || last_image.length!=new_image.length))
     {
           last_image = new int[new_image.length];
     }
     
     if(new_image!=null && last_image!=null && last_image.length==new_image.length)
     {
           for(int i=0;i<new_image.length;i++)
           {
                 last_image[i] = new_image[i];
           }
     }
         
     image(mico.cameraGetImage(),250,50);
     textSize(32);
     fill(0,0,255);
     text(""+difference,10,50);
     
     if(COUNTER>0)
     {
         textSize(32);
         fill(255,0,0);
         text("You are wasting your time",10,250);
         text("by looking on a mobile device",10,350);
         text("since "+(System.currentTimeMillis()-TIME)/1000+" seconds!",10,450);
         
         COUNTER--;
     }
     else
     {
         TIME = System.currentTimeMillis();
     }
     
     if(difference>4.5)
     {
           COUNTER = 120;
     }     
}

public void mousePressed()
{
    mico.switchCamera();
}

Code 3.3-1: source code of mico_Camera_wasting_time

mico.zip -- New version of mico-library
mico_Camera_wasting_time.zip -- sketch folder
mico_Camera_wasting_time_Android.zip -- same example but Android-mode
Screenshot from PC.

Bild 3.3-1: Screenshot from PC.