Final Processing Code

Here is the final code for my processing project.

import processing.video.*;

PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
PImage img12;
PImage img13;
PImage img14;
PImage img15;
PImage img16;
PImage img17;
PImage img18;
PImage img19;
PImage img20;
PImage img21;
PImage img22;
PImage img23;
PImage img24;
PImage img25;
PImage img26;
PImage img27;
PImage img28;
PImage img29;
PImage img30;
PImage img31;
PImage img32;
PImage img33;
PImage img34;
PImage img35;
PImage img36;
PImage img37;
PImage img38;
PImage img39;
PImage img40;
PImage img41;
PImage img42;
PImage img43;
PImage img44;
PImage img45;
PImage img46;
PImage img47;
PImage img48;
PImage img49;
PImage img50;
PImage img51;
PImage img52;
PImage img53;
PImage img54;
PImage img55;
PImage img56;
PImage img57;
PImage img58;
PImage img59;
PImage img60;

Capture cam;
color [] colours;

void setup(){
size(1920, 1080);

img1 = loadImage(“Skype.png”);
img2 = loadImage(“dell.png”);
img3 = loadImage(“beats.png”);
img4 = loadImage(“intel.png”);
img5 = loadImage(“nike.png”);
img6 = loadImage(“twitter.png”);
img7 = loadImage(“coca-cola.png”);
img8 = loadImage(“apple.png”);
img9 = loadImage(“starbucks.png”);
img10 = loadImage(“sony.png”);
img11 = loadImage(“canon.png”);
img12 = loadImage(“easports.png”);
img13 = loadImage(“soundcloud.png”);
img14 = loadImage(“youtube.png”);
img15 = loadImage(“windows.png”);
img16 = loadImage(“amazon.png”);
img17 = loadImage(“wella.png”);
img18 = loadImage(“McDonalds.png”);
img19 = loadImage(“google.png”);
img20 = loadImage(“bbc.png”);
img21 = loadImage(“channel4.png”);
img22 = loadImage(“android.png”);
img23 = loadImage(“lg.png”);
img24 = loadImage(“playstation.png”);
img25 = loadImage(“puma.png”);
img26 = loadImage(“whatsapp.png”);
img27 = loadImage(“costa.png”);
img28 = loadImage(“hugoboss.png”);
img29 = loadImage(“ee.png”);
img30 = loadImage(“krispykreme.png”);
img31 = loadImage(“rayban.png”);
img32 = loadImage(“volkswagen.png”);
img33 = loadImage(“odeon.png”);
img34 = loadImage(“pinterest.png”);
img35 = loadImage(“pringles.png”);
img36 = loadImage(“ebay.png”);
img37 = loadImage(“monster.png”);
img38 = loadImage(“underground.png”);
img39 = loadImage(“bp.png”);
img40 = loadImage(“marriot.png”);
img41 = loadImage(“hp.png”);
img42 = loadImage(“glaxosmithkline.png”);
img43 = loadImage(“3m.png”);
img44 = loadImage(“cnn.png”);
img45 = loadImage(“converse.png”);
img46 = loadImage(“durex.png”);
img47 = loadImage(“kawaski.png”);
img48 = loadImage(“evian.png”);
img49 = loadImage(“element.png”);
img50 = loadImage(“sennheiser.png”);
img51 = loadImage(“vans.png”);
img52 = loadImage(“reebok.png”);
img53 = loadImage(“motorola.png”);
img54 = loadImage(“landrover.png”);
img55 = loadImage(“ups.png”);
img56 = loadImage(“ikea.png”);
img57 = loadImage(“dominos.png”);
img58 = loadImage(“lego.png”);
img59 = loadImage(“newbalance.png”);
img60 = loadImage(“gillette.png”);

cam = new Capture(this, 160, 120);
cam.start();
colours = new color[61];
}

void draw(){
// if(mousePressed){saveFrame(“###.png”);};
background(0);
//tint( 0 , 0, map(mouseX, 0, width, 0, 255));
if(cam.available() == true){
cam.read();
grabPixel(0, 30, 70);
grabPixel(1, 60, 30);
grabPixel(2, 80, 30);
grabPixel(3, 100, 30);
grabPixel(4, 150, 30);
grabPixel(5, 20, 30);
grabPixel(6, 10, 30);
grabPixel(7, 5, 30);
grabPixel(8, 1, 30);
grabPixel(9, 150, 100);
grabPixel(10, 130, 100);
grabPixel(11, 120, 80);
grabPixel(12, 60, 60);
grabPixel(13, 40, 40);
grabPixel(14, 30, 80);
grabPixel(15, 70, 100);
grabPixel(16, 10, 10);
grabPixel(17, 80, 30);
grabPixel(18, 20, 20);
grabPixel(19, 40, 70);
grabPixel(20, 30, 50);
grabPixel(20, 60, 30);
grabPixel(21, 100, 80);
grabPixel(22, 40, 80);
grabPixel(23, 140, 90);
grabPixel(24, 100, 90);
grabPixel(25, 50, 90);
grabPixel(26, 70, 90);
grabPixel(27, 90, 60);
grabPixel(28, 70, 80);
grabPixel(29, 20, 90);
grabPixel(30, 145, 110);
grabPixel(31, 130, 45);
grabPixel(32, 110, 110);
grabPixel(32, 80, 100);
grabPixel(33, 50, 60);
grabPixel(34, 20, 110);
grabPixel(35, 10, 30);
grabPixel(36, 150, 10);
grabPixel(37, 155, 80);
grabPixel(38, 120, 10);
grabPixel(39, 50, 50);
grabPixel(40, 90, 80);
grabPixel(41, 10, 85);
grabPixel(42, 60, 30);
grabPixel(43, 95, 50);
grabPixel(44, 70, 10);
grabPixel(45, 90, 55);
grabPixel(46, 100, 20);
grabPixel(47, 120, 70);
grabPixel(48, 110, 40);
grabPixel(49, 40, 45);
grabPixel(50, 80, 75);
grabPixel(51, 100, 55);
grabPixel(52, 85, 35);
grabPixel(53, 95, 65);
grabPixel(54, 20, 40);
grabPixel(55, 30, 30);
grabPixel(56, 70, 25);
grabPixel(57, 55, 85);
grabPixel(58, 75, 65);
grabPixel(59, 80, 95);

}//end if available

tint(colours[0]);
image(img1, 0, 10);
tint(colours[1]);
image(img2, 300, 10);
tint(colours[2]);
image(img3, 450, 10);
tint(colours[3]);
image(img4, 600, 10);
tint(colours[4]);
image(img5, 800, 10);
tint(colours[5]);
image(img6, 1050, 10);
tint(colours[6]);
image(img7, 10, 150);
tint(colours[7]);
image(img8, 1210, 10);
tint(colours[8]);
image(img9, 425, 150);
tint(colours[9]);
image(img10, 10, 310);
tint(colours[10]);
image(img11, 450, 310);
tint(colours[11]);
image(img12, 1220, 150);
tint(colours[12]);
image(img13, 560, 150);
tint(colours[13]);
image(img14, 770, 150);
tint(colours[14]);
image(img15, 1080, 150);
tint(colours[15]);
image(img16, 900, 310);
tint(colours[16]);
image(img17, 10, 410);
tint(colours[17]);
image(img18, 240, 410);
tint(colours[18]);
image(img19, 400, 410);
tint(colours[19]);
image(img20, 700, 410);
tint(colours[20]);
image(img21, 1200, 310);
tint(colours[21]);
image(img22, 1120, 420);
tint(colours[22]);
image(img23, 1280, 310);
tint(colours[23]);
image(img24, 1230, 420);
tint(colours[24]);
image(img25, 10, 550);
tint(colours[25]);
image(img26, 160, 550);
tint(colours[26]);
image(img27, 320, 550);
tint(colours[27]);
image(img28, 440, 550);
tint(colours[28]);
image(img29, 710, 550);
tint(colours[29]);
image(img30, 790, 550);
tint(colours[30]);
image(img31, 1130, 550);
tint(colours[31]);
image(img32, 10, 690);
tint(colours[32]);
image(img33, 155, 690);
tint(colours[33]);
image(img34, 470, 690);
tint(colours[34]);
image(img35, 610, 690);
tint(colours[35]);
image(img36, 730, 690);
tint(colours[36]);
image(img37, 1070, 690);
tint(colours[37]);
image(img38, 1210, 690);
tint(colours[38]);
image(img39, 1330, 10);
tint(colours[39]);
image(img40, 1460, 5);
tint(colours[40]);
image(img41, 1785, 10);
tint(colours[41]);
image(img42, 1420, 150);
tint(colours[42]);
image(img43, 1400, 420);
tint(colours[43]);
image(img44, 1600, 150);
tint(colours[44]);
image(img45, 1380, 310);
tint(colours[45]);
image(img46, 1515, 310);
tint(colours[46]);
image(img47, 1750, 310);
tint(colours[47]);
image(img48, 1670, 410);
tint(colours[48]);
image(img49, 1380, 560);
tint(colours[49]);
image(img50, 1520, 560);
tint(colours[50]);
image(img51, 1390, 700);
tint(colours[51]);
image(img52, 1690, 560);
tint(colours[52]);
image(img53, 1770, 710);
tint(colours[53]);
image(img54, 10, 850);
tint(colours[54]);
image(img55, 270, 850);
tint(colours[55]);
image(img56, 400, 850);
tint(colours[56]);
image(img57, 790, 850);
tint(colours[57]);
image(img58, 950, 860);
tint(colours[58]);
image(img59, 1200, 860);
tint(colours[59]);
image(img60, 1410, 860);

if( mousePressed ){
voidTestDraw();
}

}

void grabPixel( int i, int x, int y){

colours[i] = cam.get(x, y);
}
void voidTestDraw(){
image(cam.get(), 0, 0);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s