Video montage to logo problem

edited April 2014 in Questions about Code

I'm gonna sleep I could probably work out what's wrong but not in the time frame :/ I was working on a video montaging program and it works perfectly until it has zoomed out then it only shows a certain part of the logo:

import processing.video.*;

Movie vid1, vid2, vid3;
float movieWidth = 1280, movieHeight = 720, movieLength = 30;
PImage logo;

void setup() {
  size(1280, 720);
  background(0);
  vid1 = new Movie(this, "video1.mp4");
  vid1.loop();
  vid2 = new Movie(this, "video2.mp4");
  vid2.loop();
  vid3 = new Movie(this, "video3.mp4");
  vid3.loop();
  logo = loadImage("DCRaven.png");
  frameRate(30);
  noStroke();
  imageMode(CENTER);
  rectMode(CENTER);
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  randomSeed(0);
  pushMatrix();
  translate(width/2, height/2);

  for(int x = -width/2; x <= width/2; x++) {
    for(int y = -height/2; y <= height/2; y++) {
      float r = random(3);
      if(r <= 1) {
        image(vid1, x*movieWidth, y*movieHeight, movieWidth, movieHeight);
      }
      else if(r <= 2) {
        image(vid2, x*movieWidth, y*movieHeight, movieWidth, movieHeight);
      }
      else if(r <= 3) {
        image(vid3, x*movieWidth, y*movieHeight, movieWidth, movieHeight);
      }
      color c = logo.get(x+width/2, y+height/2);
      fill(red(c), green(c), blue(c), 255/movieLength*frameCount);
      stroke(red(c), green(c), blue(c), 255/movieLength*frameCount);
      rect(x*movieWidth, y*movieHeight, movieWidth, movieHeight);
    }
  }

  popMatrix();

  println("percent done: " + (frameCount/(movieLength/100)) + "%" + " movieWidth: " + movieWidth);
  save("frame " + frameCount + ".png");
  if(frameCount > movieLength) exit();

  movieWidth = constrain(movieWidth-width/movieLength, 1, width);
  movieHeight = constrain(movieHeight-height/movieLength, 1, height);
}

anyone got a fix for the logo zoom problem?

Tagged:

Answers

  • Sorry, but I didn't understand what is your problem, exactly.

  • edited April 2014

    In short the problem is it doesn't work. If you wanted me to elaborate that then what happens is this program draws 921600 movies in a grid 1280 x 720 format. The videos get smaller until each video is 1 x 1 pixel big so you can see every video on screen. Each video is meant to morph into one pixel of logo.png but thats the part that doesn't work perfectly. It draws some of the middle of the logo even though it was meant to draw 1280 x 720 pixels of the logo. Get me now?

    I guess this will be left unanswered... For the rest of time :(

Sign In or Register to comment.