LiveLoops in Pure Data
Here is a little loop-generator in pure data. Supports 4 tracks.
Click "rec" to record a sound from your build-in microphone. If a certain level of loudness is reached, recording starts. Usefull for live dj performances.
ToneMatrix – Webcam Object Tracking
During our subject Interface Culture we (Matthias Schmidt, Bettina Steger and my humble self) were working on a project that uses hand-drawn objects on a white paper for making music.
Note: You have to allow the webcam!
Hold a white paper with black (or dark) objects that you painted on it in front of the camera. The red rectangle indicates the tracked area, the green rectangles indicates the tracked objects. Then hit the space-bar (Note: be sure that the flash movie gets the focus)
The flash-app uses the webcam for accessing three different videos. The normal video that we convert into two other videos: A threshold video and a palette video.
The palette video is used for tracking the brightest area in the video and reducing the tracking-area to this area (e.g. the white paper is usual the brightest color in the video, so objects that are in the background aren't tracked any longer). The threshold video is used for tracking the darkest objects within the brightest area.
How does this work? In the treshold video it is supposed that the red pixels are the objects, and coherent pixels belongs to one object. I've implemented a flood fill algorithm that counts the pixel of each object and returns the x,y position and width and height of an object. With this information we can nearly perfectly track the object and use for example the pixelamount for the volume of the sound and the x,y/width,height information for the timeline.
When all objects are tracked and you press the Space-Bar the tracked area is converted into a matrix of 16x16 fields. Each field represents a sound, fields that are lower plays a lower sound, fields that are higher a higher one. The timeline goes from left to right.
The source code is available here: ToneMatrixSource
QuadTrees Actionscript 3
Note: Hence, I write my articles in english (and I'm glad if you notice any mistake and send it to me).
In our course Computergraphics I've developed an implementation of QuadTrees for Actionscript 3. A QuadTree is a datastructure for increasing the efficiency of collisiondetection or nearest neighbour appointment.
You can enable the collisiondetection by hitting a "C" and switch between QuadTree and Bruteforce by hitting Space. The amount of objects can be changed by typing it in the field labeled with 50.
SourceCode: QuadTreeSource
Vision-based Page Segmentation (VIPS)
Die visuelle Programmiersprache VIPS dient dazu Programmabläufe in Form von Struktugrammen zu erstellen (es werden alle Kontrollstrukturen von Java unterstützt) und diese dann laufen zu lassen. Das Programm ist Plattformunabhängig, da in Java geschrieben, entspricht der DIN 66261 und komplett erscheint komplett auf deutsch. 2005 hat VIPS den ersten Platz bei der JavaStars (Sun Microsystems Award) belegt. Das Programm wurde für die Darstellung von Programmabläufen in der Informatik konzipiert oder auch für den Unterricht um beispielsweise Intervallschachtelung oder Wurzelberechnung graphisch darzustellen. Da jedoch neben den bekannten Kontrollstrukturen wie Schleifen oder Verzweigungen auch "professionelle" Features zur Verfügung stehen ist es auch möglich ganze Programme zu schreiben. Die wichtigsten hierbei wären wohl:
- lokale und globale Variablen und Konstanten
- Möglichkeit eigene Objekte zu erstellen
- Rekursion
- 5 Datentypen (Wahrheitswert, Zeichen, Zeichenkette, Ganzzahl, Gleitkommazahl)
- Listen (Arrays)
- Debugging
- Export des Struktugramms als Grafik
- eine große Bibliothek für mathematische Funktionen, Stringverarbeitung, Listen-Handling, einfach Grafikobjekte (Turtle-Grafik) und Ein- und Ausgabe
Um ein Programm mit VIPS zu erstellen, wählt man in der Navigationsleiste "Neues Projekt". Man kann innerhalb eines Projekts mehrere Struktugramme verwalten, die als Art Objekte dienen und von anderen Struktugrammen aufgerufen werden können. Auch kann jedes Struktugramm Paramter und Rückgabe Werte enthalten. Das Hauptprogramm ist immer als "main" betitelt. Um sein Programm nun zu strukturieren hat man neun verschiedene Möglichkeiten, die auch alle in Java als Schleifen, Verzweigungen oder ähnlichem enthalten sind:

Gravata für Ruby on Rails
Hier gefunden: http://overhrd.com/?p=28
Um Gravatar für Ruby on Rails zu verwenden, ist lediglich eine kleine Methode im Application Helper nötig und deren Aufruf in der View.
application_helper.rb
require 'digest/md5'
def gravatar_url_for(email, options = {})
url_for({ :gravatar_id => Digest::MD5.hexdigest(email),
:host => 'www.gravatar.com',
:protocol => 'http://',
nly_path => false,
:controller => 'avatar.php'}.merge(options))
end
View (z. B. index.html.erb)
# plain old gravatar url
<%= gravatar_url_for 'info@sketchit.de' %>
# gravatar url with a rating threshold
<%= gravatar_url_for 'info@sketchit.de', { :rating => 'R' } %>
# show the avatar
<%= image_tag(gravatar_url_for 'info@sketchit.de') %>
# show the avatar with size specified, in case it's served slowly
<%= image_tag(gravatar_url_for('info@sketchit.de'), { :width => 80, :height => 80 }) %>
# link the avatar to some/url
<%= link_to(image_tag(gravatar_url_for 'info@sketchit.de'), 'some/url')%>
Die oben definierte Methode nimmt die übergebene E-Mail Adresse, wandelt es in einen MD5 Hash um, baut daraus die URL von Gravatar zusammen (http://www.gravatar.com/avatar.php?gravatar_id=HASH_WERT) und liefert den Avatar zurück.
Rock-Paper-Scissor: erstes iPhone Game
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Warning: timezone_open() [function.timezone-open]: Unknown or bad timezone (Etc/GMT-1) in /home/www/web43/html/blog/wp-includes/functions.php on line 3875
Für unser Fach Mobile Applications hab ich gestern unser erstes kleines Projekt fertig gestellt, dass klassische "Schere-Stein-Papier", oder wie die Amys sagen würden "Rock-Paper-Scissor" (warum sind die Begriffe eigentlich verdreht? ![]()
Die Syntax von Objectiv-C ist bisschen gewöhnungsbedürftig, aber im großen und ganzen schon zu handeln.
Hier mal ein paar Screenshots:
Und hier noch das gezippte XCode Project:
QuadTrees Implementierung für AS3, v0.1
Die erste Version der QuadTrees für AS3 läuft soweit. Objekte werden schon mal eingefügt, und der Tree selbst graphisch dargestellt. Beim Klick auf ein Quad werden alle zugehörigen Objekte markiert.
Grundlage für die nächste Version, Nearest Neighbour und Collision Detection.
Kleiner Chat in C (Socketprogrammierung mit UDP)
Hier mal ein kleines Beispiel, wie man per select() und dem UDP Protokoll sehr einfach einen Chat unter C erstellen kann.
Das Programm schaut zuerst, ob auf dem Port 5000 schon jemand lauscht, wenn nicht, wird der 5000er zum senden und der 5001 zum empfangen verwendet. Ist schon ein Chat aktiv, werden die Ports einfach umgedreht.
Der Rest ist normalerweise selbstklärend. Den Chat einfach im Terminal (unter OS X) starten, dann noch ein Terminal Fenster auf machen, auch hier den Chat starten, und schon funktionierts!
Hint:
- kompilieren per "g++ -o test main.c"
- aufruf per "./chat"
- (natürlich ohne die " " )
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
void reportError(string str) {
cout << endl << str << errno << endl;
}
int main(int argc, char* argv[])
{
// set the variables
int sock, bytes_recieved, bytes_send;
int port1 = atoi("5000");
int port2 = atoi("5001");
char send_data [1024] , recv_data[1024];
struct sockaddr_in myAddr;
struct sockaddr_in clientAddr;
socklen_t sin_size;
fd_set rfds;
// create the udp socket
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
reportError("Cannot create send socket ....");
exit(1);
}
myAddr.sin_family = AF_INET;
myAddr.sin_port = htons(port1);
myAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
if (bind(sock, (struct sockaddr *)&myAddr, sizeof(struct sockaddr))== -1) {
myAddr.sin_family = AF_INET;
myAddr.sin_port = htons(port2);
myAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
clientAddr.sin_family = AF_INET;
clientAddr.sin_port = htons(port1);
clientAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
if(bind(sock, (struct sockaddr *)&myAddr, sizeof(struct sockaddr))== -1) {
reportError("Unable to bind socket.");
exit(1);
}
}
else
{
clientAddr.sin_family = AF_INET;
clientAddr.sin_port = htons(port2);
clientAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
}
cout << "Wait for data, or type something!" << endl;
// process incoming connections (forever) ....
while(1){
sin_size = sizeof(struct sockaddr_in);
FD_ZERO(&rfds);
FD_SET(sock, &rfds);
FD_SET(0, &rfds);
select(sock + 1, &rfds, NULL, NULL, NULL);
if(FD_ISSET(sock, &rfds))
{
// receive the reply from the client
bytes_recieved = recvfrom(sock, recv_data, 1024,0, (struct sockaddr*)&myAddr, &sin_size);
// client wants the leave, so do we
if (strcmp(recv_data , "q") == 0 || strcmp(recv_data , "Q") == 0) {
close(sock);
break;
}
else if(bytes_recieved == -1)
{
reportError("recvfrom failed.");
exit(1);
} else {
recv_data[bytes_recieved] = '\0';
cout << " " << recv_data << endl;
}
}
else if(FD_ISSET(0, &rfds))
{
gets(send_data);
if (strcmp(send_data , "q") != 0 && strcmp(send_data , "Q") != 0) {
bytes_send = sendto(sock, send_data, 1024, 0, (struct sockaddr*)&clientAddr, sizeof(struct sockaddr));
if(bytes_send == -1)
{
reportError("Error sending data.");
exit(1);
}
}
else
{
close(sock);
break;
}
}
}
close(sock);
return 0;
}
Hoffe jemanden bringts was!
Abschlussprojekt Medien- & Postproduktion 2
So, im Abschlussprojekt für Medien- und Postprod. waren wir diesmal etwas mehr Leute. Herausgekommen ist eine Fortsetzung von Mission Idiots:
Mission IDIOTS 2
dress4success – Berufsinformationsprojekt im Haus der Natur, Salzburg
Pünktlich zur Neueröffnung mit neuer Abteilung "Science" haben auch wir unser Projekt "dress4success" im Haus der Natur in Salzburg fertig gestellt. Bei dieser Installation können die Besucher sich mithilfe von gelben Markern virtuell Berufs-Gadgets "anziehen".
Im Klartext bedeutet diese, man steht vor einem Beamer und wird von einer Kamera gefilmt. Oben laufen langsam die einzelnen Gadgets wie eine Rohrzange, Schweißerbrille, Tastatur oder eine Filmkamera vorbei, die der Besucher mit den gelben Markern zu sich hinziehen kann. Die gelbe Farbe wird hierbei getrackt, und so "haften" die Gadgets an den jeweiligen Markern.
Alle 5 Sekunden wird ein Screenshot gemacht, der zum Terminal neben der Leinwand geschickt wird. Hier hat der Besucher nun die Möglichkeit durch die einzelnen Screenshots zu scrollen und sich das Bild mit passenden Berufsinformationen nach Hause zu schicken.
Das Projekt basiert auf den Digital Puppetry und das Terminal wurde mit Adobes AIR Plattform realisiert. Mitgearbeitet hat dabei Philipp Gigler (MMT), Marius Schebella (Dozent an der FH Salzburg), Lea Perchermeier (Grafikdesign, MMA), Simon Zingerle (Grafikdesign, Berufsgadgets) und natürlich meine Wenigkeit. Weiter unten folgen noch ein paar Bilder vom Aufbau.






