Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions Canvas.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
void mousePressed() {
switch (MENU){
case 'H' :
if (mouseOver!=0) {
switch (mouseOver) {
case 1 : videoAddress = "../data/vdos/pew_vid.mp4"; break;
case 2 : videoAddress = "../data/vdos/ksi_vid2.mp4"; break;
case 3 : videoAddress = "../data/vdos/js_vid.mp4"; break;
case 4 : videoAddress = "../data/vdos/German_vid.mp4";break;
case 5 : videoAddress = "../data/vdos/shane_vid.mp4";break;
case 6 : videoAddress = "../data/vdos/BB_vid.mp4"; break;
case 7 : videoAddress = "../data/vdos/gigi_vid.mp4"; break;
case 8 : videoAddress = "../data/vdos/pomz_vid.mp4"; break;
case 9 : videoAddress = "../data/vdos/NK_vid.mp4"; break;}
homeCanvas.beginDraw();
homeCanvas.clear();
homeCanvas.endDraw();
myMovie = new Movie(this, videoAddress);
myMovie.speed(1);
myMovie.play();
mouseOver=0;
MENU = 'C';
}
break;
case 'C' :
if (mouseX>width/2-20 && mouseX<width/2+20 && mouseY>height-60 && mouseY <height-20) {
if (play) {
Btn03=loadImage("Btn-06.png");
myMovie.pause();
play=false;
} else {
Btn03=loadImage("Btn-03.png");
myMovie.speed(1);
myMovie.play();
play=true;
}
} else if (mouseX<width/2+165 && mouseX>width/2+105 && mouseY>height-60 && mouseY <height-20) {
println("Skip");
Btn03=loadImage("Btn-03.png");
myMovie.stop();
play=true;
myMovie = new Movie(this, "../NK8_trim.mp4");
myMovie.speed(1);
myMovie.play();
MENU = 'G';
} else if (mouseX>width/2-155 && mouseX<width/2-115 && mouseY>height-60 && mouseY <height-20) {
println("Exit");
Btn03=loadImage("Btn-03.png");
imageMode(CORNER);
myMovie.stop();
play=true;
MENU = 'H';
} else if (mouseX>width/2-90 && mouseX<width/2-45 && mouseY>height-60 && mouseY <height-20) {
println("CurrentTime: "+myMovie.time());
myMovie.jump(myMovie.time()-8.0);
myMovie.play();
play=true;
} else if (mouseX<width/2+90 && mouseX>width/2+45 && mouseY>height-60 && mouseY <height-20) {
println("fastforward");
myMovie.speed(8.0);
myMovie.play();
play=true;
}
break;
case 'G' :
if ((mouseX > width/2+20 && mouseX < width/2+70)&&(mouseY > 570 && mouseY <620 )) { //GREEN/RED/PAUSE button
println("pause");
if (play) { //Clip was playing
myMovie.pause();
myMovie.volume(0);
play=false;
} else { //clip wasn't playing
if (!readytoPlay) { //don't look like meaningful lines
light = loadImage("redLight.png");
} else {
light = loadImage("greenLight.png");
}
myMovie.speed(1);
myMovie.play();
play=true;
}
}
if ((mouseX>20&&mouseX<70)&&(mouseY > 570 && mouseY <620)) {//reset
println("reset");
myMovie.jump(0);
if (!readytoPlay) {
light = loadImage("redLight.png");
} else {
light = loadImage("greenLight.png");
}
myMovie.noLoop();
myMovie.speed(1);
myMovie.play();
play=true;
}
if ((mouseX>80&&mouseX<130)&&(mouseY>570&&mouseY<620)) {//loop vid
myMovie.jump(0);
myMovie.loop();
}
if ((mouseX>10&&mouseX<60)&&(mouseY>10&&mouseY<70)) {//exit
println("exit");
MENU = 'H';
myMovie.stop();
canvas.beginDraw();
canvas.clear();
canvas.endDraw();
readytoPlay=false;
playtime=false;
GAME = 'T';
}
break;
}
}
void home() {
//println("mouseOver: "+mouseOver);
homeCanvas.beginDraw();
homeCanvas.background(255);
homeCanvas.textAlign(CENTER);
//homeCanvas.fill(0);
//homeCanvas.stroke(1);
//homeCanvas.textFont(Head);
//homeCanvas.text("iCeleb", width/2, 80);
//homeCanvas.textFont(subTitle);
//homeCanvas.text("SERIES 1. YOU TUBE ME.", width/2, 120);
homeCanvas.image(title, width/2-185, 40);
homeCanvas.noFill();
homeCanvas.image(pew, width/5, 200, width/5, height/5);
homeCanvas.image(ksi, width/5*2, 200, width/5, height/5);
homeCanvas.image(js, width/5*3, 200, width/5, height/5);
homeCanvas.image(gm, width/5, height/5+200, width/5, height/5);
homeCanvas.image(shane, width/5*2, height/5+200, width/5, height/5);
homeCanvas.image(bb, width/5*3, height/5+200, width/5, height/5);
homeCanvas.image(gg, width/5, height/5*2+200, width/5, height/5);
homeCanvas.image(pom, width/5*2, height/5*2+200, width/5, height/5);
homeCanvas.image(nk, width/5*3, height/5*2+200, width/5, height/5);
homeCanvas.endDraw();
if (mouseX>width/5&&mouseX<width/5*2&&mouseY>200&&mouseY<height/5+200) {mouseOver=1;//println("PewDiePie");
}if (mouseX>width/5*2 && mouseX<width/5*3 && mouseY>200 && mouseY<height/5+200) {mouseOver= 2;//println("KSI");
}if (mouseX>width/5*3 && mouseX<width/5*4 && mouseY>200 && mouseY<height/5+200) {mouseOver=3;//println("Jeffree");
}if (mouseX>width/5 && mouseX<width/5*2 && mouseY>height/5+200 && mouseY<height/5+370) {mouseOver=4;//println("German");
}if (mouseX>width/5*2 && mouseX<width/5*3 && mouseY>height/5+200 && mouseY<height/5+370) {mouseOver=5;//println("Shane");
}if (mouseX>width/5*3 && mouseX<width/5*4 && mouseY>height/5+200 && mouseY<height/5+370) {mouseOver=6;//println("BB");
}if (mouseX>width/5 && mouseX<width/5*2 && mouseY>height/5*2+200 && mouseY<height/5*2+370) {mouseOver=7;//println("Gigi");
}if (mouseX>width/5*2 && mouseX<width/5*3 && mouseY>height/5*2+200 && mouseY<height/5*2+370) {mouseOver=8;//println("SoftPomz");
}if (mouseX>width/5*3 && mouseX<width/5*4 && mouseY>height/5*2+200 && mouseY<height/5*2+370) {mouseOver=9;//println("Nikkie");
}
image(homeCanvas, 0, 0);
}
void setupNewUI() {
//fullScreen(); //full screen size is 1440x900
textAlign(CENTER);
Head = createFont("SanFranciscoDisplay-Bold.otf", 32);
subTitle = createFont("SanFranciscoDisplay-Regular.otf", 12);
canvas = createGraphics(w/2, h/2,P3D);
homeCanvas = createGraphics(w, h);
fill(0);
//myMovie = new Movie(this, "../NK8_trim.mp4");
// put after cam.start to get it play at the same time.
qBtn = loadImage("quitBtn.png");
rBtn = loadImage("reSetBtn.png");
loopBtn = loadImage("loopBtn.png");
light = loadImage("redLight.png");
js=loadImage("thumbnails/JS.jpg");
ksi=loadImage("thumbnails/ksi.jpg");
nk=loadImage("thumbnails/nk.jpg");
bb=loadImage("thumbnails/BB.jpg");
gm=loadImage("thumbnails/German.jpg");
gg=loadImage("thumbnails/gg.jpg");
pew=loadImage("thumbnails/pew.jpg");
pom=loadImage("thumbnails/pomz.jpg");
shane=loadImage("thumbnails/shane.jpg");
title=loadImage("cNNtitle.png");
///
//charSel buttons
Btn01=loadImage("Btn-01.png");
Btn02=loadImage("Btn-02.png");
Btn03=loadImage("Btn-03.png");
Btn04=loadImage("Btn-04.png");
Btn05=loadImage("Btn-05.png");

}
void scoreBoard() {
textFont(Head);
textSize(24);
text("Facial Famous Points: "+score, width/2, 100);
textFont(subTitle);
textSize(20);
text("Nikkie", width/4, 180);
text("The Next Celeb", width-(width/4), 180);
text(scoreString, width/2, height-100);
}
106 changes: 106 additions & 0 deletions Score.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
float area =0.2;
float ori = 0.01;
void comparison(){
if (eyeLeftHeight != 0.0&& plugged) {
//reportFrame();
videoFrame++;
if (videoFrame<90) {//frameCount
TableRow row = referTable.getRow(videoFrame); //sync to the referTable it was frameCount
NKframe = row.getInt("frameCount");
NKBrowL = row.getFloat("LBrowH");
NKBrowR = row.getFloat("RBrowH");
NKEyeL = row.getFloat("LEyeH");
NKEyeR = row.getFloat("REyeH");
NKNose = row.getFloat("nose");
NKMouthH = row.getFloat("MouseH");
NKMouthW = row.getFloat("MouseW");
NKOriX = row.getFloat("OriX");
NKOriY = row.getFloat("OriY");
NKOriZ = row.getFloat("OriZ");
}
//scoring();
if (endOfClip) { //frameCount >=90
//scoring();
//frameCount =0;
score = 0;
println("show the SCORE HERE");
endOfClip = false;
}else{
scoring();
}
} else {
frameCount =0;
score = 0;
}
}

void scoring() {
println("FRAME : " + NKframe+ " CSV : "+NKOriZ +
" left : "+poseOrt_z*-1 + //" right : "+rightEyebrowHeight +
" SCORE : "+score);
if (NKBrowL-area <rightEyebrowHeight && NKBrowL+area >rightEyebrowHeight) {score++;}
if (NKBrowR-area<leftEyebrowHeight && NKBrowR+area >leftEyebrowHeight) {score++;}
if (NKEyeL-area< eyeRightHeight && NKEyeL+area> eyeRightHeight) {score++;}
if (NKEyeR-area< eyeLeftHeight && NKEyeR+area >eyeLeftHeight ) {score++;}
if (NKNose-area< nostrilHeight && NKNose+area >nostrilHeight) {score++;}
if (NKMouthH-area< mouthHeight && NKMouthH+area> mouthHeight) {score++;}
if (NKMouthW-area< mouthWidth && NKMouthW+area> mouthWidth) {score++;}
if (NKOriX-ori<poseOrt_x && NKOriX+ori>poseOrt_x) {score++;}
if (NKOriY-ori<poseOrt_y && NKOriY+ori>poseOrt_y) {score++;}
if (NKOriZ-ori<poseOrt_z*-1 && NKOriZ+ori>poseOrt_z*-1) {score++;}

if (score < 400) {scoreString = "You are such a mundane person.";}
else if (score>=500 && score<=500) {scoreString = "Your acting is ok but still too boring.";}
else if ( score>500 & score <=600) {scoreString = "You are kidda fancy person.";}
else if ( score>600 & score <=700) {scoreString = "Ahrr.. May be you can be a star one day.";}
else if ( score>700 ) {scoreString = "Yeah... you do good. Ready for a celeb life?";}
}

void loadReferTable() {
//referTable = loadTable("NikkiVideoData.csv","header");
//println(referTable.getRowCount() + "total rows in table");
for (TableRow row : referTable.rows()) {
NKframe = row.getInt("frameCount");
NKBrowL = row.getFloat("LBrowH");
NKBrowR = row.getFloat("RBrowH");
NKEyeL = row.getFloat("LEyeH");
NKEyeR = row.getFloat("REyeH");
NKNose = row.getFloat("nose");
NKMouthH = row.getFloat("MouseH");
NKMouthW = row.getFloat("MouseW");
NKOriX = row.getFloat("OriX");
NKOriY = row.getFloat("OriY");
NKOriZ = row.getFloat("OriZ");
println("DATA FROM THE CSV : "+NKOriZ);
}
}

void saveReferTable(){
infoTable = new Table();
infoTable.addColumn("frameCount");
infoTable.addColumn("LBrowH");
infoTable.addColumn("RBrowH");
infoTable.addColumn("LEyeH");
infoTable.addColumn("REyeH");
infoTable.addColumn("nose");
infoTable.addColumn("MouseH");
infoTable.addColumn("MouseW");
infoTable.addColumn("OriX");
infoTable.addColumn("OriY");
infoTable.addColumn("OriZ");
//saveTable(infoTable, "table.csv");
//////////////////these were at setup()/////////////////////////
TableRow newRow = infoTable.addRow();
newRow.setInt("frameCount", frameCount);//infoTable.lastRowIndex());
newRow.setFloat("LBrowH", Math.round(leftEyebrowHeight*100)/100.0);
newRow.setFloat("RBrowH", Math.round(rightEyebrowHeight*100)/100.0);
newRow.setFloat("LEyeH", Math.round(eyeLeftHeight*100)/100.0);
newRow.setFloat("REyeH", Math.round(eyeRightHeight*100)/100.0);
newRow.setFloat("nose", Math.round(nostrilHeight*100)/100.0);
newRow.setFloat("MouseH", Math.round(mouthHeight*100)/100.0);
newRow.setFloat("MouseW", Math.round(mouthWidth*100)/100.0);
newRow.setFloat("OriX", Math.round(poseOrt_x*100)/100.0);
newRow.setFloat("OriY", Math.round(poseOrt_y*1000)/1000.0);
newRow.setFloat("OriZ", Math.round(poseOrt_z*100)/100.0);

}
Loading