Victor Giers 8 місяці тому
джерело
коміт
097a66643a
11 змінених файлів з 113 додано та 22 видалено
  1. 1
    1
      data/saves.sav
  2. BIN
      data/sox-0.png
  3. BIN
      data/sox-149.png
  4. BIN
      data/sox.png
  5. BIN
      data/sox.raw
  6. BIN
      data/sox_sonified.raw
  7. 65
    2
      effects.pde
  8. 32
    9
      manglr2.pde
  9. 7
    6
      secondapplet.pde
  10. 7
    4
      source.pde
  11. 1
    0
      statics_and_lists.pde

+ 1
- 1
data/saves.sav Переглянути файл

@@ -1,2 +1,2 @@
//globals
uptime = 117464831
uptime = 118948355

BIN
data/sox-0.png Переглянути файл


BIN
data/sox-149.png Переглянути файл




BIN
data/sox_sonified.raw Переглянути файл


+ 65
- 2
effects.pde Переглянути файл

@@ -1,3 +1,67 @@
/*

Webcam
*/
boolean webcamRunning;
void startWebcam() {
String[] cameras = Capture.list();
println("Hi");
println(cameras);
cam.start();
webcamRunning = true;
}
void stopWebcam() {
cam.stop();
webcamRunning = false;
}

class WEBCAM extends Shader {
PImage img;
int rw, rh, x, y, w, h, croptop, cropbottom, cropleft, cropright, contrast, brightness, hue, saturation;
final int[] blends = {BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN};
WEBCAM() {
rw = canvas.width;
rh = canvas.height;
name = "Webcam";
img = createImage(rw, rh, ARGB);
if (!webcamRunning) startWebcam();
//params.add(new Param("mode", INTVAL, 0, 1, new int[]{RANDOM, SQUAR}));
params.add(new Param("x", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN, }));
params.add(new Param("y", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("w", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("h", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("croptop", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("cropbottom", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("cropleft", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("cropright", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("contrast", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("brightness", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("hue", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("saturation", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("blend mode", INTVAL, 0, this.blends.length-1, new int[]{RANDOM }));
}
void apply() {
rw = canvas.width;
rh = canvas.height;
x = int(params.get(0).value*rw);
y = int(params.get(1).value*rh);
w = int(params.get(2).value*(rw*2));
h = int(params.get(3).value*(rh*2));

if(cam.available()) img = cam.get();
img = webcamImg.get();

canvas.beginDraw();
canvas.image(img, x, y, w, h);
//for ( int i = 0, l = canvas.pixels.length; i<l; i++) {
//}
canvas.endDraw();
}
void getParams() {
}
}

/*

ASDFPIXELSORT
@@ -4826,8 +4890,7 @@ class SOXBASS extends SOX {
params.add(new Param("width", INTVAL, 1, 10000, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
params.add(new Param("h/k/q/o", INTVAL, 0, 3, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
params.add(new Param("seconds", FLOATVAL, 0.001, 10, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));

}
}
void getParams() {
gain = (int)params.get(9).value;
frequency = (int)params.get(10).value;

+ 32
- 9
manglr2.pde Переглянути файл

@@ -1,11 +1,11 @@
/* todo:
- implement all sox effects
- don't rerender on change of blend-mode
- add blending option everywhere
- add blend-effect to blend a selected layer
- add png corruption
- add png, jpg, gif and fractal compression artifact effects
*/
- implement all sox effects
- don't rerender on change of blend-mode
- add blending option everywhere
- add blend-effect to blend a selected layer
- add png corruption
- add png, jpg, gif and fractal compression artifact effects
*/

import drop.*;
import controlP5.*;
@@ -40,7 +40,7 @@ int w, h;
boolean spawnPlaying = false;
boolean autoPlay = false;
boolean videoRecord = false;
boolean webcamMode = false;
//boolean webcamMode = false;

String[] params;

@@ -77,7 +77,14 @@ void setup() {
}
fallbackImage = loadImage(dataPath("0.png"));
bin = loadImage(dataPath("bin.png"));
cam = new Capture(this, 1280, 768);
String[] cameras = Capture.list();
cam = new Capture(this, 1920,1080, "pipeline:autovideosrc");
//falls du nicht mit mir in die oper möchtest gehe ich mit pe, sie hat morgen abend keine termine und würde sich natürlich in beiden fällen freuen. von ihr auch noch alles gute zum geburtstag hatte ich vergessen zu sagen.
//ich bin auch aufgeregt. vielleicht doch lieber mit dem zug. einfach versuchen sich einfach was zu gönnen. zu deinem schwarzen kleid ziehe ich
OS = getOS();

String[] args = {"SecondFrame"};
@@ -85,6 +92,7 @@ void setup() {
gui = new SecondApplet();
PApplet.runSketch(args, gui);


renderer = createGraphics(width, height);
renderer.noSmooth();
viewport = createImage(renderer.width, renderer.height, ARGB);
@@ -92,9 +100,23 @@ void setup() {
//sourceManager.importURI("/home/giers/.local/bin/fast-style-transfer/data/train2014");
}


PImage webcamImg;
void captureEvent(Capture c) {
c.read();
webcamImg = cam.get();
}



void draw() {
uptime+=1;
renderFrameRate = frameRate;

//if(webcamRunning){
//webcamImg =
// }

background(255);

sourceManager.update(); //will write some image to the renderer
@@ -124,6 +146,7 @@ void draw() {
fill(#ff0000);
ellipse(width-100, height-100, 30, 30);
}


if (recording) {

+ 7
- 6
secondapplet.pde Переглянути файл

@@ -24,7 +24,8 @@ public class SecondApplet extends PApplet {
public void settings() {
size(275, 120);
}
Toggle webcam, auto;
//Toggle webcam, auto;
Toggle auto;
public void setup() {
surface.setLocation(285, 240);
//List l = Arrays.asList(availableFx);
@@ -62,12 +63,12 @@ public class SecondApplet extends PApplet {



webcam = cp5.addToggle("webcam")
/* webcam = cp5.addToggle("webcam")
.setPosition(100, height-65)
.setSize(12, 12)
.setValue(false)
.plugTo(this, "CP5_webcamAction");
webcam.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20);
webcam.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20);*/

Toggle robot = cp5.addToggle("autoPlay")
.setPosition(100, height-50)
@@ -101,16 +102,16 @@ public class SecondApplet extends PApplet {
startRobot = true;
autoPlay = !autoPlay;
}
/*
void CP5_webcamAction()  {
webcamMode = !webcamMode;
if (webcamMode) sourceManager.startWebcam();
else {
sourceManager.stopWebcam();
source = null;
source = null; //to trigger auto-fallback next frame
}
}
*/
void CP5_nativeResoAction() {
renderSize = max(nativeResoX, nativeResoY);
//renderer.setSize(nativeResoX, nativeResoY);

+ 7
- 4
source.pde Переглянути файл

@@ -38,7 +38,8 @@ class SourceManager { //no constructor
void setImage(PImage img) { //set image to source
imageChanged = true;
source = img.get();
if(!webcamMode)fallbackImage = source;
//if(!webcamMode) fallbackImage = source;
fallbackImage = source;
nativeResoX = source.width;
nativeResoY = source.height;
//println(nativeResoX);
@@ -48,7 +49,7 @@ class SourceManager { //no constructor
println("Fallback");
setImage(fallbackImage); //fallbackImage should always be a copy of the last image that worked
}
/*
void startWebcam() {
String[] cameras = Capture.list();
println(cameras);
@@ -58,15 +59,17 @@ class SourceManager { //no constructor
void stopWebcam() {
cam.stop();
webcamMode = false;
}
}*/

void update() {
/*
if (webcamMode) {
if (cam.available()) {
cam.read();
setImage(cam);
}
}
*/

if (source == null) {
fallback();
@@ -123,7 +126,7 @@ class SourceManager { //no constructor
if (isImage(path) || isVideo(path)) {
println("Importing file " + path);
if (moviePlaying) movie.stop();
if (webcamMode) gui.webcam.setValue(false);
//if (webcamMode) gui.webcam.setValue(false);
if (isImage(path)) {
moviePlaying = false;
setImage(loadImage(path));

+ 1
- 0
statics_and_lists.pde Переглянути файл

@@ -1,4 +1,5 @@
String FX[] = {
"WEBCAM",
"ASDFPIXELSORT",
"DISTORTER",
"FM",

Завантаження…
Відмінити
Зберегти